linuxrc: trivial, improve code style of linuxrc

master v23
Fabio Erculiani 12 years ago
parent a7def21edc
commit 9d8560729f

@ -6,11 +6,10 @@
# Clean input/output # Clean input/output
exec >${CONSOLE} <${CONSOLE} 2>&1 exec >${CONSOLE} <${CONSOLE} 2>&1
if [ "$$" != '1' ] if [ "$$" != "1" ]; then
then echo "/linuxrc has to be run as the init process as the one"
echo '/linuxrc has to be run as the init process as the one' echo "with a PID of 1. Try adding init=/linuxrc to the"
echo 'with a PID of 1. Try adding init="/linuxrc" to the' echo "kernel command line or running "exec /linuxrc"."
echo 'kernel command line or running "exec /linuxrc".'
exit 1 exit 1
fi fi
@ -21,24 +20,22 @@ mount -t tmpfs none /dev/shm 2>&1
/bin/busybox --install -s /bin/busybox --install -s
if [ "$0" = '/init' ] if [ "$0" = "/init" ]; then
then rm -f /linuxrc
[ -e /linuxrc ] && rm /linuxrc
fi fi
CMDLINE=$(cat /proc/cmdline) CMDLINE=$(cat /proc/cmdline)
FAKE_ROOT='' FAKE_ROOT=""
FAKE_INIT='' FAKE_INIT=""
REAL_INIT='/sbin/init' REAL_INIT="/sbin/init"
FAKE_ROOTFLAGS='' FAKE_ROOTFLAGS=""
INIT_OPTS='' INIT_OPTS=""
ROOTFSTYPE='auto' ROOTFSTYPE="auto"
CRYPT_SILENT=0 CRYPT_SILENT=0
QUIET='' QUIET=""
mkdir -p /etc/cmdline /etc/modprobe.d mkdir -p /etc/cmdline /etc/modprobe.d
for x in ${CMDLINE} for x in ${CMDLINE}; do
do
case "${x}" in case "${x}" in
real_root=*) real_root=*)
REAL_ROOT=${x#*=} REAL_ROOT=${x#*=}
@ -103,8 +100,7 @@ do
dozfs*) dozfs*)
USE_ZFS=1 USE_ZFS=1
if [ "${x#*=}" = 'force' ] if [ "${x#*=}" = "force" ]; then
then
ZPOOL_FORCE=-f ZPOOL_FORCE=-f
fi fi
;; ;;
@ -112,7 +108,7 @@ do
QUIET=1 QUIET=1
;; ;;
debug) debug)
DEBUG='yes' DEBUG="yes"
;; ;;
scandelay=*) scandelay=*)
SDELAY=${x#*=} SDELAY=${x#*=}
@ -122,14 +118,14 @@ do
;; ;;
doload=*) doload=*)
MDOLIST=${x#*=} MDOLIST=${x#*=}
MDOLIST=$(echo ${MDOLIST} | sed -e 's/,/ /g') MDOLIST=$(echo ${MDOLIST} | sed -e "s/,/ /g")
;; ;;
nodetect) nodetect)
NODETECT=1 NODETECT=1
;; ;;
noload=*) noload=*)
MLIST=${x#*=} MLIST=${x#*=}
MLIST="$(echo ${MLIST} | sed -e 's/,/ /g')" MLIST="$(echo ${MLIST} | sed -e "s/,/ /g")"
export MLIST export MLIST
;; ;;
CONSOLE=*|console=*) CONSOLE=*|console=*)
@ -144,7 +140,7 @@ do
;; ;;
lvmraid=*) lvmraid=*)
RAID_DEVICES="${x#*=}" RAID_DEVICES="${x#*=}"
RAID_DEVICES="$(echo ${RAID_DEVICES} | sed -e 's/,/ /g')" RAID_DEVICES="$(echo ${RAID_DEVICES} | sed -e "s/,/ /g")"
USE_LVM_NORMAL=1 USE_LVM_NORMAL=1
;; ;;
part=*) part=*)
@ -311,7 +307,7 @@ splashcmd hasroot "${NEW_ROOT}"
# Execute script on the cdrom just before boot to update things if necessary # Execute script on the cdrom just before boot to update things if necessary
cdupdate cdupdate
if [ "${SUBDIR}" != '' ] && [ -e "${CHROOT}/${SUBDIR}" ]; then if [ "${SUBDIR}" != "" ] && [ -e "${CHROOT}/${SUBDIR}" ]; then
good_msg "Entering ${SUBDIR} to boot" good_msg "Entering ${SUBDIR} to boot"
CHROOT="${CHROOT}/${SUBDIR}" CHROOT="${CHROOT}/${SUBDIR}"
fi fi

Loading…
Cancel
Save