From ef5048eff5cfa172d501fb18ad5a4e2319a42916 Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Sun, 9 Apr 2006 23:03:16 +0000 Subject: code cleanups and small fixes ... git-svn-id: http://svn.openslx.org/svn/openslx/ld4@175 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initrd/distro-specs/suse/files-9.3/etc/init.d/boot | 4 +- initrd/distro-specs/suse/functions-9.3 | 2 + initrd/initrd-stuff/bin/hwautocfg | 28 +++++------ initrd/initrd-stuff/etc/functions | 56 +++++++++++----------- initrd/initrd-stuff/init | 12 +++-- 5 files changed, 54 insertions(+), 48 deletions(-) (limited to 'initrd') diff --git a/initrd/distro-specs/suse/files-9.3/etc/init.d/boot b/initrd/distro-specs/suse/files-9.3/etc/init.d/boot index f975046f..8012f287 100755 --- a/initrd/distro-specs/suse/files-9.3/etc/init.d/boot +++ b/initrd/distro-specs/suse/files-9.3/etc/init.d/boot @@ -4,7 +4,7 @@ # X Stations (v4.0) -> replaces /etc/init.d/boot # simply copied over the original file in initrd # -# Author(s): Dirk von Suchodoletz , 08-01-2006 +# Author(s): Dirk von Suchodoletz , 08-04-2006 # Copyright: (c) 2003, 2006 - RZ Universitaet Freiburg # # Version: 0.0.2b @@ -53,7 +53,7 @@ echo "Running $0" rc_reset echo -n "Mounting /proc, /sys and /dev/pts filesystems" # file /etc/fstab in some scenarios not available -mount -n -t proc proc /proc &>/dev/null +mount -t proc proc /proc &>/dev/null rc_status -v -r echo -n "Mounting /dev/pts" diff --git a/initrd/distro-specs/suse/functions-9.3 b/initrd/distro-specs/suse/functions-9.3 index f23c8443..800b4035 100644 --- a/initrd/distro-specs/suse/functions-9.3 +++ b/initrd/distro-specs/suse/functions-9.3 @@ -39,6 +39,8 @@ echo -e "DXS VERSION = 4.0a\nINITRAMFS GENERATION DATE = $date" \ # add the halt link to the 0 and 6 runlevel directories ln -sf ../halt /mnt/etc/${D_INITDIR}/rc0.d/S20halt ln -sf ../halt /mnt/etc/${D_INITDIR}/rc6.d/S20reboot +# if YaST2 should be runnable (without much effect anyway) on the client +testmkd /mnt/var/log/YaST2 } # udev/hotplug - auto device discovery service diff --git a/initrd/initrd-stuff/bin/hwautocfg b/initrd/initrd-stuff/bin/hwautocfg index fd1ab828..8fed0677 100755 --- a/initrd/initrd-stuff/bin/hwautocfg +++ b/initrd/initrd-stuff/bin/hwautocfg @@ -4,13 +4,12 @@ # script for linux diskless clients, using hwconfig from # knoppix as base tool # -# Author(s): Dirk von Suchodoletz , 24-03-2006 -# Blabla -# Blub +# Author(s): Dirk von Suchodoletz , 09-04-2006 +# Felix Endres # # Copyright: (c) 2003 - 2006 - RZ Universitaet Freiburg # -# Version: 0.3.1e +# Version: 0.3.2a # local functions used within hwautocfg displaysetup () { @@ -118,8 +117,9 @@ systems color depth failed.\n $msg" nonfatal fi #OPTIMIZEME: Optimiere den dreifachen aufruf von Screenres -VERTSR=`screenres | sed -n '/Vertical Frequency Range/s/[^0-9]* \([0-9-]*\)/\1/p'` -HORISR=`screenres | sed -n '/Horizontal Frequency Range/s/[^0-9]* \([0-9-]*\)/\1/p'` +screenres > /tmp/screenres +VERTSR=`cat /tmp/screenres | sed -n '/Vertical Frequency Range/s/[^0-9]* \([0-9-]*\)/\1/p'` +HORISR=`cat /tmp/screenres | sed -n '/Horizontal Frequency Range/s/[^0-9]* \([0-9-]*\)/\1/p'` if [ -n "$HORISR" ]; then HS=$HORISR fi @@ -158,12 +158,8 @@ established." nonfatal fi monmanual=yes -## compute max resolution -#for res in 640x400 640x480 800x600 1024x768 1280x1024 1400x1050 1600x1200 -# do MODES="\"$res\" \"lcd$res\" $MODES" -# [ "$res" = "$MR" ] && break -#done -MODES=`screenres | sed -n '/Recommended Screen Modes:/s/[^"]*\(.*\)/\1/p'` +# compute max resolution +MODES=`cat /tmp/screenres | sed -n '/Recommended Screen Modes:/s/[^"]*\(.*\)/\1/p'` # finally write config file echo -e "#\n# autogenerated X hardware configuration by $0\n# \ @@ -229,6 +225,10 @@ pci/agp bus needed for acceleration." ; } [ "${XKEYBOARD}" = "de" ] && \ echo -e '\tOption\t\t"XkbVariant"\t\t"nodeadkeys"' >>$xfc echo -e "EndSection\n\nSection \"$section\"" >>$xfc + # if special synaptics touchpad was detected and specific driver + # is present + # strinfile " synaptics " /tmp/hwsetup.info + # synaptics_drv.o echo -e $InputMouseDef >>$xfc ;; Modes) @@ -323,7 +323,7 @@ for DRIVER in cmd64x hpt366 piix slc90e66 cs5520 it821x rz1000 \ DRIVERLIST="${DRIVERLIST} ${DRIVER}"; } done # check for IDE/SCSI (SATA) - incomplete list -for DRIVER in ata_piix sata_via sata_nv; do +for DRIVER in ata_piix sata_via sata_nv sata_sil sata_sis; do strinfile " ${DRIVER}" /tmp/hwsetup.info && { #SCSIIDE="yes" modprobe ${MODPRV} ${DRIVER} & @@ -345,7 +345,7 @@ fi # remove unneeded network card modules for DRIVER in ${NWMODULES}; do strinfile " ${DRIVER}" /tmp/hwsetup.info || { - rmmod ${DRIVER} + rmmod ${DRIVER} & DRIVERLIST="${DRIVERLIST} ${DRIVER}"; } done # sound card setup (alsa and oss compatibility drivers) diff --git a/initrd/initrd-stuff/etc/functions b/initrd/initrd-stuff/etc/functions index 2f10f180..50c6211c 100644 --- a/initrd/initrd-stuff/etc/functions +++ b/initrd/initrd-stuff/etc/functions @@ -7,34 +7,34 @@ # # Copyright: (c) 2006 - RZ Universitaet Freiburg # -# Version: 0.4.2b +# Version: 0.4.2c ####################################################################### # generate events with the sysfs trigger trigger_device_events () { - list=$(echo /sys/bus/*/devices/*/uevent) - list="$list $(echo /sys/class/*/*/uevent)" - list="$list $(echo /sys/block/*/uevent /sys/block/*/*/uevent)" - for i in $list; do - case "$i" in - */device/uevent|*\**) - continue - ;; - */class/mem/*|*/class/tty/*) - first="$first $i" - ;; - */block/md*) - last="$last $i" - ;; - */*) - default="$default $i" - ;; - esac - done - # trigger the sorted events - for i in $first $default $last; do - echo "add" > "$i" - done + list=$(echo /sys/bus/*/devices/*/uevent) + list="$list $(echo /sys/class/*/*/uevent)" + list="$list $(echo /sys/block/*/uevent /sys/block/*/*/uevent)" + for i in $list; do + case "$i" in + */device/uevent|*\**) + continue + ;; + */class/mem/*|*/class/tty/*) + first="$first $i" + ;; + */block/md*) + last="$last $i" + ;; + */*) + default="$default $i" + ;; + esac + done + # trigger the sorted events + for i in $first $default $last; do + echo "add" > "$i" + done } ####################################################################### @@ -201,7 +201,7 @@ fi # dhcp client rundhcp () { -local vci=$1 +local vci="$1" for dhcp in dhclient dhcpcd pump ipconfig none; do test -x /bin/$dhcp && break; done @@ -238,7 +238,7 @@ case $dhcp in *) ;; esac -echo "finished" > /tmp/dhcp-done +echo "dhcp finished" > /tmp/dhcp-done } ####################################################################### @@ -281,7 +281,7 @@ else cfgfile=$cfgfile"." done fi -echo "finished" > /tmp/file-done +echo "tftp finished" > /tmp/file-done } ####################################################################### @@ -386,7 +386,7 @@ sed 's/:.*/:!:13078:0:99999:7:::/;/^root.*/d' /tmp/newpasswd \ # localization simply derived from $language variable set in # machine-setup or other sources - mostly taken from knoppix localization () { -country=$1 +country="$1" CONSOLE_FONT="lat9w-16.psfu" case "$country" in # German version diff --git a/initrd/initrd-stuff/init b/initrd/initrd-stuff/init index 488d6816..ef67c9b4 100755 --- a/initrd/initrd-stuff/init +++ b/initrd/initrd-stuff/init @@ -334,7 +334,7 @@ if [ -n "${UNIONFS}" ] ; then mkdir -p /mnt/uniontmp mount -n --move ${RWDIR}/uniontmp /mnt/uniontmp # run ldconfig if not switched off via kernel command line - [ -z "${NOLDSC}" ] && echo $init_ldcfg && ldconfig /etc/ld.so.cache & + [ -z "${NOLDSC}" ] && echo "$init_ldcfg" && ldconfig /etc/ld.so.cache & elif [ -z "$COWLOOP" ] ; then echo "Using bind mounts to ramdisk for rw access" mount -n -t tmpfs -o size=${TMPFSSIZE} ramfs ${RWDIR} @@ -343,7 +343,7 @@ elif [ -z "$COWLOOP" ] ; then mount -n --bind ${RWDIR}/${path} /mnt/${path} done # see above ... - [ -z "${NOLDSC}" ] && echo $init_ldcfg && ldconfig /tmp/ld.so.cache & + [ -z "${NOLDSC}" ] && echo "$init_ldcfg" && ldconfig /tmp/ld.so.cache & for path in ${D_RODIRSINRW}; do if [ -d /mnt/${path} ] ; then LIST=${path}" "$LIST @@ -382,7 +382,8 @@ 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 \ +echo -e "# /etc${D_SYSCONFDIR}/logfile - file created by $0 (initramfs \ +from $date)\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" @@ -399,12 +400,15 @@ for i in /var/run/utmp /var/log/wtmp /var/log/lastlog /etc/mtab ; do done chmod a+rwxt /mnt/tmp /mnt/tmp/scratch 2>/dev/null & chown 65534:0 /mnt/var/lib/nobody & -echo -e "# /etc/fstab - file generated by\n#\t$0:\n#\tDirk von \ +echo -e "# /etc/fstab - file generated by $0 (initramfs from $date)\n#\ +\tDirk von \ Suchodoletz, dirk@goe.net\n\nrootfs\t\t/\t\trootfs\t\tro\t\t 0 0\n\ proc\t\t/proc\t\tproc\t\tdefaults\t 0 0\ninitramdevs\t/dev\t\ttmpfs\ \t\trw\t\t 0 0\ndevpts\t\t/dev/pts\tdevpts\t\tmode=0620,gid=5\t 0 0\n\ usbfs\t\t/proc/bus/usb\tusbfs\t\tnoauto\t\t 0 0" >>/mnt/etc/fstab || \ error "$init_fstab" +echo -e "rootfs / rootfs rw 0 0" > /mnt/etc/mtab + # copy library cache if generated if [ -z "${NOLDSC}" ] ; then if waitfor /tmp/ldcfg 50000 ; then -- cgit v1.2.3-55-g7522