summaryrefslogtreecommitdiffstats
path: root/initrd
diff options
context:
space:
mode:
authorDirk von Suchodoletz2006-04-02 15:34:34 +0200
committerDirk von Suchodoletz2006-04-02 15:34:34 +0200
commit168b7d2b667cdd04c8de5f6df51837cc409091f5 (patch)
tree30105f9c44b53b109304cf1c6300b10e90401edf /initrd
parentBetter information about the Monitors capabilities (inclusion of 1400x1050 Mo... (diff)
downloadcore-168b7d2b667cdd04c8de5f6df51837cc409091f5.tar.gz
core-168b7d2b667cdd04c8de5f6df51837cc409091f5.tar.xz
core-168b7d2b667cdd04c8de5f6df51837cc409091f5.zip
put error/info messages to a separat file (base for later localization
...) git-svn-id: http://svn.openslx.org/svn/openslx/ld4@140 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initrd')
-rw-r--r--initrd/distro-specs/gentoo/functions-2005.118
-rw-r--r--initrd/distro-specs/suse/functions-9.318
-rw-r--r--initrd/initrd-stuff/etc/functions51
-rw-r--r--initrd/initrd-stuff/etc/messages72
-rwxr-xr-xinitrd/initrd-stuff/init35
5 files changed, 115 insertions, 79 deletions
diff --git a/initrd/distro-specs/gentoo/functions-2005.1 b/initrd/distro-specs/gentoo/functions-2005.1
index c28eccae..9408122e 100644
--- a/initrd/distro-specs/gentoo/functions-2005.1
+++ b/initrd/distro-specs/gentoo/functions-2005.1
@@ -2,11 +2,11 @@
# linux diskless clients (executed within initial
# ramdisk after genconfig)
#
-# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 31-03-2006
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 02-04-2006
#
# Copyright: (c) 2006 - RZ Universitaet Freiburg
#
-# Version: 0.0.1d
+# Version: 0.0.2a
# distro specific stuff to initialize
preinit () {
@@ -37,8 +37,7 @@ if [ -x /bin/udevd ] ; then
export UDEVD_EVENT_TIMEOUT=1
echo "" > /proc/sys/kernel/hotplug
udevd &
-else error " udev daemon is not available. Some devices might not \
-apprear." nonfatal
+else error $df_errudev nonfatal
fi
}
@@ -116,8 +115,7 @@ if [ "x$start_cron" = "xyes" ] ; then
if [ -f /mnt/etc/init.d/cron ] ; then
:
else
- error " The cron start script seems not to be installed, so requesting \
-\n the start of cron services make no sense." nonfatal
+ error $df_errcron nonfatal
fi
fi
}
@@ -128,8 +126,7 @@ if [ "x$start_syslog" = "xyes" ] ; then
if [ -f /mnt/etc/init.d/syslog-ng ] ; then
rllinker syslog-ng
else
- error " The syslog start script does not seem to be installed, so \
-requesting\n the start of service does not make much sense." nonfatal
+ error $df_errsysl nonfatal
fi
fi
}
@@ -140,8 +137,7 @@ if [ "x$start_sshd" = "xyes" ] ; then
if [ -f /mnt/etc/init.d/sshd ] ; then
rllinker "sshd"
else
- error " The sshd start script does not seem to be installed, so \
-requesting\n the start of service does not make much sense." nonfatal
+ error $df_errsshd nonfatal
fi
fi
}
@@ -244,7 +240,7 @@ variable \${automnt_dir} appropriately in\n machine-setup file." nonfatal
config_portmap
fi
else
- error " Automounter seems not to be installed" nonfatal
+ error $df_erramnt nonfatal
fi
}
diff --git a/initrd/distro-specs/suse/functions-9.3 b/initrd/distro-specs/suse/functions-9.3
index f08517b6..1b58c332 100644
--- a/initrd/distro-specs/suse/functions-9.3
+++ b/initrd/distro-specs/suse/functions-9.3
@@ -4,11 +4,11 @@
# functions file). This file is the main base for the
# following SuSE distributions
#
-# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 30-03-2006
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 02-04-2006
#
# Copyright: (c) 2006 - RZ Universitaet Freiburg
#
-# Version: 0.2.1e
+# Version: 0.2.2a
# distro specific stuff to initialize
preinit () {
@@ -107,8 +107,7 @@ if [ "x$start_cron" = "xyes" ] ; then
\nMAILTO=\n-*/15 * * * *\troot\ttest -x /usr/lib/cron/run-crons && \
/usr/lib/cron/run-crons >/dev/null 2>&1\n" >/mnt/etc/crontab
else
- error " The cron start script seems not to be installed, so requesting \
-\n the start of cron services make no sense." nonfatal
+ error $df_errcron nonfatal
fi
fi
}
@@ -126,8 +125,7 @@ if [ "x$start_syslog" = "xyes" ] ; then
cp /etc/syslog-ng.conf /mnt/etc/syslog-ng/syslog-ng.conf
rllinker syslog "02" "20"
else
- error " The syslog start script does not seem to be installed, so \
-requesting\n the start of service does not make much sense." nonfatal
+ error $df_errsysl nonfatal
fi
fi
}
@@ -140,8 +138,7 @@ if [ "x$start_sshd" = "xyes" ] ; then
testmkd /mnt/var/lib/empty
rllinker "sshd" "12" "10"
else
- error " The sshd start script does not seem to be installed, so \
-requesting\n the start of service does not make much sense." nonfatal
+ error $df_errsshd nonfatal
fi
fi
}
@@ -303,7 +300,6 @@ fi
# configure gdm as display manager
config_kdm () {
config_dm_entry yes
-
}
# configure bluetooth services
@@ -384,9 +380,7 @@ if [ -f /mnt/etc/sysconfig/autofs ] ; then
if [ -n "${automnt_src}" ] ; then
# local directory and home directory server from machine-setup
[ -z "${automnt_dir}" ] && automnt_dir="/home"
- strinstr "/" "${automnt_dir}" && error " 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." nonfatal
+ strinstr "/" "${automnt_dir}" && error $df_erratpld nonfatal
automnt_dir=${automnt_dir#/}
echo -e "/home\t/etc/auto.${automnt_dir}\n" >> /mnt/etc/auto.master
echo -e "# /etc/auto.${automnt_dir} created by $0:\n" \
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."
+
diff --git a/initrd/initrd-stuff/init b/initrd/initrd-stuff/init
index 53ca1f95..32a6f763 100755
--- a/initrd/initrd-stuff/init
+++ b/initrd/initrd-stuff/init
@@ -2,20 +2,19 @@
# Description: main script for new type of initial ramdisk for
# linux diskless clients version 4
#
-# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 31-03-2006
+# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 02-04-2006
#
# Copyright: (c) 2006 - RZ Universitaet Freiburg
#
-# Version: 0.2.3f
+# Version: 0.2.4a
-# functions common for all distros
-errmsg="functions file contains a lot of script \
-functionality. Without this\ninit script will not run."
-. /etc/functions || ( echo -e "The main $errmsg" && exit 1 )
-. /etc/distro-functions || ( echo "The distro $errmsg" && exit 1 )
+# functions common for all distros, messages contains all error and info
+# output
+. /etc/messages
+. /etc/functions || ( echo -e $init_mff && exit 1 )
+. /etc/distro-functions || ( echo -e $init_dff && exit 1 )
# configuration settings (several file and directory variables)
-. /etc/sysconfig/config || ( echo -e " The distribution \
-specific configuration file could not be found" && exit 1 )
+. /etc/sysconfig/config || ( echo -e $init_dscf && exit 1 )
export PATH=/bin:/sbin:/usr/bin/:/usr/sbin
export date="@@@DATE@@@"
@@ -123,7 +122,8 @@ in $0\ncountry=\"${COUNTRY}\"" >> /etc/machine-setup
# nfs server and path
nfsroot=*)
NFSROOT=${opts#nfsroot=}
- echo -e "\n# nfs root information gotten via kernel command line in $0\nnfsroot=\"${NFSROOT}\"\n" >> /etc/machine-setup
+ echo -e "\n# nfs root information gotten via kernel command line in $0\n\
+nfsroot=\"${NFSROOT}\"\n" >> /etc/machine-setup
;;
# size of tempfs if not max. 50% of RAM should be used
tmpfssize=*)
@@ -135,9 +135,7 @@ in $0\ncountry=\"${COUNTRY}\"" >> /etc/machine-setup
done
# load block device driver if needed
if [ -n "${NBD}" ] ; then
- modprobe ${MODPRV} ${NBD} || error " 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."
+ modprobe ${MODPRV} ${NBD} || error $init_errnbd
fi
# check if at least one type of IP configuration is availabe
if [ -z "$DHCP" -a -z "$LDAP" -a -z "$IPINFO" ] ; then
@@ -146,19 +144,12 @@ if [ -z "$DHCP" -a -z "$LDAP" -a -z "$IPINFO" ] ; then
. /etc/machine-setup
IPINFO="ip=$clientip:$serverip:$gateway:$subnet_mask"
else
- error " 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."
+ error $init_errip
fi
fi
# for ldap configuration at least basic IP setup is needed to contact the
# server
-[ -z "$DHCP" -a -n "$LDAP" -a -z "$IPINFO" ] && error " 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!"
+[ -z "$DHCP" -a -n "$LDAP" -a -z "$IPINFO" ] && error $init_errldap
# set debug level and logfile
echo "Setting debuglevel to ${DEBUGLEVEL}"
export MODPRV=" "