From 2ad560f708aef40729ec58cdc0d751f43594a98e Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Tue, 11 Apr 2006 22:19:48 +0000 Subject: simplifications for union mounts in init (but problems still exist), message output for nfs mounts changed ... git-svn-id: http://svn.openslx.org/svn/openslx/ld4@181 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initrd/initrd-stuff/bin/servconfig | 10 ++++++---- initrd/initrd-stuff/etc/functions | 27 ++++++++++++++------------- initrd/initrd-stuff/etc/messages | 17 ++++++++++------- initrd/initrd-stuff/init | 12 +++++------- 4 files changed, 35 insertions(+), 31 deletions(-) (limited to 'initrd') diff --git a/initrd/initrd-stuff/bin/servconfig b/initrd/initrd-stuff/bin/servconfig index 13cdc25a..13a8b4b4 100755 --- a/initrd/initrd-stuff/bin/servconfig +++ b/initrd/initrd-stuff/bin/servconfig @@ -4,15 +4,17 @@ # for linux diskless clients (executed within initial # ramdisk) # -# Author(s): Dirk von Suchodoletz , 09-04-2006 +# Author(s): Dirk von Suchodoletz , 11-04-2006 # # Copyright: (c) 2006 - RZ Universitaet Freiburg # -# Version: 0.0.2e +# Version: 0.1.0a # check for configuration files to source -# functions common for all distros +# functions common for all distros, messages contains all error and info +# output +. /etc/messages . /etc/functions # load distro specific configuration variables and functions. distro # specific functions may overwrite functions defined in /etc/functions @@ -229,7 +231,7 @@ if [ "x$vmware" != "x" ] && [ "x$vmware" != "xno" ] ; then ln -sf /usr/share/vmware /var/lib/vmware elif [ -n "${imgsrv}" ] ; then # nfsmnt script should be used here ... - nfsmnt ${imgsrv} /mnt/var/lib/vmware & + ( nfsmnt ${imgsrv} /mnt/var/lib/vmware || error "$scfg_nfs" nonfatal ) & #mount -n -t nfs -o ro,nolock,intr,nodev,soft,timeo=2,nosuid \ # ${imgsrv} fi diff --git a/initrd/initrd-stuff/etc/functions b/initrd/initrd-stuff/etc/functions index 2f2e3c0c..b7e7ecce 100644 --- a/initrd/initrd-stuff/etc/functions +++ b/initrd/initrd-stuff/etc/functions @@ -7,7 +7,7 @@ # # Copyright: (c) 2006 - RZ Universitaet Freiburg # -# Version: 0.4.2c +# Version: 0.4.2d ####################################################################### # generate events with the sysfs trigger @@ -56,9 +56,13 @@ if [ -n "$2" ] ; then else echo -e "${error_msg}${e_msg}${error_shell}" /bin/sh - echo "Rebooting now ..." - usleep 5 - echo "b" > /proc/sysrq_trigger + echo -n "Reboot now? [y]" + read input +# [ -z "$input" -o "$input" = "y" -o "$input" = "Y" ] && { +# usleep 100 +# [ -f /proc/sysrq-trigger ] || mount -t proc none /proc +# echo "b" > /proc/sysrq-trigger +# } fi } msg () { @@ -152,12 +156,8 @@ nfsmnt () { local nfsroot=$1 local dest=$2 -if [ -z "$dest" ] ; then - dest="/mnt" - e_nfs="$error_rnfs" -else - e_nfs="$error_gnfs" -fi +local ret=0 +[ -z "$dest" ] && dest="/mnt" for mnt in nfsmount mount none; do test -x /bin/$mnt && break; done @@ -165,17 +165,18 @@ done loadmod /lib/modules/@@@KERNVER@@@/kernel/fs/nfs/nfs.ko "$error_modnfs" case $mnt in nfsmount) - nfsmount -o ro $nfsroot $dest || error "$e_nfs" + nfsmount -o ro $nfsroot $dest || ret=1 ;; mount) - portmap || error "$error_portm" - mount -n -t nfs -o ro,nolock $nfsroot $dest || error "$e_nfs" + portmap || { echo "$error_portm"; ret=1; } + mount -n -t nfs -o ro,nolock $nfsroot $dest || ret=1 killall -9 portmap ;; none) error "$error_mntt" ;; esac +return $ret } ####################################################################### # create configuration file for dhclient diff --git a/initrd/initrd-stuff/etc/messages b/initrd/initrd-stuff/etc/messages index 59d416a9..d504d806 100644 --- a/initrd/initrd-stuff/etc/messages +++ b/initrd/initrd-stuff/etc/messages @@ -53,6 +53,12 @@ running\n kernel. If you do not want to see this message remove the token \ init_cownonbd=" Loading of cow module is of no sense if no network block \ device is used or\n UnionFS was specified as read write layer too. Remove \ UnionFS token from\n kernel commandline if cowloop should be used instead." +init_nfs=" Mount of root filesystem via NFS was requested via kernel command \ +line\nbut failed. There might be the following reasons for that:\n\ +* No nfs.ko module could be loaded and no NFS support was present in the\n\ +running kernel - see error messages above\n\ +* You tried to mount from wrong server or path ($nfsroot)\n\ +* No NFS server is running or you do not have permissions" init_ldcfg="Starting ldconfig - switch it off via kernel cmdline option \ 'noldsc'" init_errlog="Unable to create the logfile configuration in \ @@ -89,13 +95,6 @@ error_modnfs="needed for mounting rootfs" error_iptool=" No tool for local IP configuration found. You should at \ least add\n one of the following programs to your ramdisk: ip \ ipconfig\n ifconfig." -error_rnfs=" Mount of root filesystem via NFS was requested via kernel command \ -line\nbut failed. There might be the following reasons for that:\n\ -* No nfs.ko module could be loaded and no NFS support was present in the\n\ -running kernel - see error messages above\n\ -* You tried to mount from wrong server or path ($nfsroot)\n\ -* No NFS server is running or you do not have permissions" -error_gnfs=" Mount of some NFS source failed ..." error_portm=" Portmapper should be present, if normal mount \ command is used. Please\n check your initial ramdisk setup (mkdxsinitrd)." error_mntt=" No suitable mount tool found." @@ -130,3 +129,7 @@ df_erramnt=" Automounter $df_errserv" df_erratpld=" Only toplevel directories \ are allowed as mount points for user home\n directories. Please set the \ variable \${automnt_dir} appropriately in\n machine-setup file." + +# messages from servconfig +scfg_nfs=" Mount of some NFS source failed ..." + diff --git a/initrd/initrd-stuff/init b/initrd/initrd-stuff/init index 90347ffb..27d96eb0 100755 --- a/initrd/initrd-stuff/init +++ b/initrd/initrd-stuff/init @@ -2,11 +2,11 @@ # Description: main script for new type of initial ramdisk for # linux diskless clients version 4 # -# Author(s): Dirk von Suchodoletz , 07-04-2006 +# Author(s): Dirk von Suchodoletz , 11-04-2006 # # Copyright: (c) 2006 - RZ Universitaet Freiburg # -# Version: 0.2.4d +# Version: 0.2.4e # functions common for all distros, messages contains all error and info # output @@ -299,7 +299,7 @@ if [ -z "${DNBDOPT}" -a -z "${NBDOPT}" -a -z "${NFSROOT}" ] ; then fi # call function for nfs mounts if [ -z "${DNBDOPT}" -a -z "${NBDOPT}" ] ; then - nfsmnt ${NFSROOT} + nfsmnt ${NFSROOT} || error "$init_nfs" fi # get the complete collection of kernel modules available @@ -322,8 +322,7 @@ if [ -n "${UNIONFS}" ] ; then [ -n ${NFSROOT} ] && NFSRO=nfs mkdir -p ${RWDIR}/union ${RWDIR}/uniontmp mount -n -t tmpfs none ${RWDIR}/uniontmp - mount -n --move /mnt /root - mount -n -t unionfs -o dirs=${RWDIR}/uniontmp=rw:/root=${NFSRO}ro \ + mount -n -t unionfs -o dirs=${RWDIR}/uniontmp=rw:/mnt=${NFSRO}ro \ none /mnt mkdir -p /mnt/uniontmp mount -n --move ${RWDIR}/uniontmp /mnt/uniontmp @@ -454,11 +453,10 @@ umount -n /proc/bus/usb >/dev/null 2>&1 mount -n --move /dev /mnt/dev killall -9 udevd 2>/dev/null umount -n /proc -[ -n "${UNIONFS}" ] && mount -n --move /root /mnt/mnt # unset old environment variables unset debug date initrd ip dnbdroot nbdroot nfsroot vci vga unset BOOT_IMAGE KCMDLINE KERNEL MODPRV NWMODULES OLDPWD UDEVD_EVENT_TIMEOUT \ UDEVD_EXPECTED_SEQNUM #strinstr "bash" "$(ls -la /bin/sh)" && EE="-c" # new style of pivoting (exec -c would set an empty environment in bash) -exec ${EE} run-init -c dev/console /mnt /sbin/init || error "$init_runinit" +exec run-init -c dev/console /mnt /sbin/init || error "$init_runinit" -- cgit v1.2.3-55-g7522