From b705056e4e54c038d50688eaea27065c292098cb Mon Sep 17 00:00:00 2001 From: Dirk von Suchodoletz Date: Sun, 4 Feb 2007 17:02:34 +0000 Subject: Renaming of variables (in slx init/functions) to be compatible with machine-setup assignements. Reading machine-setup at the beginning of slx init to have the possibility to move kernel commandline parameters to file if common for all client using a certain InitRamFS ... git-svn-id: http://svn.openslx.org/svn/openslx/trunk@677 95ad53e4-c205-0410-b2fa-d234c58c8868 --- initramfs/initrd-stuff/init | 98 +++++++++++++++++++++++---------------------- 1 file changed, 51 insertions(+), 47 deletions(-) (limited to 'initramfs/initrd-stuff/init') diff --git a/initramfs/initrd-stuff/init b/initramfs/initrd-stuff/init index 797d1c82..c2bdb5af 100755 --- a/initramfs/initrd-stuff/init +++ b/initramfs/initrd-stuff/init @@ -8,7 +8,7 @@ # If you have any feedback please consult http://openslx.org/feedback and # send your feedback to feedback@openslx.org # -# General information about OpenSLX can be found under http://openslx.org +# General information about OpenSLX can be found at http://openslx.org # # main script for new type of initial ramdisk for OpenSLX linux diskless # clients version 4 @@ -19,11 +19,15 @@ . /etc/messages . /etc/functions || ( echo -e $init_mff && sleep 100 ) . /etc/distro-functions || ( echo -e $init_dff && sleep 100 ) -# configuration settings (several file and directory variables) +# distro specific configuration settings (several file and directory +# variables) . /etc/sysconfig/config || ( echo -e $init_dscf && sleep 100 ) # configuration settings for slx environment . /etc/sysconfig/slxconfig 2>/dev/null || ( echo -e ${init_sscf} && \ sleep 100 ) +# machine-setup configuration (common settings for all clients using a +# certain InitRamFS generated by slxmkramfs/mkdxsinitrd) +[ -f /etc/machine-setup ] && . /etc/machine-setup 2>/dev/null export PATH=/bin:/sbin:/usr/bin/:/usr/sbin export date="${slxconf_date}" @@ -110,30 +114,30 @@ in $0\ncountry=\"${COUNTRY}\"" >> /etc/machine-setup ;; # if configuration should be gathered by dhcp client dhcp) - DHCP="yes" + dhcp="yes" rm /tmp/dhcp-done ;; # if ldap configuration should be triggered ldap) - LDAP="yes" + ldap="yes" rm /tmp/ldap-done ;; # ldap configuration with host and port to contact (base) ldap=*) - LDAP="yes" + ldap="yes" rm /tmp/ldap-done ;; # if (external, via tftp) configuration file retrieval should be # triggered, if no source is given try dhcp server and predefined # standard path (.../tftpboot/client-config/ ...) file) - FILE="yes" + file="yes" rm /tmp/file-done ;; # file source with tftp server and file location on the server file=*) - FILE="yes" - FILESRC=${opts#file=} + file="yes" + filesrc=${opts#file=} rm /tmp/file-done ;; # if ld.so.cache should not be generated @@ -141,29 +145,29 @@ in $0\ncountry=\"${COUNTRY}\"" >> /etc/machine-setup noldsc=yes;; # additional source to unify root filesystem with union=*) - UNIONFS=1 - UNIONDIRS=${opts#union=} + unionfs=1 + uniondirs=${opts#union=} ;; # if unionfs should be used over the complete root filesystem unionfs) - UNIONFS=1;; + unionfs=1;; # if cowloop should be used, only ontop of network block device and in # combination with classical fs, like ext2 useful cowloop=*) - COWLOOP=1 + cowloop=1 #cowsize=${opts#cowloop=} ;; # rootfs will void the variables (d)nbdroot, nfsroot ... # fixme: allow multiple rootfs sources to be unioned!? - # if strinstr " " "$ROOTFS" ... + # if strinstr " " "$rootfs" ... rootfs=*) - ROOTFS=${opts#rootfs=} - srvproto=$(uri_token $ROOTFS prot) + rootfs=${opts#rootfs=} + srvproto=$(uri_token $rootfs prot) case $srvproto in nfs) # nfsroot consists now of two different parts - root_path=/$(uri_token $ROOTFS path) - nfsserver=$(uri_token $ROOTFS server) + root_path=/$(uri_token $rootfs path) + nfsserver=$(uri_token $rootfs server) echo -e "\n# nfs root information gotten via kernel command \ line in $0\nnfsroot=\"${nfsroot}\"\n" >> /etc/machine-setup ;; @@ -171,27 +175,27 @@ line in $0\nnfsroot=\"${nfsroot}\"\n" >> /etc/machine-setup nbdmod=$srvproto # get settings for nbd-client, filesystem equals to path in URI # notation - nbdhost=$(uri_token $ROOTFS server) - nbdport=$(uri_token $ROOTFS port) - nbdrfst=$(uri_token $ROOTFS path) + nbdhost=$(uri_token $rootfs server) + nbdport=$(uri_token $rootfs port) + nbdrfst=$(uri_token $rootfs path) ;; aoe) echo "Not implemented yet" ;; iscsi) echo "Not implemented yet" - #iscsiserver=$(uri_token $ROOTFS server) - #iscsiport=$(uri_token $ROOTFS port) - #iscsitarget=$(uri_token $ROOTFS path) + #iscsiserver=$(uri_token $rootfs server) + #iscsiport=$(uri_token $rootfs port) + #iscsitarget=$(uri_token $rootfs path) ;; esac ;; # size of cache dnbd should use within ram dcsize=*) - DNBDCACHESIZE=${opts#dcsize=};; + dnbdcachesize=${opts#dcsize=};; # ip configuration client-ip:server-ip:gateway:netmask ip=*) - IPINFO=${opts#ip=};; + ipinfo=${opts#ip=};; # deprecated: nfs server and path (will be removed soon) nfsroot=*) nfsroot=${opts#nfsroot=} @@ -206,7 +210,7 @@ nfsroot=\"${nfsroot}\"\n" >> /etc/machine-setup # vendor code identifier for dhcp requests, that way odlx clients could # be distinguished from other (dhcp) clients vci=*) - VCI=${opts#vci=};; + vci=${opts#vci=};; xenbr) XENBR=1;; esac @@ -229,7 +233,7 @@ EOF fi # check if at least one type of IP configuration is availabe -if [ -z "$DHCP" -a -z "$LDAP" -a -z "$IPINFO" ] ; then +if [ -z "$dhcp" -a -z "$ldap" -a -z "$ipinfo" ] ; then echo -e "# You did not specify any advanced configuration mode for your \ clients. You\n# might want to add the token 'dhcp' for DHCP configuration, \ 'file(=source)'\n# for config file get via TFTP or 'ldap(=source)' for LDAP \ @@ -237,14 +241,14 @@ configuration to\n# your kernel command line." >> /etc/machine-setup if strinfile "clientip" /etc/machine-setup ; then # IP configuration seems to be present in machine-setup file . /etc/machine-setup - IPINFO="ip=$clientip:$serverip:$gateway:$subnet_mask" + ipinfo="ip=$clientip:$serverip:$gateway:$subnet_mask" else 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 "$init_errldap" +[ -z "$dhcp" -a -n "$ldap" -a -z "$ipinfo" ] && error "$init_errldap" # set debug level and logfile if [ $DEBUGLEVEL -eq 20 ] ; then echo "** Setting debuglevel to ${DEBUGLEVEL} at $(sysup)" @@ -290,9 +294,9 @@ 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 +if [ -n "$ipinfo" ] ; then getip () { - val="$IPINFO:"; i=$(expr $1 - 1); + val="$ipinfo:"; i=$(expr $1 - 1); while [ $i -gt 0 ] ; do val=${val#*:} ; i=$(expr $i - 1); done; @@ -310,8 +314,8 @@ else noipyet="yes" fi # get configuration data via dhcp (with vendor code identifier if present -# in ${VCI} (from kernel command line) ... -[ -n "$DHCP" ] && rundhcp ${VCI} & +# in ${vci} (from kernel command line) ... +[ -n "$dhcp" ] && rundhcp ${vci} & if [ -n "$noipyet" ] ; then waitfor /tmp/dhcp-done 20000 . /etc/machine-setup @@ -322,9 +326,9 @@ if [ -n "$noipyet" ] ; then fi [ $DEBUGLEVEL -eq 20 ] && echo "** finished ip config at $(sysup)" # ... or ldap if available (in background) -[ -n "$LDAP" ] && ldapconf & +[ -n "$ldap" ] && ldapconf & # ... or via tftp file get (in background) -[ -n "$FILE" ] && fileget & +[ -n "$file" ] && fileget & # if root filesystem should be imported via (d) network block device if [ -n "${nbdmod}" ] ; then @@ -372,16 +376,16 @@ if [ -n "${nbdmod}" ] ; then ;; esac RWRO="ro" - if [ -n "${COWLOOP}" -a -x /bin/cowdev ] ; then + if [ -n "${cowloop}" -a -x /bin/cowdev ] ; then modprobe ${MODPRV} cowloop || { error "$init_loadcow" nonfatal - COWLOOP=""; } + cowloop=""; } [ -x /bin/mdev ] && mdev -s fi - if [ -n "${COWLOOP}" ] ; then - if [ -n "${UNIONFS}" ] ; then + if [ -n "${cowloop}" ] ; then + if [ -n "${unionfs}" ] ; then error "$init_cownonbd" - UNIONFS=""; + unionfs=""; fi echo "Using Copy-on-Write block device for rw access" mount -n -t tmpfs -o size=${cowsize} ramfs ${rwdir} @@ -450,14 +454,14 @@ $(sysup)" fi # try to use unionfs for rw access if available -if [ -n "${UNIONFS}" -o -n "${UNION}" ] ; then +if [ -n "${unionfs}" -o -n "${union}" ] ; then modprobe ${MODPRV} unionfs || { error "$init_loadufs" nonfatal - UNIONFS=""; } + unionfs=""; } fi # setup of client root filesystem dependent on the availability of UnionFS -if [ -n "${UNIONFS}" ] ; then +if [ -n "${unionfs}" ] ; then echo "Using UnionFS for rw access" mkdir -p ${rwdir}/union ${rwdir}/uniontmp /rorootfs mount -n -t tmpfs none ${rwdir}/uniontmp @@ -469,10 +473,10 @@ if [ -n "${UNIONFS}" ] ; then mount -n --move ${rwdir}/uniontmp /mnt/uniontmp chmod 0755 /mnt/uniontmp /mnt # if additional sources should be used for a combined root filesystem - # probably more sources should be merged into union (${UNION} is defined) + # probably more sources should be merged into union (${union} is defined) # allow more than one union?? - if [ -n "${UNION}" ] ; then - # for dir in "${UNION}"; do + if [ -n "${union}" ] ; then + # for dir in "${union}"; do # testmkd /unionadd/$dir # mount $dir unionadd/$dir # unionctl mnt --add --after /mnt --mode ro /unionadd/$dir @@ -485,7 +489,7 @@ if [ -n "${UNIONFS}" ] ; then for i in ${D_RCDIRS} ${D_INITBOOTD} ; do rm -f /mnt/etc/$i/* 2>/dev/null done -elif [ -z "${COWLOOP}" ] ; then +elif [ -z "${cowloop}" ] ; then echo "Using bind mounts to ramdisk for rw access" mount -n -t tmpfs -o size=${tmpfssize} ramfs ${rwdir} for path in ${D_BINDMPTS} ; do -- cgit v1.2.3-55-g7522