From b2a4079c3d1da7632756a31c9c82ffe3f949eadb Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Sun, 9 Apr 2006 14:08:56 +0000 Subject: added bootlocal script (user def. script to run in normal boot), ensured ash shell compatibility of scripts ... git-svn-id: http://svn.openslx.org/svn/openslx/ld4@173 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initrd/distro-specs/gentoo/config-2005.1 | 7 ++++--- initrd/distro-specs/suse/config-10.1 | 4 +++- initrd/distro-specs/suse/config-9.3 | 5 ++++- initrd/distro-specs/ubuntu/config-5.10 | 5 ++++- initrd/initrd-stuff/bin/hwautocfg | 10 +++++----- initrd/initrd-stuff/bin/screenres | 9 +++------ initrd/initrd-stuff/bin/servconfig | 11 +++++++---- initrd/initrd-stuff/etc/functions | 5 +++-- initrd/initrd-stuff/init | 14 +++++++++----- initrd/mkdxsinitrd | 16 +++++++++++----- 10 files changed, 53 insertions(+), 33 deletions(-) (limited to 'initrd') diff --git a/initrd/distro-specs/gentoo/config-2005.1 b/initrd/distro-specs/gentoo/config-2005.1 index ff8ee109..2cf9331f 100644 --- a/initrd/distro-specs/gentoo/config-2005.1 +++ b/initrd/distro-specs/gentoo/config-2005.1 @@ -1,6 +1,6 @@ # Description: distro specific settings for Gentoo # -# Author(s): Dirk von Suchodoletz , 31-03-2006 +# Author(s): Dirk von Suchodoletz , 09-04-2006 # # Copyright: (c) 2005,6 - RZ Universitaet Freiburg @@ -18,7 +18,8 @@ # D_RCDIRS - runlevel directories relative to /etc # D_HWMODTOIGNORE - hardware modules which should not tried to load (because # already in kernel, nonexistent, ...) - +# D_BOOTLOCAL - script for user specified stuff which should be started +# during client bootup, path and file relative to /etc D_SYSCONFDIR=conf.d D_ETCEXCL="opt/gnome/gconf/*\n*.old\n*-\n\ @@ -43,4 +44,4 @@ D_INITSCRIPTS="bootmisc clock urandom boot.ld" D_XF86CONFFILE="/etc/X11/xorg.conf" D_XFONTPATH="/usr/share/fonts/*" D_DEFAULTCOUNTRY="de" - +D_BOOTLOCAL="conf.d/local.start" \ No newline at end of file diff --git a/initrd/distro-specs/suse/config-10.1 b/initrd/distro-specs/suse/config-10.1 index 712d95f5..8c8fd6ca 100644 --- a/initrd/distro-specs/suse/config-10.1 +++ b/initrd/distro-specs/suse/config-10.1 @@ -2,7 +2,7 @@ # is the base for following SuSE versions until the changes # within them require a major change # -# Author(s): Dirk von Suchodoletz , 08-03-2006 +# Author(s): Dirk von Suchodoletz , 09-04-2006 # # Copyright: (c) 2003, 2005 - RZ Universitaet Freiburg @@ -23,5 +23,7 @@ # /etc/X11/xorg.conf or /etc/X11/XF86config, ... # D_XFONTPATH - path(es) where X11 fonts are installed (with trailing /*) # D_DEFAULTCOUNTRY - localization (see common functions) +# D_BOOTLOCAL - script for user specified stuff which should be started +# during client bootup, path and file relative to /etc D_INITSCRIPTS="boot.udev boot.proc boot.klog boot.loadmodules boot.clock boot.sysctl boot.ipconfig boot.swap" diff --git a/initrd/distro-specs/suse/config-9.3 b/initrd/distro-specs/suse/config-9.3 index 3bf7bdfa..954c71b9 100644 --- a/initrd/distro-specs/suse/config-9.3 +++ b/initrd/distro-specs/suse/config-9.3 @@ -2,7 +2,7 @@ # is the base for following SuSE versions until the changes # within them require a major change # -# Author(s): Dirk von Suchodoletz , 24-03-2006 +# Author(s): Dirk von Suchodoletz , 09-04-2006 # # Copyright: (c) 2003, 2005 - RZ Universitaet Freiburg @@ -25,6 +25,8 @@ # D_DEFAULTCOUNTRY - localization (see common functions) # D_HWMODTOIGNORE - hardware modules which should not tried to load (because # already in kernel, nonexistent, ...) +# D_BOOTLOCAL - script for user specified stuff which should be started +# during client bootup, path and file relative to /etc D_SYSCONFDIR=/sysconfig D_ETCEXCL="opt/gnome/gconf/*\n*.old\n*-\n*.rpmorig\n*.rpmnew\n\ @@ -51,3 +53,4 @@ D_XF86CONFFILE="/etc/X11/xorg.conf" D_XFONTPATH="/usr/X11R6/lib/X11/fonts/*" D_DEFAULTCOUNTRY="de" D_HWMODTOIGNORE="i8xx_tco ichxrom" +D_BOOTLOCAL="init.d/boot.local" diff --git a/initrd/distro-specs/ubuntu/config-5.10 b/initrd/distro-specs/ubuntu/config-5.10 index a4110833..08bea552 100644 --- a/initrd/distro-specs/ubuntu/config-5.10 +++ b/initrd/distro-specs/ubuntu/config-5.10 @@ -1,6 +1,6 @@ # Description: distro specific settings for Debian/Sarge # -# Author(s): Dirk von Suchodoletz , 16-01-2006 +# Author(s): Dirk von Suchodoletz , 09-04-2006 # Blablub # # Copyright: (c) 2003, 2005 - RZ Universitaet Freiburg @@ -23,6 +23,8 @@ # D_DEFAULTCOUNTRY - localization (see common functions) # D_HWMODTOIGNORE - hardware modules which should not tried to load (because # already in kernel, nonexistent, ...) +# D_BOOTLOCAL - script for user specified stuff which should be started +# during client bootup, path and file relative to /etc D_SYSCONFDIR=/default D_ETCEXCL="etc/gconf/*\n*.old\n*-\n\ @@ -48,3 +50,4 @@ D_INITSCRIPTS="mountvirtfs udev procps.sh bootlogd boot.ld hwclock.sh sudo dbus" D_XF86CONFFILE="/etc/X11/xorg.conf" D_XFONTPATH="/usr/share/fonts/*" D_DEFAULTCOUNTRY="de" +D_BOOTLOCAL="" diff --git a/initrd/initrd-stuff/bin/hwautocfg b/initrd/initrd-stuff/bin/hwautocfg index 69094dc5..fd1ab828 100755 --- a/initrd/initrd-stuff/bin/hwautocfg +++ b/initrd/initrd-stuff/bin/hwautocfg @@ -134,25 +134,25 @@ if [ -n "$hw_monitor" ] ; then [ -z "$VS" ] && VS=${hw_monitor%hz*} VS=${VS##* } MR=${hw_monitor##* } - msg="Please check your predefined monitor settings ($hw_monitor): Manual\n\ + hwmsg="Please check your predefined monitor settings ($hw_monitor): Manual\n\ configurtion of display" else # gather monitor information automatically ddcprobe > /tmp/ddcprobe - msg="Please check the output of ddcprobe. The settings where not \ + hwmsg="Please check the output of ddcprobe. The settings where not \ complete\n or non existant. The $0 script tried for a fully automatic\n\ configuration of display" fi -if [ -z "$HS" ] ; then error " $msg timings requested but could not \ +if [ -z "$HS" ] ; then error " $hwmsg timings requested but could not \ establish\n horizontal frequency in kHz." nonfatal HS=${HSYNCRANGE} fi -if [ -z "$VS" ] ; then error " $msg timings but could not establish \ +if [ -z "$VS" ] ; then error " $hwmsg timings but could not establish \ vertical\n frequency in Hz." nonfatal VS=${VSYNCRANGE} fi -if [ -z "$MR" ] ; then error " $msg resolution requested but not \ +if [ -z "$MR" ] ; then error " $hwmsg resolution requested but not \ established." nonfatal MR=${MAXRES} fi diff --git a/initrd/initrd-stuff/bin/screenres b/initrd/initrd-stuff/bin/screenres index 0f5528f5..97aaa005 100755 --- a/initrd/initrd-stuff/bin/screenres +++ b/initrd/initrd-stuff/bin/screenres @@ -23,8 +23,7 @@ # enable debugging in higher debug levels [ $DEBUGLEVEL -gt 1 ] && DEBUG="yes" -function calculate_max_horizontal_freq() -{ +calculate_max_horizontal_freq () { highest_resolution=` echo $screen_resolutions | sed -n 's/"\([0-9x]*\)" .*/\1/p'` freq_for_highest_res=`sed -n /$highest_resolution'/s/[^@]*@\([0-9]\{2,3\}\).*/\1/p' $tmp_ddcprobe_output | sort -nr|sed -n 1p` if [ -z "$freq_for_highest_res" ]; then @@ -36,8 +35,7 @@ function calculate_max_horizontal_freq() horiz_freq_khz=$(( $highest_res_line_count * $freq_for_highest_res / 950)) # 950 = 0,95 * 1000 (invisible range * Kilohertz) [ -n "$DEBUG" ] && echo " Assumed Horizontal Frequency: $horiz_freq_khz" } -function determine_recommended_crt_modes() -{ +determine_recommended_crt_modes () { ## Introduce the standard resolution 1400x1050 as it is seldom in the list the monitors output, though supported [ -n "$DEBUG" ] && echo "Screen Modes: $screen_resolutions" if [ -z "`echo $screen_resolutions|sed -n /1400/p`" ]; then @@ -83,8 +81,7 @@ function determine_recommended_crt_modes() ########## } -function define_max_recommended_horizontal_pixel_count() -{ +define_max_recommended_horizontal_pixel_count () { ## To high resolutions are not wanted on small screens ##################################### # For 15 inch and below if [ $screen_size_in_qcm -lt 704 ]; then max_wanted_resolution=1024 diff --git a/initrd/initrd-stuff/bin/servconfig b/initrd/initrd-stuff/bin/servconfig index 7b8bb569..13cdc25a 100755 --- a/initrd/initrd-stuff/bin/servconfig +++ b/initrd/initrd-stuff/bin/servconfig @@ -4,9 +4,7 @@ # for linux diskless clients (executed within initial # ramdisk) # -# Author(s): Dirk von Suchodoletz , 03-04-2006 -# Blabla -# Blub +# Author(s): Dirk von Suchodoletz , 09-04-2006 # # Copyright: (c) 2006 - RZ Universitaet Freiburg # @@ -28,7 +26,12 @@ ####################################################################### # copy distro specific scripts, programs, libraries and configs -cp -a /etc/sysconfig/files/* /mnt 2>/dev/null +cp -a /etc/sysconfig/files/* /mnt 2>/dev/null & +# boot.local file (different for several distros) +[ -f "/etc/boot.local" -a -n "${D_BOOTLOCAL}" ] && { + echo "# added by $0 (initramfs from $date)" >> /mnt/etc/${D_BOOTLOCAL} + cat /etc/boot.local >> /mnt/etc/${D_BOOTLOCAL} +} # set greeting echo " diff --git a/initrd/initrd-stuff/etc/functions b/initrd/initrd-stuff/etc/functions index 53056344..2f10f180 100644 --- a/initrd/initrd-stuff/etc/functions +++ b/initrd/initrd-stuff/etc/functions @@ -2,7 +2,7 @@ # linux diskless clients (included by init, hwautocfg, # servconfig, ... within initial ramdisk) # -# Author(s): Dirk von Suchodoletz , 03-04-2006 +# Author(s): Dirk von Suchodoletz , 08-04-2006 # Felix Endres, 21-03-2006 # # Copyright: (c) 2006 - RZ Universitaet Freiburg @@ -40,7 +40,7 @@ trigger_device_events () { ####################################################################### # produce error message and if $2 is empty run (debug) shell error () { -local e_msg=$1 +local e_msg="$1" # check if LOGFILE is really writeable if [ -n "${LOGFILE}" ] ; then [ "${LOGFILE}" != "/dev/null" ] && \ @@ -262,6 +262,7 @@ fileget () { for tftp in /bin/atftp /bin/tftp ; do test -x $tftp && break done +echo -e "tftp\t69/tcp\ntftp\t69/udp" > /etc/services if [ -n "$FILESRC" ] ; then cfgfile=${FILESRC#*:} tftpserver=${FILESRC%:*} diff --git a/initrd/initrd-stuff/init b/initrd/initrd-stuff/init index 859bbbfb..73841e7f 100755 --- a/initrd/initrd-stuff/init +++ b/initrd/initrd-stuff/init @@ -377,8 +377,10 @@ d_mkrlscript init boot.ld "Running configuration postponed from InitRD" echo "fs complete" >/tmp/fscmpl # write debug file information after filesystem setup completed -echo -e "# /etc${D_SYSCONFDIR}/logfile - file created by $0\n#\n# logfile for linux diskless client specific debugging output\nLOGFILE=\"$LOGFILE\"\n#\n# debug level\nDEBUGLEVEL=\"$DEBUGLEVEL\"" > /mnt/etc/${D_SYSCONFDIR}/logfile || \ - error "$init_errlog" +echo -e "# /etc${D_SYSCONFDIR}/logfile - file created by $0\n#\n# logfile \ +for linux diskless client specific debugging output\nLOGFILE=\"$LOGFILE\"\n#\ +\n# debug level\nDEBUGLEVEL=\"$DEBUGLEVEL\"" \ + > /mnt/etc/${D_SYSCONFDIR}/logfile || error "$init_errlog" # run distribution independent and dependent configuration of files and # services @@ -445,7 +447,9 @@ 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 nfsroot vci -unset KERNEL NWMODULES +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 run-init -c dev/console /mnt /sbin/init || error "$init_runinit" +exec ${EE} run-init -c dev/console /mnt /sbin/init || error "$init_runinit" diff --git a/initrd/mkdxsinitrd b/initrd/mkdxsinitrd index 0f56dc8c..6286dfa5 100755 --- a/initrd/mkdxsinitrd +++ b/initrd/mkdxsinitrd @@ -304,7 +304,7 @@ mknod ${INSTDIR}/tmp/null c 1 3 &>/dev/null mknod ${INSTDIR}/tmp/kmsg c 1 11 &>/dev/null #if no klibc - klibc shell seems not to have enough functionality :-( -for bbins in bash ash sh; do +for bbins in ash ash sh; do if cobi ${bbins} bin ; then ln -fs ${bbins} ${INSTDIR}/bin/sh [ "${bbins}" != "bash" ] && ln -fs ${bbins} ${INSTDIR}/bin/bash @@ -342,6 +342,7 @@ for tftp in atftp tftp ; do binfinder $tftp && break done cobi $tftp bin +cp /lib/libnss_files.so.2 ${INSTDIR}/lib # debug binaries for bbins in \ @@ -483,13 +484,18 @@ chmod 755 ${INSTDIR}/init \ if [ -f /etc/dxs/client.cfg/machine-setup.default ] ; then cp /etc/dxs/client.cfg/machine-setup.default \ ${INSTDIR}/etc/machine-setup -elif [ -f ../installer/default_files/machine-setup_default ] ; then - cp ../installer/default_files/machine-setup_default \ +elif [ -f ../installer/default_files/machine-setup.default ] ; then + cp ../installer/default_files/machine-setup.default \ ${INSTDIR}/etc/machine-setup else - #inserted password for root for debugging purposes + #inserted password for root for debugging purposes echo -e "# default for machine-setup does not exist\n# root logins are \ -disabled\nroot_pw='"'$1$T7VD/mmQ$aCP1WEaWplEsHe9khv4kK.'"'" > ${INSTDIR}/etc/machine-setup +disabled\nroot_pw='"'$1$T7VD/mmQ$aCP1WEaWplEsHe9khv4kK.'"'" \ + > ${INSTDIR}/etc/machine-setup +fi +# custom init script for normal client start after initramfs +if [ -f /etc/dxs/client.cfg/boot.local.default ] ; then + cp /etc/dxs/client.cfg/boot.local.default ${INSTDIR}/etc/boot.local fi # finally copy vendor-supplied preinit and postinit files -- cgit v1.2.3-55-g7522