summaryrefslogtreecommitdiffstats
path: root/initrd/initrd-stuff/etc
diff options
context:
space:
mode:
Diffstat (limited to 'initrd/initrd-stuff/etc')
-rw-r--r--initrd/initrd-stuff/etc/functions51
-rw-r--r--initrd/initrd-stuff/etc/messages72
2 files changed, 89 insertions, 34 deletions
diff --git a/initrd/initrd-stuff/etc/functions b/initrd/initrd-stuff/etc/functions
index f59ef9c7..19644cf5 100644
--- a/initrd/initrd-stuff/etc/functions
+++ b/initrd/initrd-stuff/etc/functions
@@ -41,7 +41,7 @@ trigger_device_events () {
#######################################################################
# produce error message and if $2 is empty run (debug) shell
error () {
-local message="An error occured during execution of $0 script:\n\n$1\n"
+local e_msg=$1
# check if LOGFILE is really writeable
if [ -n "${LOGFILE}" ] ; then
[ "${LOGFILE}" != "/dev/null" ] && \
@@ -50,14 +50,12 @@ else LOGFILE="/dev/null"
fi
# if nonfatal error else fatal error message and shell
if [ -n "$2" ] ; then
- [ "$DEBUGLEVEL" -ge 1 ] && \
- echo -e "$message This error is not fatal - continuing ...\n" \
+ [ "$DEBUGLEVEL" -ge 1 ] && echo -e "$error_msg $e_msg $error_nfe" \
>> ${LOGFILE}
- [ "$DEBUGLEVEL" -gt 1 ] && \
- echo -e "$message This error is not fatal - continuing ...\n"
+ [ "$DEBUGLEVEL" -gt 1 ] && echo -e "$error_msg $e_msg $error_nfe"
[ "$DEBUGLEVEL" -gt 2 ] && usleep 20
else
- echo -e "$message Running shell for debugging purposes now ...\n"
+ echo -e "$error_msg $e_msg $error_shell"
/bin/sh
fi
}
@@ -82,7 +80,7 @@ local msg=$2
if [ -f $modpath ] ; then
module=${module%.*}
modprobe ${MODPRV} ${module#*.} || \
- echo "Failed to load module '$module'. $msg"
+ echo "$error_modload '$module'. $msg"
fi
}
#######################################################################
@@ -136,9 +134,7 @@ case $ipcfg in
fi
;;
none)
- error " 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 $error_iptool
;;
esac
}
@@ -147,30 +143,22 @@ esac
nfsmnt ()
{
local nfsroot=$1
-errmsg=" 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"
for mnt in nfsmount mount none; do
test -x /bin/$mnt && break;
done
[ -f /lib/modules/@@@KERNVER@@@/kernel/fs/nfs/nfs.ko ] && \
- loadmod /lib/modules/@@@KERNVER@@@/kernel/fs/nfs/nfs.ko \
- "needed for mounting rootfs"
+ loadmod /lib/modules/@@@KERNVER@@@/kernel/fs/nfs/nfs.ko $error_modnfs
case $mnt in
nfsmount)
- nfsmount -o ro $nfsroot /mnt || error $errmsg
+ nfsmount -o ro $nfsroot /mnt || error $error_nfs
;;
mount)
- portmap || error " Portmapper should be present, if normal mount \
-command is used. Please\n check your initial ramdisk setup (mkdxsinitrd)."
+ portmap || error $error_portm
mount -n -t nfs -o ro $nfsroot /mnt || error $errmsg
killall -9 portmap
;;
none)
- error " No suitable mount tool found."
+ error $error_mntt
;;
esac
}
@@ -207,10 +195,6 @@ fi
# dhcp client
rundhcp ()
{
-local commonerr=" The following problems could produce that error:\n\
- * The af_packet.ko module is either not loaded nor present in kernel.\n\
- * No network device is present - either no module matching the hardware\n\
- was loaded nor present in kernel.\n You might want to run 'lsmod'."
local vci=$1
for dhcp in dhclient dhcpcd pump ipconfig none; do
test -x /bin/$dhcp && break;
@@ -233,20 +217,19 @@ case $dhcp in
dhclient)
mkdhclconf $vci
ln -s /bin/dhcpmkconfig /bin/dhclient-script
- dhclient -q -cf /etc/dhclient.conf -lf /var/lib/dhcp/dhclient.leases eth0 2>&1 >/dev/null || \
- error " Fatal error occured while trying to run dhclient.\n$commonerr"
+ dhclient -q -cf /etc/dhclient.conf -lf /var/lib/dhcp/dhclient.leases eth0 \
+ 2>&1 >/dev/null || error $error_dhclient
;;
dhcpcd)
ln -s /bin/dhcpmkconfig /bin/dhcpcd.exe
- dhcpcd -L /var/lib/dhcp -c /bin/dhcpcd.exe -T -t 30 eth0 2>&1 >/dev/null || \
- error " Fatal error occured while trying to run dhcpcd.\n$commonerr"
+ dhcpcd -L /var/lib/dhcp -c /bin/dhcpcd.exe -T -t 30 eth0 2>&1 >/dev/null \
+ || error $error_dhcpcd
;;
pump)
- error " Config via pump not implemented yet.\n$commonerr"
+ error $error_pump
;;
ipconfig)
- error " Config via ipconfig (from klibc) not implemented yet.\n\
-$commonerr"
+ error $error_ipconf
;;
*)
;;
@@ -372,7 +355,7 @@ echo "finished" > /tmp/ldcfg
# configuration via ldap
ldapconf () {
local ldapserver=$1
-error " The configuration via ldap is not implemented yet."
+error $error_ldapcfg
echo "not implemented" > /tmp/ldap-done
}
diff --git a/initrd/initrd-stuff/etc/messages b/initrd/initrd-stuff/etc/messages
new file mode 100644
index 00000000..1f5014b4
--- /dev/null
+++ b/initrd/initrd-stuff/etc/messages
@@ -0,0 +1,72 @@
+# Description: messages file for all error and info messages generated during
+# bootup (within initialramfs) for linux diskless clients
+# version 4
+#
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 01-04-2006
+#
+# Copyright: (c) 2006 - RZ Universitaet Freiburg
+#
+# Version: 0.0.3a
+
+# messages from init
+init_errmsg="functions file contains a lot of script \
+functionality. Without this\ninit script will not run."
+init_mff="The main $init_errmsg"
+init_dff="The distro $init_errmsg"
+init_dscf="The distribution specific configuration file could not be found"
+init_errnbd=" Failed to load \
+module ${NBD}.ko. It is needed if you intend to use\n network block \
+device (D)NBD for the client as root filesystem."
+init_errip=" Unable to setup at \
+least basic functionality, because no IP configuration\n available. You \
+might pass that information via kernel command line\n through setting of \
+'ipappend 1' in pxelinux.cfg/* or just enable dhcp\n or ldap. They are \
+enabled via tokens ('ldap' or 'dhcp') in kernel\n command line."
+init_errldap=" Unable to setup at \
+least basic functionality, because no IP configuration\n available. Please \
+beware - ldap works only in combination of either\n ipappend or similar or \
+with dhcp!"
+
+# messages from functions
+error_msg="An error occured during execution of $0 script:\n\n"
+error_nfe="This error is not fatal - continuing ...\n"
+error_shell="Running shell for debugging purposes now ...\n"
+error_modload="Failed to load module "
+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_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"
+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."
+error_dhcp=" The following problems could produce that error:\n\
+ * The af_packet.ko module is either not loaded nor present in kernel.\n\
+ * No network device is present - either no module matching the hardware\n\
+ was loaded nor present in kernel.\n You might want to run 'lsmod'."
+error_dhclient=" Fatal error occured while trying to run dhclient.\n\
+$error_dhcp"
+error_dhcpcd=" Fatal error occured while trying to run dhcpcd.\n$error_dhcp"
+error_pump=" Config via pump not implemented yet.\n$error_dhcp"
+error_ipconf=" Config via ipconfig (from klibc) not implemented yet.\n\
+$error_dhcp"
+error_ldapcfg=" The configuration via ldap is not implemented yet."
+
+# messages from distro functions
+df_errserv="seems not to be installed or start script is not available\n \
+so requesting the start of service make no sense. Please disable service\n \
+or install the files needed."
+df_errudev=" udev daemon is not available. Some devices might not apprear."
+df_errcron=" The cron start script $df_errserv"
+df_errsysl=" The syslog start script $df_errserv"
+df_errsshd=" The sshd start script $df_errserv"
+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."
+