# Filename: /linuxrc
# Purpose: minirt for kernel 2.6 running on grml live-cd
# Authors: (c) Klaus Knopper <knoppix@knopper.net>, (c) Michael Prokop <mika@grml.org>
-# Latest change: Mon Apr 09 12:47:28 CEST 2007
+# Latest change: Sat Apr 14 12:41:44 CEST 2007 [mika]
#######################################################################################
# hardcoded configurable options
#}
log_failure_msg () {
- echo " ${RED}*${NORMAL} $@"
+ echo -n " ${RED}*${NORMAL} $@"
}
#log_warning_msg () {
GRML_NAME="GRML"
case "$CMDLINE" in *grml_dir=*) GRML_DIR="$grml_dir"; ;; esac
case "$CMDLINE" in *grml_name=*) GRML_NAME="$grml_name"; ;; esac
+case "$CMDLINE" in *small*) GRML_TYPE="small"; ;; esac
# NFS
for i in $cmdline; do case "$i" in nfsdir=*|NFSDIR=*) eval $i;; esac; done
cat /proc/cmdline
fi
-# check for available ram
-RAM=$(/static/awk '/MemTotal/{print $2}' /proc/meminfo)
-log_begin_msg "${RAM} kB of RAM available"
-
-case "$CMDLINE" in *small*) GRML_TYPE="small"; ;; esac
-
-if [ "$GRML_TYPE" = "small" ]
-then
- if [[ $RAM -lt 25000 ]]
- then
- log_end_msg "You need at least 32MB of RAM available for grml-small"
- return 1
- fi
-else
- if [[ $RAM -lt 58000 ]]
- then
- log_end_msg "You need at least 64Mb of RAM available for grml"
- return 1
- fi
-fi
-
# Run a shell if in debug mode
# echo "${BLUE}Dropping you to a busybox shell for debugging.${NORMAL}"
stage=1
dhcp_iface_=$(getbootparam dhcp_iface)
if [ -z "$dhcp_iface_" ]; then
- dhcp_iface_=`ifconfig -a | grep '^eth' | sed 's/ .*//'`
+ dhcp_iface_=`ifconfig -a | grep '^eth' | sed 's/ .*//'`
fi
# make sure we have a udhcpc executable, if it's not present
}
# Rerun the grml-CDROM part 3 times at total
-if ! grmlmount ; then
- log_warning_msg "grml CD-ROM not yet found, sleeping for 5 seconds and trying again then."
- sleep 5
- if ! grmlmount ; then
- log_warning_msg "grml CD-ROM still not yet found, sleeping for 5 more seconds and trying once more again."
- sleep 5
+grmlmount
+if [ -z "$FOUND_GRML" ] ; then
+ echo
+ log_warn_msg "grml CD-ROM not yet found, sleeping for 5 seconds and trying again then."
+ sleep 5 && echo " $SUCCESS"
+ grmlmount
+ if [ -z "$FOUND_GRML" ] ; then
+ echo
+ log_warn_msg "grml CD-ROM still not yet found, sleeping for 5 more seconds and trying once more again."
+ sleep 5 && echo " $SUCCESS"
fi
fi
[ -n "$SOURCE2" ] && umount $SOURCE2 # umount possible loop-device
mount_grml $TARGET
else
- log_failure_msg "Warning: Changing to $TARGET failed."
+ log_failure_msg "Warning: Changing to $TARGET failed." ; echo "$FAILED"
return 1
fi
fi
if [ $? -ne 0 ]; then
[ -n "$LOOP_SOURCE" ] && /bin/umount $LOOP_SOURCE
- log_failure_msg "Accessing grml CD-ROM failed. ${MAGENTA}$TARGET_DEV${NORMAL} is not mountable."
+ log_failure_msg "Accessing grml CD-ROM failed. ${MAGENTA}$TARGET_DEV${NORMAL} is not mountable." ; echo "$FAILED"
sleep 2
return 1
fi
if [ -f $TARGET/$GRML_DIR/$GRML_NAME ]; then
log_begin_msg "Accessing grml CD-ROM at ${MAGENTA}$TARGET_DEV${NORMAL}." ; echo " $SUCCESS"
else
- log_failure_msg "Accessing grml CD-ROM failed. Could not find $GRML_DIR/$GRML_NAME on ${MAGENTA}$TARGET_DEV${RED}.${NORMAL}"
+ log_failure_msg "Accessing grml CD-ROM failed. Could not find $GRML_DIR/$GRML_NAME on ${MAGENTA}$TARGET_DEV${RED}.${NORMAL}" ; echo "$FAILED"
[ -n "$LOOP_SOURCE" ] && /bin/umount $LOOP_SOURCE
umount $TARGET
sleep 2
fi
done
if test -z "$MOUNTED"; then
- log_failure_msg "Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${NORMAL} is not mountable."
+ log_failure_msg "Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${NORMAL} is not mountable." ; echo "$FAILED"
sleep 2
return 1
fi
esac
# sanity check
-
- if [ $FOUNDSPACE -lt $SIZE ]
- then
- log_failure_msg "Copying grml CD-ROM failed. Not enough free space on ${MAGENTA}${TARGET_DEV_DESC}${NORMAL}. Found: ${MAGENTA}${FOUNDSPACE}k${NORMAL} Need: ${MAGENTA}${SIZE}k${NORMAL}"
+ if [ $FOUNDSPACE -lt $SIZE ] ; then
+ log_failure_msg "Copying grml CD-ROM failed. Not enough free space on ${MAGENTA}${TARGET_DEV_DESC}${NORMAL}:" ; echo "$FAILED"
+ log_failure_msg "Found: ${MAGENTA}${FOUNDSPACE}k${NORMAL} Need: ${MAGENTA}${SIZE}k${NORMAL}" ; echo "$FAILED"
sleep 2
umount $TARGET
return 1
fi
# do the real copy
-
log_begin_msg "Copying grml CD-ROM to ${TARGET_DEV_DESC}... Please be patient."
echo
- if [ -z "$use_cp" -a -x /usr/bin/rsync ]
- then
+ if [ -z "$use_cp" -a -x /usr/bin/rsync ] ; then
# first cp the small files
/usr/bin/rsync -a --exclude="$GRML_DIR/$GRML_NAME" $COPY $TARGET # Copy grml to $TARGET
# then the big file with nice progress meter
else
/bin/cp -a -f $COPY $TARGET # Copy grml to $TARGET
fi
- if [ $? -ne 0 ]
- then
- log_failure_msg "Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${NORMAL} possibly has not enough space left."
+ if [ $? -ne 0 ] ; then
+ log_failure_msg "Copying grml CD-ROM failed. ${MAGENTA}$TARGET_DEV_DESC${NORMAL} possibly has not enough space left." ; echo "$FAILED"
sleep 2
return 1
fi
cat /GRML/etc/ld.so.cache > /etc/ld.so.cache
UNIONFS=""
-if checkbootparam "unionfs" ; then
+if checkbootparam "unionfs" || test ! -r /modules/aufs.ko ; then
$INSMOD /modules/unionfs.ko 1>/dev/null
grep -q unionfs /proc/filesystems && UNIONFS=yes
unionfs='unionfs'
# Default ramdisk size for ramdisk
[ -n "$TOTALMEM" ] && RAMSIZE="$(/usr/bin/expr $TOTALMEM / 5)"
+# check for available RAM
+# check for bootoption small and/or grml-small
+if [ -n "$FOUNDMEM" ] ; then
+ if [ "$GRML_TYPE" = "small" ] ; then
+ if [ "$FOUNDMEM" -lt 25000 ] ; then
+ log_begin_msg "Bootoption *small detected, but you need at least 32MB of RAM available." ; echo " $FAILED"
+ log_begin_msg "Dropping you to a shell, continue on your own risk." ; echo " $FAILED"
+ /bin/bash
+ fi
+ else
+ if [ "$FOUNDMEM" -lt 58000 ] ; then
+ log_begin_msg "You need at least 64MB of RAM available for grml." ; echo " $FAILED"
+ log_begin_msg "Dropping you to a shell, continue on your own risk." ; echo " $FAILED"
+ /bin/bash
+ fi
+ fi
+fi
+
# Create additional dynamic ramdisk.
test -z "$RAMSIZE" -o "$RAMSIZE" -lt "$MINSIZE" && RAMSIZE="$MINSIZE"
mkdir -p /ramdisk
done && echo " $SUCCESS" || echo " $FAILED"
else
echo ""
- log_failure_msg "ERROR: CANNOT UNITE READ-ONLY MEDIA AND INITIAL RAMDISK!"
- echo "$FAILED"
- sleep 2
- echo "Can not continue booting, dropping you to a busybox shell."
- stage=4
- rundebugshell
+ log_failure_msg "ERROR: CANNOT UNITE READ-ONLY MEDIA AND INITIAL RAMDISK!" ; echo "$FAILED"
+ log_failure_msg "Can not continue booting, dropping you to a shell." ; echo "$FAILED"
+ /bin/bash
fi
chown grml.grml /home/grml