@ -5,8 +5,7 @@ backup() {
echo -ne "\033[0G\033[0K"
}
strlen()
{
strlen() {
if [ -z "$1" ]
then
echo "usage: strlen <variable_name>"
@ -92,6 +91,7 @@ findcdmount() {
fi
fi
}
cache_cd_contents() {
# Check loop file exists and cache to ramdisk if DO_cache is enabled
if [ "${LOOPTYPE}" != "noloop" ] && [ "${LOOPTYPE}" != "sgimips" ]
@ -130,8 +130,7 @@ mount_sysfs(){
# $1 = union absolute path (starting with /)
# $2 = path to data directory
#
union_insert_dir()
{
union_insert_dir() {
/sbin/unionctl $1 --add --after 0 --mode ro $2
if [ $? = '0' ]
then
@ -140,14 +139,17 @@ union_insert_dir()
}
findnfsmount() {
if [ "${IP}" != '' ]; then
if [ "${NFSROOT}" = '' ]; then
if [ "${IP}" != '' ]
then
if [ "${NFSROOT}" = '' ]
then
# Obtain NFSIP
OPTIONS=`busybox dmesg | grep rootserver | sed -e "s/,/ /g"`
for OPTION in $OPTIONS
do
if [ `echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 1` = 'rootserver' ]; then
NFSIP=`echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 2`;
if [ `echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 1` = 'rootserver' ]
then
NFSIP=`echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 2`
fi
done
@ -155,8 +157,9 @@ findnfsmount() {
OPTIONS=`busybox dmesg | grep rootpath | sed -e "s/,/ /g"`
for OPTION in $OPTIONS
do
if [ `echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 1` = 'rootpath' ]; then
NFSPATH=`echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 2`;
if [ `echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 1` = 'rootpath' ]
then
NFSPATH=`echo $OPTION | sed -e "s/=/ /g" | cut -d " " -f 2`
fi
done
@ -170,11 +173,14 @@ findnfsmount() {
fi
fi
if [ "${NFSROOT}" != '' ]; then
if [ "${CDROOT}" != '0' ]; then
if [ "${NFSROOT}" != '' ]
then
if [ "${CDROOT}" != '0' ]
then
good_msg "Attempting to mount NFS CD image on ${NFSROOT}"
mount -t nfs -o ro,nolock,rsize=1024,wsize=1024 ${NFSROOT} ${NEW_ROOT}/mnt/cdrom
if [ "$?" = '0' ]; then
if [ "$?" = '0' ]
then
REAL_ROOT="/dev/nfs"
else
bad_msg "NFS Mounting failed. Is the path corrent ?"
@ -182,7 +188,8 @@ findnfsmount() {
else
good_msg "Attemping to mount NFS root on ${NFSROOT}"
mount -t nfs -o ro,nolock,rsize=1024,wsize=1024 ${NFSROOT} ${NEW_ROOT}
if [ "$?" = '0' ]; then
if [ "$?" = '0' ]
then
REAL_ROOT="/dev/nfs"
else
bad_msg "NFS Mounting failed. Is the path correct ?"
@ -325,7 +332,8 @@ cmdline_hwopts() {
done
done
# Shouldnt need to sort this the following loop should figure out the duplicates and strip them out
# Shouldnt need to sort this as the following loop should figure out the
# duplicates and strip them out
#MY_HWOPTS=`echo ${MY_HWOPTS}| sort`
for x in ${MY_HWOPTS}
@ -370,8 +378,9 @@ detect_sbp2_devices() {
# /proc
# /proc/scsi/sbp2/0, /proc/scsi/sbp2/1, etc.
#
# You may manually add/remove SBP-2 devices via the procfs with add-single-device <h> <b> <t> <l> or remove-single-device <h> <b> <t> <l>, where:
#
# You may manually add/remove SBP-2 devices via the procfs with:
# add-single-device <h> <b> <t> <l> or remove-single-device <h> <b> <t> <l>,
# where:
#
# <h> = host (starting at zero for first SCSI adapter)
# <b> = bus (normally zero)
@ -390,7 +399,7 @@ detect_sbp2_devices() {
setup_keymap() {
if [ "${DO_keymap}" ]
then
if [ ! -e /dev/vc/0 ]
if [ ! -e /dev/vc/0 -a ! -e /dev/tty0 ]
then
DEVBIND=1
mount -o bind ${NEW_ROOT}/dev /dev
@ -407,6 +416,7 @@ setup_keymap() {
fi
fi
}
chooseKeymap() {
good_msg "Loading keymaps"
cat /lib/keymaps/keymapList
@ -417,7 +427,8 @@ chooseKeymap() {
loadkmap < /lib/keymaps/${keymap}.map
xkeymap=${keymap}
echo ${keymap} | egrep -e "[0-9]+" >/dev/null 2>&1
if [ "$?" -eq '0' ]; then
if [ "$?" -eq '0' ]
then
xkeymap=`tail -n 7 /lib/keymaps/keymapList | grep ${keymap} | sed -r "s/.*\s+${keymap}\s+([a-z-]+).*/\1/g" | egrep -v 1`
fi
mkdir -p /etc/sysconfig
@ -471,11 +482,9 @@ startVolumes() {
bad_msg "LVM2 and EVMS do not work well together"
USE_EVMS2_NORMAL=0
fi
else
bad_msg "vgscan or vgchange not found: skipping LVM2 volume group activation!"
fi
fi
if [ "${USE_EVMS2_NORMAL}" -eq '1' ]
@ -489,8 +498,10 @@ startVolumes() {
}
sdelay() {
# Sleep a specific number of seconds if SDELAY is set otherwise only 1 second
if [ -n "${SDELAY}" ]; then
# Sleep a specific number of seconds if SDELAY is set otherwise only sleep
# 1 second
if [ -n "${SDELAY}" ]
then
sleep ${SDELAY}
else
sleep 1
@ -518,7 +529,7 @@ cdupdate() {
if [ "$?" != '0' ]
then
splash 'verbose'
bad_msg "FAILED TO EXECUTE cdupdate.sh "
bad_msg "Executing cdupdate.sh failed! "
run_shell
fi
else
@ -547,7 +558,8 @@ setup_md_device() {
}
rundebugshell() {
if [ -n "$DEBUG" ]; then
if [ -n "$DEBUG" ]
then
good_msg 'Starting debug shell as requested by "debug" option.'
good_msg 'Type "exit" to continue with normal bootup.'
[ -x /bin/sh ] && /bin/sh || /bin/ash
@ -567,7 +579,6 @@ setup_unionfs(){
CHANGES=$MEMORY/unionfs_changes/$UID
fi
mkdir -p ${MEMORY}
mkdir -p ${UNION}
good_msg "Loading unionfs module"
@ -577,8 +588,8 @@ setup_unionfs(){
CHANGESDEV=${UNIONFS}
good_msg "mounting $CHANGESDEV to $MEMORY for unionfs support"
mount -t auto $CHANGESDEV $MEMORY
# mount tmpfs only in the case when changes= boot parameter was empty
# or we were not able to mount the storage device
# mount tmpfs only in the case when changes= boot parameter was
# empty or we were not able to mount the storage device
ret=$?
if [ "${ret}" -ne 0 ]
then