You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
132 lines
3.2 KiB
132 lines
3.2 KiB
#!/bin/ash
|
|
|
|
. /etc/initrd.defaults
|
|
backup() {
|
|
echo -ne "\033[0G\033[0K"
|
|
}
|
|
|
|
parse_opt() {
|
|
case "$1" in
|
|
*\=*)
|
|
echo "$1" | cut -f2 -d=
|
|
;;
|
|
esac
|
|
}
|
|
|
|
modules_scan() {
|
|
local MODS
|
|
[ -d /etc/modules/${1} ] || touch /etc/modules/${1}
|
|
|
|
MODS=`cat /etc/modules/${1}`
|
|
for x in ${MODS}
|
|
do
|
|
MLOAD=`echo ${MLIST} | sed -e "s/.*${x}.*/${x}/"`
|
|
if [ "${MLIST}" = "${x}" ] # Only module to no-load
|
|
then
|
|
echo -e "${BOLD} ::${NORMAL} Skipping ${x}..."
|
|
elif [ "${MLOAD}" = "${MLIST}" ] # == No change == No specified no-load
|
|
then
|
|
echo -ne "${BOLD} ::${NORMAL} Scanning for ${x}..."
|
|
modprobe ${x} -n
|
|
backup
|
|
echo -ne "${NORMAL}"
|
|
else
|
|
echo -e "${BOLD} ::${NORMAL} Skipping ${x}..."
|
|
fi
|
|
done
|
|
}
|
|
|
|
findcdmount() {
|
|
if [ "$#" -gt "0" ]
|
|
then
|
|
for x in $*
|
|
do
|
|
echo -e "${GOOD}>>${NORMAL} Attempting to mount CD:- ${x}"
|
|
mount -r ${x} /newroot/mnt/cdrom > /dev/null 2>&1
|
|
|
|
if [ "$?" = '0' ]
|
|
then
|
|
# Check for a LiveCD
|
|
if [ -e /newroot/mnt/cdrom/livecd ]
|
|
then
|
|
REAL_ROOT="${x}"
|
|
break
|
|
else
|
|
umount /newroot/mnt/cdrom
|
|
fi
|
|
fi
|
|
done
|
|
if [ "${REAL_ROOT}" != "" ]
|
|
then
|
|
echo -e "${GOOD}>>${NORMAL} CD medium found on ${x}"
|
|
fi
|
|
fi
|
|
}
|
|
|
|
findnfsmount() {
|
|
if [ "${IP}" != '' ]; then
|
|
if [ "${NFSROOT}" = '' ]; then
|
|
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`;
|
|
fi
|
|
done
|
|
|
|
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`;
|
|
fi
|
|
done
|
|
if [ "${NFSIP}" != "" ] && [ "$NFSPATH" != "" ]
|
|
then
|
|
NFSROOT="${NFSIP}:${NFSPATH}"
|
|
else
|
|
echo -e "${BAD}>>${NORMAL} The DHCP Server did not send a valid root-path."
|
|
echo -e "${BAD}>>${NORMAL} Please check your DHCP setup, or provide a nfsroot=<...> parameter."
|
|
fi
|
|
fi
|
|
if [ "${NFSROOT}" != "" ]; then
|
|
if [ "${CDROOT}" != '' ]; then
|
|
echo -e "${GOOD}>>${NORMAL} Attempting to mount NFS CD image on ${NFSPATH}"
|
|
mount -t nfs -o ro,nolock,rsize=1024,wsize=1024 ${NFSROOT} /newroot/mnt/cdrom
|
|
if [ "$?" = '0' ]; then
|
|
REAL_ROOT="/dev/nfs"
|
|
else
|
|
echo -e "${BAD}>>${NORMAL} NFS Mounting failed. Is the path corrent ?"
|
|
fi
|
|
else
|
|
echo -e "${GOOD}>>${NORMAL} Attemping to mount NFS root on ${NFSPATH}"
|
|
mount -t nfs -o ro,nolock,rsize=1024,wsize=1024 ${NFSROOT} /newroot
|
|
if [ "$?" = '0' ]; then
|
|
REAL_ROOT="/dev/nfs"
|
|
else
|
|
echo -e "${BAD}>>${NORMAL} NFS Mounting failed. Is the path correct ?"
|
|
fi
|
|
# FIXME: Need to start portmap and the other rpc daemons in order to
|
|
# FIXME: remount rw.
|
|
fi
|
|
|
|
fi
|
|
fi
|
|
}
|
|
|
|
kill_devfsd() {
|
|
killall devfsd > /dev/null 2>&1
|
|
}
|
|
|
|
runUdev() {
|
|
mount -t tmpfs -o size=100k udev /dev
|
|
mkdir /dev/pts
|
|
mkdir /dev/shm
|
|
/sbin/udevstart
|
|
ln -snf /proc/self/fd /dev/fd
|
|
ln -snf /proc/self/fd/0 /dev/stdin
|
|
ln -snf /proc/self/fd/1 /dev/stdout
|
|
ln -snf /proc/self/fd/2 /dev/stderr
|
|
ln -snf /proc/kcore /dev/core
|
|
}
|