diff options
author | Dirk von Suchodoletz | 2006-03-25 01:44:23 +0100 |
---|---|---|
committer | Dirk von Suchodoletz | 2006-03-25 01:44:23 +0100 |
commit | 58f6fae954426db04c221be1377786afdccea3f7 (patch) | |
tree | f52d890438648bad9295e7614f6bc9a50620f150 /initrd | |
parent | integration of vmware module. hw modules to ignore for loading ... (diff) | |
download | core-58f6fae954426db04c221be1377786afdccea3f7.tar.gz core-58f6fae954426db04c221be1377786afdccea3f7.tar.xz core-58f6fae954426db04c221be1377786afdccea3f7.zip |
move vm-mount into InitRD, heavy cleanups in initial ramdisk
environment, ...
git-svn-id: http://svn.openslx.org/svn/openslx/ld4@127 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'initrd')
-rw-r--r-- | initrd/distro-specs/debian/functions-3.1 | 14 | ||||
-rw-r--r-- | initrd/distro-specs/suse/functions-10.0 | 18 | ||||
-rw-r--r-- | initrd/distro-specs/suse/functions-10.1 | 18 | ||||
-rw-r--r-- | initrd/distro-specs/suse/functions-9.3 | 101 | ||||
-rw-r--r-- | initrd/distro-specs/ubuntu/functions-5.10 | 34 | ||||
-rwxr-xr-x | initrd/initrd-stuff/bin/servconfig | 13 | ||||
-rw-r--r-- | initrd/initrd-stuff/etc/machine-setup | 8 | ||||
-rw-r--r-- | initrd/initrd-stuff/etc/vmware-prep | 25 | ||||
-rwxr-xr-x | initrd/initrd-stuff/init | 19 | ||||
-rwxr-xr-x | initrd/mkdxsinitrd | 152 |
10 files changed, 168 insertions, 234 deletions
diff --git a/initrd/distro-specs/debian/functions-3.1 b/initrd/distro-specs/debian/functions-3.1 index cb92ffa2..9037bc84 100644 --- a/initrd/distro-specs/debian/functions-3.1 +++ b/initrd/distro-specs/debian/functions-3.1 @@ -30,15 +30,11 @@ for i in rc3.d/K$stop$script rc5.d/K$stop$script \ done } -# extended system users -extpasswd () { -echo -e "daemon:x:1:1:daemon:/usr/sbin:/bin/sh\nbin:x:2:2:bin:/bin:\n\ -/bin/sh\nsys:x:3:3:sys:/dev:/bin/sh\nman:x:6:12:man:/var/cache/man:/bin/sh\n\ -sshd:x:100:65534::/var/run/sshd:/bin/false\nnobody:x:65534:65534:nobody:\n\ -/nonexistent:/bin/sh" >> /mnt/etc/passwd -echo -e "daemon:*:13021:0:99999:7:::\nbin:*:13021:0:99999:7:::\n\ -sys:*:13021:0:99999:7:::\nman:*:13021:0:99999:7:::sshd:!:13021:0:99999:7:::\n\ -nobody:*:13021:0:99999:7:::" >> /mnt/etc/shadow +# make a runlevel script +d_mkrlscript () { +local switch=$1 +local name=$2 +local info=$3 } # group of functions for the normal runlevels - first parameter is start diff --git a/initrd/distro-specs/suse/functions-10.0 b/initrd/distro-specs/suse/functions-10.0 index 881378bb..a4220542 100644 --- a/initrd/distro-specs/suse/functions-10.0 +++ b/initrd/distro-specs/suse/functions-10.0 @@ -51,11 +51,15 @@ local start="05" local stop="18" if [ "x$start_dreshal" = "xyes" ]; then if [ -f /mnt/etc/init.d/dbus ] ; then - strinfile "messagebus:" /mnt/etc/passwd || \ - echo "messagebus:x:100:101:User for D-BUS:/var/run/dbus:/bin/false" \ - >> /mnt/etc/passwd + strinfile "messagebus:" /mnt/etc/passwd || \ + echo "messagebus:x:100:101:User for D-BUS:/var/run/dbus:/bin/false" \ + >> /mnt/etc/passwd + strinfile "messagebus:" /mnt/etc/group || \ + echo "messagebus:!:101:" >> /mnt/etc/group testmkd /mnt/var/run/dbus - # chown 100:101 /mnt/var/run/dbus + # set permissions with userid + echo -e "\tchown messagebus:messagebus /var/run/dbus 2>/dev/null" \ + >>/mnt/etc/${D_INITDIR}/boot.ld rllinker "dbus" "$start" "$stop" fi if [ -f /mnt/etc/init.d/resmgr ] ; then @@ -68,6 +72,12 @@ if [ "x$start_dreshal" = "xyes" ]; then strinfile "haldaemon:" /mnt/etc/passwd || \ echo "haldaemon:x:105:103:User for haldaemon:/var/run/hal:/bin/false" \ >> /mnt/etc/passwd + strinfile "haldaemon:" /mnt/etc/group || \ + echo "haldaemon:!:103:" >> /mnt/etc/group + testmkd /mnt/var/run/hal + # set permissions with userid + echo -e "\tchown haldaemon:haldaemon /var/run/hal 2>/dev/null" \ + >>/mnt/etc/${D_INITDIR}/boot.ld start="0"`expr $start + 1` stop="0"`expr $start - 1` rllinker "haldaemon" "$start" "$stop" diff --git a/initrd/distro-specs/suse/functions-10.1 b/initrd/distro-specs/suse/functions-10.1 index bfce77ff..a41cd223 100644 --- a/initrd/distro-specs/suse/functions-10.1 +++ b/initrd/distro-specs/suse/functions-10.1 @@ -65,11 +65,15 @@ local start="05" local stop="18" if [ "x$start_dreshal" = "xyes" ]; then if [ -f /mnt/etc/init.d/dbus ] ; then - strinfile "messagebus:" /mnt/etc/passwd || \ - echo "messagebus:x:100:101:User for D-BUS:/var/run/dbus:/bin/false" \ - >> /mnt/etc/passwd + strinfile "messagebus:" /mnt/etc/passwd || \ + echo "messagebus:x:100:101:User for D-BUS:/var/run/dbus:/bin/false" \ + >> /mnt/etc/passwd + strinfile "messagebus:" /mnt/etc/group || \ + echo "messagebus:!:101:" >> /mnt/etc/group testmkd /mnt/var/run/dbus - # chown 100:101 /mnt/var/run/dbus + # set permissions with userid + echo -e "\tchown messagebus:messagebus /var/run/dbus 2>/dev/null" \ + >>/mnt/etc/${D_INITDIR}/boot.ld rllinker "dbus" "$start" "$stop" fi if [ -f /mnt/etc/init.d/resmgr ] ; then @@ -82,6 +86,12 @@ if [ "x$start_dreshal" = "xyes" ]; then strinfile "haldaemon:" /mnt/etc/passwd || \ echo "haldaemon:x:105:103:User for haldaemon:/var/run/hal:/bin/false" \ >> /mnt/etc/passwd + strinfile "haldaemon:" /mnt/etc/group || \ + echo "haldaemon:!:103:" >> /mnt/etc/group + testmkd /mnt/var/run/hal + # set permissions with userid + echo -e "\tchown haldaemon:haldaemon /var/run/hal 2>/dev/null" \ + >>/mnt/etc/${D_INITDIR}/boot.ld start="0"`expr $start + 1` stop="0"`expr $start - 1` rllinker "haldaemon" "$start" "$stop" diff --git a/initrd/distro-specs/suse/functions-9.3 b/initrd/distro-specs/suse/functions-9.3 index 6bf69f2c..6aa1d4b6 100644 --- a/initrd/distro-specs/suse/functions-9.3 +++ b/initrd/distro-specs/suse/functions-9.3 @@ -102,7 +102,7 @@ if [ "x$start_syslog" = "xyes" ] ; then # logging servers might be specified in $log_servers (from e.g. dhcp) echo -e "# File modified by $0 within initial ramdisk" \ > /etc/syslog-ng.conf - sed -e "s,.*dhcp/dev.*,," -e "s,.*named/dev.*,," \ + sed -e "s,.*dhcp/dev.*,,;s,.*named/dev.*,," \ /mnt/etc/syslog-ng/syslog-ng.conf >> /etc/syslog-ng.conf cp /etc/syslog-ng.conf /mnt/etc/syslog-ng/syslog-ng.conf rllinker syslog "02" "20" @@ -132,55 +132,6 @@ if [ "x$start_snmp" = "xyes" ] ; then fi } -# x11 stuff --> obsoleted by new vmware integration concept -#descsession () { -#if [ "x$desktop_session" != "x" ] ; then -# windowmanagers="$desktop_session" -# # write script for desktop-session chooser -# if [ "x$vmware" != "xno" ] ; then -# debug="" -# [ ${DEBUGLEVEL} -gt 0 ] && debug="--debug 1" -# echo -e "#!/bin/sh\n#\n# file generated by\n#\t$0:\n#\t$date\n -#OSTYPE=\`echo \$0 | sed -e \"s,-, ,\" -e \"s,.*/,,\" | awk '{print \$1}'\` -#SPECTYPE=\`echo \$0 | sed -e \"s,-, ,\" -e \"s,.*/,,\" | awk '{print \$2}'\`\n -#OPTS=\"-o \$OSTYPE \${SPECTYPE:+\"-s \$SPECTYPE\"}\"\n -#xterm -bg black -fg white -geometry 170x30+0-0 +sb \ -#-e \"runvmware \$OPTS $debug\"\n" > /mnt/var/X11R6/bin/desktop-session -# chmod a+x /mnt/var/X11R6/bin/desktop-session -# addpath="true"; -# fi -#else -# windowmanagers="kde,gnome,icewm,failsafe" -#fi -# check if /usr/X11R6/bin is writeable, else use /var/X11R6/bin -#if [ -w /mnt/usr/X11R6/bin/WM-Session ] ; then -# sesspath="/usr/X11R6/bin" -#else -# sesspath="/var/X11R6/bin" -# addpath="true" -#fi - -# create links to desktop-session chooser -#[ -f /mnt/usr/bin/X11/wmlist ] && wmlist=`cat /mnt/usr/bin/X11/wmlist` -#testmkd /mnt/etc/X11/sessions -#for i in `echo $windowmanagers|sed -e "s/,/ /g"` ; do -# # beware!! quickhack for VMware sessions -# strinstr "$i" "$wmlist" || \ -# test -x /mnt/usr/X11R6/bin/$i || \ -# echo -e "[Desktop Entry]\nX-SuSE-translate=true\nEncoding=UTF-8\n\ -#Type=XSession\nExec=$i\nTryExec=$sesspath/$i\n\ -#Name=$i\n" > /mnt/etc/X11/sessions/$i.desktop -# # does not work correctly (add /var/X11R6/bin to path!!) -# test -x /mnt/usr/X11R6/bin/$i || \ -# ln -fs /var/X11R6/bin/desktop-session /mnt/$sesspath/$i -#done - -# add special path /var/X11R6/bin to the PATH variable -#[ "x$addpath" != "x" ] && \ -# echo -e "# added path component by $0: $date\n\ -#PATH=\"\$PATH:/var/X11R6/bin\"" >>/mnt/etc/SuSEconfig/profile -#} - # configure X display manager (/etc/sysconfig/displaymanager) config_dm_entry () { local dm="$1" @@ -362,11 +313,15 @@ local start="05" local stop="18" if [ "x$start_dreshal" = "xyes" ]; then if [ -f /mnt/etc/init.d/dbus ] ; then - strinfile "messagebus:" /mnt/etc/passwd || \ - echo "messagebus:x:100:101:User for D-BUS:/var/run/dbus:/bin/false" \ - >> /mnt/etc/passwd + strinfile "messagebus:" /mnt/etc/passwd || \ + echo "messagebus:x:100:101:User for D-BUS:/var/run/dbus:/bin/false" \ + >> /mnt/etc/passwd + strinfile "messagebus:" /mnt/etc/group || \ + echo "messagebus:!:101:" >> /mnt/etc/group testmkd /mnt/var/run/dbus - chown 100:101 /mnt/var/run/dbus + # set permissions with userid + echo -e "\tchown messagebus:messagebus /var/run/dbus 2>/dev/null" \ + >>/mnt/etc/${D_INITDIR}/boot.ld rllinker "dbus" "$start" "$stop" fi if [ -f /mnt/etc/init.d/resmgr ] ; then @@ -379,8 +334,12 @@ if [ "x$start_dreshal" = "xyes" ]; then strinfile "haldaemon:" /mnt/etc/passwd || \ echo "haldaemon:x:105:103:User for haldaemon:/var/run/hal:/bin/false" \ >> /mnt/etc/passwd + strinfile "haldaemon:" /mnt/etc/group || \ + echo "haldaemon:!:103:" >> /mnt/etc/group testmkd /mnt/var/run/hal - chown 105:103 /mnt/var/run/hal + # set permissions with userid + echo -e "\tchown haldaemon:haldaemon /var/run/hal 2>/dev/null" \ + >>/mnt/etc/${D_INITDIR}/boot.ld start="0"`expr $start + 1` stop="0"`expr $start - 1` rllinker "hal" "$start" "$stop" @@ -433,16 +392,6 @@ rllinker "portmap" "02" "20" # start vmware config_vmware () { -echo -e "#! /bin/sh\n# /etc/${D_INITDIR}/vmware-prep\n#\n\ -# file generated by $0 within initial ramdisk\n\ -. /etc/rc.status\n. /etc/sysconfig/logfile\n\ -\ncase \"\$1\" in\n start)\ -\techo -n \"Starting preparation of vmware environment \"" \ - >> /mnt/etc/${D_INITDIR}/vmware-prep -cat /etc/vmware-prep >> /mnt/etc/${D_INITDIR}/vmware-prep -echo -e "\trc_status -v\n\t;;\nesac\nrc_exit" \ - >> /mnt/etc/${D_INITDIR}/vmware-prep -chmod u+x /mnt/etc/${D_INITDIR}/vmware-prep rllinker "vmware-prep" "18" "02" rllinker "vmware" "20" "02" # if running start scripts in parallel vmware-prep is not recognized @@ -457,24 +406,24 @@ sed -e "s,TARGETS =,TARGETS = vmware-prep," \ cp /etc/.depend.start /mnt/etc/${D_INITDIR}/.depend.start } -# initialize boot.ld - skript to be executed during early system startup +# initialize runlevel skript to be executed during system startup # (before most of the normal boot init scripts) # this script should operate like a normal runlevel script -d_mkbootld () { +d_mkrlscript () { +local switch=$1 +local name=$2 +local info=$3 case "$1" in init) - echo -e "#!/bin/sh\n# skeleton of /etc/${D_INITDIR}/boot.ld written \ -from $0" >/mnt/etc/${D_INITDIR}/boot.ld - echo -e '\n. /etc/rc.status\nrc_reset\ncase "$1" in\n start)' \ - >>/mnt/etc/${D_INITDIR}/boot.ld - echo -e '\techo -n "Running post configuration required by initrd"' \ - >>/mnt/etc/${D_INITDIR}/boot.ld - chmod u+x /mnt/etc/${D_INITDIR}/boot.ld + echo -en "#!/bin/sh\n# skeleton of /etc/${D_INITDIR}/$name written \ +from $0\n. /etc/rc.status\n. /etc/sysconfig/logfile\nrc_reset\n\ +case \"\$1\" in\n start)\n\techo -n " >>/mnt/etc/${D_INITDIR}/$name + echo "\"$info\"" >>/mnt/etc/${D_INITDIR}/$name + chmod u+x /mnt/etc/${D_INITDIR}/$name ;; close) echo -e "\trc_status -v\n\t;;\n stop)\n\t;;\nesac\nrc_exit" \ - >>/mnt/etc/${D_INITDIR}/boot.ld - + >>/mnt/etc/${D_INITDIR}/$name ;; esac } diff --git a/initrd/distro-specs/ubuntu/functions-5.10 b/initrd/distro-specs/ubuntu/functions-5.10 index 14d7e236..6567f14b 100644 --- a/initrd/distro-specs/ubuntu/functions-5.10 +++ b/initrd/distro-specs/ubuntu/functions-5.10 @@ -2,7 +2,7 @@ # linux diskless clients (executed within initial # ramdisk after genconfig) # -# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 23-03-2006 +# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 24-03-2006 # Nico Dietrich # Felix Endres # @@ -22,8 +22,7 @@ preinit () { } postinit () { - # A command seems to be necessary here - echo "" + : } # AUS SuSE-9.3 @@ -253,21 +252,21 @@ config_bt () { # initialize boot.ld - skript to be executed during early system startup # (before most of the normal boot init scripts) # this script should operate like a normal runlevel script (fixme!!) -d_mkbootld () { -case "$1" in +d_mkrlscript () { +local switch=$1 +local name=$2 +local info=$3 +case "$switch" in init) - echo -e "#!/bin/sh\n# skeleton of /etc/${D_INITDIR}/boot.ld written \ -from $0" >/mnt/etc/${D_INITDIR}/boot.ld - echo -e '\n\ncase "$1" in\n start)' \ - >>/mnt/etc/${D_INITDIR}/boot.ld - echo -e '\techo -n "Running post configuration required by initrd"' \ - >>/mnt/etc/${D_INITDIR}/boot.ld - chmod u+x /mnt/etc/${D_INITDIR}/boot.ld + echo -e "#!/bin/sh\n# skeleton of /etc/${D_INITDIR}/$name written \ +from $0" >/mnt/etc/${D_INITDIR}/$name + echo -e "\n\ncase \"\$1\" in\n start)\techo -n \"$info\"" \ + >>/mnt/etc/${D_INITDIR}/$name + chmod u+x /mnt/etc/${D_INITDIR}/$name ;; close) echo -e "\t;;\n stop)\n\t;;\nesac\nexit 0" \ - >>/mnt/etc/${D_INITDIR}/boot.ld - + >>/mnt/etc/${D_INITDIR}/$name ;; esac } @@ -279,13 +278,6 @@ config_nscd () { # start vmware config_vmware () { -echo -e "#! /bin/sh\n#\n# /etc/${D_INITDIR}/vmware-prep\n\ -# file generated by $0 within initial ramdisk\n\ -# hier fehlt noch der uebliche Ubuntu Startskript header" \ - >> /mnt/etc/${D_INITDIR}/vmware-prep -cat /etc/vmware-prep >> /mnt/etc/${D_INITDIR}/vmware-prep -echo -e "# und der Abschluss" >> /mnt/etc/${D_INITDIR}/vmware-prep -chmod u+x /mnt/etc/${D_INITDIR}/vmware-prep rllinker "vmware-prep" "18" "02" rllinker "vmware" "20" "02" } diff --git a/initrd/initrd-stuff/bin/servconfig b/initrd/initrd-stuff/bin/servconfig index d7f784c0..6de5ba48 100755 --- a/initrd/initrd-stuff/bin/servconfig +++ b/initrd/initrd-stuff/bin/servconfig @@ -4,7 +4,7 @@ # for linux diskless clients (executed within initial # ramdisk) # -# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 23-03-2006 +# Author(s): Dirk von Suchodoletz <dirk@goe.net>, 25-03-2006 # Blabla # Blub # @@ -54,7 +54,7 @@ data via dhcp until now ..." nonfatal . /etc/machine-setup # hack for replacing variables ($serverip, $clientip, $host_name) in # machine-setup -sed -e "s/\$serverip/$serverip/" -e "s/\$clientip/$clientip/" \ +sed -e "s/\$serverip/$serverip/;s/\$clientip/$clientip/" \ /etc/machine-setup > /etc/machine-setup.new cp /etc/machine-setup.new /etc/machine-setup . /etc/machine-setup @@ -191,6 +191,15 @@ config_snmp 24 02 # create needed directories and files if [ "x$vmware" != "x" ] || [ "x$vmware" != "xno" ] ; then + # in the future other types of sources besides NFS should be supported + mount -t nfs -o ro,nolock,intr,nodev,soft,timeo=2,nosuid \ + ${imgsrv} /mnt/${vmdir} & + # generate a runlevel script + d_mkrlscript init vmware-prep "Starting preparation of vmware environment" + sed "s,^#.*,,;/^$/d;s,^,\t," /etc/vmware-prep >> \ + /mnt/etc/${D_INITDIR}/vmware-prep + d_mkrlscript close vmware-prep "" + chmod u+x /mnt/etc/${D_INITDIR}/vmware-prep config_vmware for i in /var/lib/vmware /etc/vmware/vmnet1 /etc/vmware/vmnet8 \ /var/run/vmware ; do diff --git a/initrd/initrd-stuff/etc/machine-setup b/initrd/initrd-stuff/etc/machine-setup index 232d727c..24e754c5 100644 --- a/initrd/initrd-stuff/etc/machine-setup +++ b/initrd/initrd-stuff/etc/machine-setup @@ -85,14 +85,14 @@ netbios_workgroup="dxs-network" # automounter home (/local_dir - top level directories only) and source # (server:/path) automnt_dir="/home" -automnt_src="10.8.4.254:/home" +automnt_src="$serverip:/home" # scratch space on server -scratch="132.230.4.71:/dxs/tmp" +scratch="$serverip:/dxs/tmp" # configure and start vmware services -vmware="yes" -imgsrv="132.230.4.71:/dxs/vmware" +vmware="no" +imgsrv="$serverip:/dxs/vmware" # kind of X11 display manager to run start_xdmcp="xdm" diff --git a/initrd/initrd-stuff/etc/vmware-prep b/initrd/initrd-stuff/etc/vmware-prep index e2eec061..4421a1c5 100644 --- a/initrd/initrd-stuff/etc/vmware-prep +++ b/initrd/initrd-stuff/etc/vmware-prep @@ -1,14 +1,15 @@ #!/bin/sh # -# Description: Adaptation of a generic runlevel script file for use with +# Description: Kernel of a generic runlevel script file for use with # Diskless X Stations (v4.0) - script prepares vmware -# environment +# environment. Start and stop functionality is added within +# initial ramdisk # # Author(s): Michael Janczyk <mj0@uni-freiburg.de>, 23-03-2006 -# Dirk von Suchodoletz <dirk@goe.net>, 08-03-2006 +# Dirk von Suchodoletz <dirk@goe.net>, 25-03-2006 # Copyright: (c) 2003, 2006 - RZ Universitaet Freiburg # -# Version: 0.1a +# Version: 0.1b ################################################################################ @@ -74,13 +75,14 @@ Xpath () { # blabla sessiondinens desktop_session () { echo -e "#!/bin/sh\n#\n# file generated by\n#\t${0}:\n#\t${date}\n - os=\$(echo \$0 | sed -e \"s,-, ,\" -e \"s,.*/,,\" | awk '{print \$1}') - spec=\$(echo \$0 | sed -e \"s,-, ,\" -e \"s,.*/,,\" | awk '{print \$2}')\n + os=\$(echo \$0 | sed -e \"s,-, ,;s,.*/,,\" | awk '{print \$1}') + spec=\$(echo \$0 | sed -e \"s,-, ,;s,.*/,,\" | awk '{print \$2}')\n options=\"-o \${os} \${spec:+\"-s \${spec}\"}\"\n xterm -bg black -fg white -geometry 170x30+0-0 +sb \ -e \"${path}/runvmware \${options} ${debug}\"\n" \ > ${path}/desktop-session + chmod a+x ${path}/desktop-session } @@ -102,10 +104,11 @@ vmsession2desktop_session () { ### START SCRIPT ############################################################### # create vmdir -mkdir -p /var/lib/vmware 2>&1 +#mkdir -p /var/lib/vmware 2>&1 -# mount von zeugs -mount -t nfs -o ro,nolock,intr,nodev,soft,timeo=2,nosuid ${imgsrv} ${vmdir} +# mount von zeugs (wohl besser in der InitRD, da sonst Sessions nicht +# rechtzeitig fuer gdm/kdm verfuegbar) +#mount -t nfs -o ro,nolock,intr,nodev,soft,timeo=2,nosuid ${imgsrv} ${vmdir} # device creation - the module does not trigger udev properly vmnet @@ -113,7 +116,7 @@ vmnet # special start script for vmware with predefined image Xpath -# loop file for exchanging information between linux and vmware +# loop file for exchanging information between linux and vmware guest mount_loop # blabla sessiondinens @@ -124,5 +127,5 @@ vmsession2desktop_session -exit 0 +#exit 0 diff --git a/initrd/initrd-stuff/init b/initrd/initrd-stuff/init index 4431ece3..7ac6c087 100755 --- a/initrd/initrd-stuff/init +++ b/initrd/initrd-stuff/init @@ -187,12 +187,12 @@ ipsetup 127.0.0.1 255.0.0.0 0.0.0.0 127.255.255.255 lo # analyze ip information from the kernel command line and put parts # of it into several variables if [ -n "$IPINFO" ] ; then - IP=`echo $IPINFO|sed -e "s,:.*,,"` - SERVER=`echo $IPINFO|sed -e "s;[0-9\.]\{3,\}:;;" -e "s,:.*,,"` - GW=`echo $IPINFO|sed -e "s;[0-9\.]\{3,\}:[0-9\.]\{3,\}:;;" -e "s,:.*,,"` + IP=`echo $IPINFO|sed -e "s/:.*//"` + SERVER=`echo $IPINFO|sed -e "s/[0-9\.]\{3,\}://;s/:.*//"` + GW=`echo $IPINFO|sed -e "s/[0-9\.]\{3,\}:[0-9\.]\{3,\}://;s/:.*//"` # remove last colon after netmask if it was left there ... - IPINFO=`echo $IPINFO|sed -e "s,:$,,"` - NM=`echo $IPINFO|sed -e "s,.*:,,"` + IPINFO=`echo $IPINFO|sed -e "s/:$//"` + NM=`echo $IPINFO|sed -e "s/.*://"` echo -e "# ip configuration written by $0 script\nclientip=$IP\n\ sub_netmask=$NM\ngateway=$GW\nserverip=$SERVER" \ >>/etc/machine-setup @@ -368,7 +368,7 @@ else # run some specific stuff !? fi # script for stuff to execute during early bootup -d_mkbootld init +d_mkrlscript init boot.ld "Running post configuration required by init" echo "fs complete" >/tmp/fscmpl # write debug file information after filesystem setup completed @@ -420,13 +420,11 @@ and list the modules loaded until\n now." waitfor /tmp/svcfg 20000 || error " For some reason the software config \ of this client did not finish in\n time. You might check the process list \ and list the modules loaded until\n now." -# close runlevel script for stuff to execute during early bootup -d_mkbootld close # IP configuration is made and should not be updated automatically, udevd # should be killed if started within init killall -9 dhcpcd dhclient pump 2>/dev/null -bash +[ $DEBUGLEVEL -gt 1 ] && sh # post init for some distro specific postinit @@ -442,6 +440,9 @@ failed for some reason. Some\n modprobe still active!?" # check for inittab file test -f /mnt/etc/inittab || error " The file /etc/inittab does not exist or \ is no regular one. It is needed\n for the bootup procedure to follow." +# close runlevel script for stuff to execute during early bootup +d_mkrlscript close boot.ld "" +# preparations to leave initrd - umounting ... umount -n /sys || error " Unmount of the kernel sys directory \ failed for some\nreason. You will get some error messages that some files \ could not be\n removed." nonfatal diff --git a/initrd/mkdxsinitrd b/initrd/mkdxsinitrd index 627fdc4a..2ec5b3e3 100755 --- a/initrd/mkdxsinitrd +++ b/initrd/mkdxsinitrd @@ -59,16 +59,17 @@ usage() # replaces which to find executables inside ROOTDIR binfinder() { - local PROGRAM="$1" - local RET=1 - for ELEMENT in bin sbin usr/bin usr/sbin usr/local/bin usr/bin/X11; do - if [ -f "${ROOTDIR}/$ELEMENT/$PROGRAM" ] && [ -x "${ROOTDIR}/$ELEMENT/$PROGRAM" ]; then - printf '%s\n' "${ROOTDIR}/$ELEMENT/$PROGRAM" - RET=0 - break - fi - done - return "$RET" +local PROGRAM="$1" +local RET=1 +for ELEMENT in bin sbin usr/bin usr/sbin usr/local/bin usr/bin/X11; do + if [ -f "${ROOTDIR}/$ELEMENT/$PROGRAM" ] && \ + [ -x "${ROOTDIR}/$ELEMENT/$PROGRAM" ]; then + printf '%s\n' "${ROOTDIR}/$ELEMENT/$PROGRAM" + RET=0 + break + fi +done +return "$RET" } # copy some binary to given destination. Takes binary in $1 and @@ -108,13 +109,11 @@ else elif [ -L initrd-stuff/${FILENAME} ] ; then cp -a initrd-stuff/${FILENAME} ${INSTDIR}/${FILENAME%/*} else - sed -e "s,@@@INSTDIR@@@,${INSTDIR},g" \ + sed -e "s,@@@INSTDIR@@@,${INSTDIR},g;s,@@@KERNVER@@@,${KERNVER},g" \ + -e "s,@@@DISTRO@@@,${DISTRO},g;s,@@@NETIF@@@,${NET_IF},g" \ -e "s,@@@NWMODULES@@@,${NWMODULES},g" \ - -e "s,@@@KERNVER@@@,${KERNVER},g" \ -e "s,@@@COMDIRINDXS@@@,${COMDIRINDXS},g" \ -e "s,@@@COMETCEXCL@@@,${COMETCEXCL},g" \ - -e "s,@@@DISTRO@@@,${DISTRO},g" \ - -e "s,@@@NETIF@@@,${NET_IF},g" \ -e "/^# .*/d" \ initrd-stuff/${FILENAME} >> ${INSTDIR}/${FILENAME} fi @@ -124,7 +123,6 @@ fi # this function incrementally concats and copies distro-specific functions, # configuration variables and files copy_distro_stuff() { - # first insert dependencies case $1 in suse) @@ -152,80 +150,53 @@ copy_distro_stuff() { cat distro-specs/$1/functions-$2 >>${INSTDIR}/etc/distro-functions # would be cool not to copy .svn here ... cp -a distro-specs/$1/files-$2 ${INSTDIR}/etc/sysconfig/files 2>/dev/null + # ... so remove them afterwards ... + find ${INSTDIR}/etc/sysconfig/files \ + -regex ".*/\..*" -exec rm -rf {} 2>/dev/null \; } ######################################################################### # End of function declaration while getopts :hgk:i:r:o:s:f:n:Sut:d:v:I:V:a: a ; do - case $a in - \:|\?) case $OPTARG in - k) echo "-k requires kernel version parameter" - ;; - i) echo "-i requires initrd path parameter" - ;; - f) echo "-f requires file system module list parameter" - ;; - n) echo "-n requires network module list parameter" - ;; - r) echo "-r requires root dir parameter" - ;; - s) echo "-s requires image size(s)" - ;; - t) echo "-t requires tmp dir parameter" - ;; - d) echo "-d requires linux distribution name" - ;; - v) echo "-v requires linux distribution version" - ;; - I) echo "-I requires network interface parameter" - ;; - a) echo "-a requires a DSDT parameter" - ;; - V) echo "-V requires an executable to run inside linuxrc" - ;; - *) echo "Unknown option: -$OPTARG" - echo "Try mkinitrd -h" - ;; - esac - exit 1 - ;; - g) use_glibc=1 - ;; - k) KERNVER=$OPTARG - ;; - i) INITRD_PATH=$OPTARG - ;; - f) FSMODULES=$OPTARG - ;; - n) NWMODULES=$OPTARG - ;; - r) ROOTDIR=$OPTARG - ;; - s) SPLASH=$OPTARG - ;; - t) INSTDIR=$OPTARG - ;; - d) DISTRO=$OPTARG - ;; - v) DISTRO_VER=$OPTARG - ;; - I) NET_IF=$OPTARG - ;; - a) acpi_dsdt="$OPTARG" - ;; - S) use_selinux=1 - ;; - V) vendor_init_script="$OPTARG" - ;; - R) mkinit_type="rd" - ;; - u) sysfs_root=1 + case $a in + \:|\?) + case $OPTARG in + k) echo "-k requires kernel version parameter";; + i) echo "-i requires initrd path parameter";; + f) echo "-f requires file system module list parameter";; + n) echo "-n requires network module list parameter";; + r) echo "-r requires root dir parameter";; + s) echo "-s requires image size(s)";; + t) echo "-t requires tmp dir parameter";; + d) echo "-d requires linux distribution name";; + v) echo "-v requires linux distribution version";; + I) echo "-I requires network interface parameter";; + V) echo "-V requires an executable to run inside linuxrc";; + *) echo "Unknown option: -$OPTARG" + echo "Try mkinitrd -h";; + esac + exit 1 + ;; + g) use_glibc=1;; + k) KERNVER=$OPTARG;; + i) INITRD_PATH=$OPTARG ;; + f) FSMODULES=$OPTARG;; + n) NWMODULES=$OPTARG ;; + r) ROOTDIR=$OPTARG;; + s) SPLASH=$OPTARG;; + t) INSTDIR=$OPTARG;; + d) DISTRO=$OPTARG;; + v) DISTRO_VER=$OPTARG;; + I) NET_IF=$OPTARG;; + a) acpi_dsdt="$OPTARG";; + S) use_selinux=1;; + V) vendor_init_script="$OPTARG";; + u) sysfs_root=1 use_udev= ;; - h) usage - ;; - esac + h) usage;; + esac done shift $(expr $OPTIND - 1) @@ -257,7 +228,8 @@ if [ -z "${DISTRO}" ] ; then DISTRO=debian DISTRO_VER=`cat ${ROOTDIR}/etc/debian_version` else - echo "Could not detect client distribution type and version. Please specify as command line argument (-d <distro-name> -v <distro-version)" + echo "Could not detect client distribution type and version. Please \ +specify\nas command line argument (-d <distro-name> -v <distro-version)" exit 1; fi fi @@ -313,13 +285,11 @@ cp -a ${ROOTDIR}/etc/udev ${INSTDIR}/etc # an dieser stelle sollte jetzt sichergestellt sein, dass sowohl DISTRO als auch DISTRO_VER eindeutig gesetzt sind! - - copy_distro_stuff ${DISTRO} ${DISTRO_VER} # devices needed rather early (copied from /tmp to /dev in init) -mknod ${INSTDIR}/tmp/console c 5 1 #&>/dev/null -mknod ${INSTDIR}/tmp/null c 1 3 #&>/dev/null +mknod ${INSTDIR}/tmp/console c 5 1 &>/dev/null +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 :-( @@ -375,13 +345,6 @@ for bbins in udev udevd udevstart cobi ${bbins} bin &>/dev/null || echo "Program ${bbins} not found" done -# in suse 9.3 it could be better to use udev.static etc -#for bbins in udev udevd udevstart -#do -# cobi ${bbins}.static bin || echo "Program ${bbins}.static not found" -# ln -s /bin/${bbins}.static ${INSTDIR}/bin/${bbins} -#done - # if nfs mkdir -p ${INSTDIR}/var/lib/nfs/state @@ -407,7 +370,8 @@ case "${DISTRO}" in esac # add needed libraries depending on choosen binaries -for lib in `ldd /tmp/dxs-instrd/bin/* 2>/dev/null | sed -e "s,tls,," -e "s,i686/cmov,," \ +for lib in `ldd /tmp/dxs-instrd/bin/* 2>/dev/null | \ + sed -e "s,tls,,;s,i686/cmov,," \ -ne 's:\t\(.* => \)\?\(/.*\) (0x[0-9a-f]*):\2:p' | sort -u` ; do baselib=`basename ${lib}` test -e ${INSTDIR}/lib/${baselib} || \ |