diff options
Diffstat (limited to 'initramfs/initrd-stuff')
| -rwxr-xr-x | initramfs/initrd-stuff/bin/hwautocfg | 6 | ||||
| -rw-r--r-- | initramfs/initrd-stuff/etc/functions | 94 | ||||
| -rw-r--r-- | initramfs/initrd-stuff/etc/ldap-functions | 75 |
3 files changed, 87 insertions, 88 deletions
diff --git a/initramfs/initrd-stuff/bin/hwautocfg b/initramfs/initrd-stuff/bin/hwautocfg index c17df471..af8442a6 100755 --- a/initramfs/initrd-stuff/bin/hwautocfg +++ b/initramfs/initrd-stuff/bin/hwautocfg @@ -3,7 +3,7 @@ # universal (distro independent) hardware autoconfiguration script for # OpenSLX linux diskless clients, using hwconfig from knoppix as base tool # -# Dirk von Suchodoletz <dvs@OpenSLX.com>, 27-09-2006 +# Dirk von Suchodoletz <dvs@OpenSLX.com>, 07-10-2006 # # (c) 2003 - 2006 - RZ Universitaet Freiburg # (c) 2006 - OpenSLX.org Project @@ -141,8 +141,8 @@ for section in Files ServerFlags Module InputDevice Monitor \ Files) echo -e ${Files} >>$xfc # check for 64bit CPU/installation (fixme!!) - [ -n "$amd64" ] && \ - echo '"\tModulePath\t"/usr/X11R6/lib64/modules"\n' >>$xfc + [ -d "/mnt/usr/X11R6/lib64/modules" ] && \ + echo -e '\tModulePath\t"/usr/X11R6/lib64/modules"\n' >>$xfc for i in ${D_XFONTPATH} ; do echo -e "\tFontPath\t\"$i/\"" >>$xfc ; done ;; diff --git a/initramfs/initrd-stuff/etc/functions b/initramfs/initrd-stuff/etc/functions index bc9bc9b7..f4355e0f 100644 --- a/initramfs/initrd-stuff/etc/functions +++ b/initramfs/initrd-stuff/etc/functions @@ -82,7 +82,7 @@ else echo -e "${error_msg}${e_msg}${error_shell}" # load usb modules to have keyboard enabled - they might have to be # copied into initramfs with mkdxsinitramfs ... - modprobe -a usbcore uhci-hcd ohci-hcd usbhid 2>&1 >/dev/null + modprobe -a usbcore uhci-hcd ohci-hcd usbhid >/dev/null 2>&1 /bin/sh echo -n "Reboot now? [y]" read input @@ -96,8 +96,8 @@ fi ####################################################################### # system uptime for performance analysis sysup () { -uptime=$(sed -e "s, .*,,;s,\.,," /proc/uptime) -echo "${uptime} ms." +uptime=$(sed -e "s, .*,," /proc/uptime) +echo "${uptime} s." # if start times are kept, a summary of runtimes would be possible too } @@ -346,7 +346,7 @@ else loadmod /lib/modules/@@@KERNVER@@@/kernel/net/packet/af_packet.ko \ "needed for dhcp"; echo "Starting $dhcp for configuration" - mkdir /var/lib/dhcp 2>&1 >/dev/null + mkdir /var/lib/dhcp >/dev/null 2>&1 fi export client="$dhcp" case $dhcp in @@ -354,13 +354,13 @@ case $dhcp in mkdhclconf $vci ln -s /bin/dhcpmkconfig /bin/dhclient-script dhclient -cf /etc/dhclient.conf -lf /var/lib/dhcp/dhclient.leases \ - -q eth0 2>&1 >/dev/null || error "$error_dhclient" + -q eth0 >/dev/null 2>&1 || error "$error_dhclient" ;; dhcpcd) [ -n $vci ] && vci="-i $vci" ln -s /bin/dhcpmkconfig /bin/dhcpcd.exe dhcpcd $vci -L /var/lib/dhcp -c /bin/dhcpcd.exe -T -t 30 eth0 \ - 2>&1 >/dev/null || error "$error_dhcpcd" + >/dev/null 2>&1 || error "$error_dhcpcd" ;; pump) error "$error_pump" @@ -401,14 +401,14 @@ local dst=/tmp/$(basename $1) # tftp get part case "$tftp" in */atftp) - atftp -g -r $1 -l $dst $2 2>&1>/dev/null + atftp -g -r $1 -l $dst $2 >/dev/null 2>&1 ;; */tftp) # distinguish between busybox tftp and standalone (in.tftp) client if [ -x /bin/busybox ] ; then tftp -g -r $1 -l $dst $2 2>/dev/null else - echo "get $1 $dst" | tftp $2 2>&1>/dev/null + echo "get $1 $dst" | tftp $2 >/dev/null 2>&1 fi ;; esac @@ -462,7 +462,7 @@ echo "fileget via $srvproto finished" > /tmp/file-done # function for creating directories after testing of their existance # avoids to recreate directories in union mounts testmkd () { - test -d $1 || mkdir -p $1 &>/dev/null + test -d $1 || mkdir -p $1 >/dev/null 2>&1 } ####################################################################### @@ -525,82 +525,6 @@ echo "finished" > /tmp/ldcfg } ####################################################################### -# configuration via ldap -# get_timeranges: helper function for ldapconf, retrieving timeranges -# of machineconfig-objects under search base $1 (Host,Group,Default) -get_timeranges(){ -trquery=`ldapsearch -x -H ldap://$ldapserver -b $1 -D $user -w $pwd -LLL \ -"(objectclass=machineconfig)" Timerange|sed -n '/Tim*/p'|sed 's/TimeRange: /#/'` -} -# matching_timerange: helper function for ldapconf to get "most -# specific timerange" matching actual time -matching_timerange(){ -match=0 -lines=$[`echo $trquery | sed 's/#/\n#/g'|wc -l` -1] -for ((i=0;i<$lines;i++)) ; do - timerange[$i]=`echo $trquery | cut -d "#" -f $[$i+2] | sed 's/ //g'` -done -while true ; do - for ((i=0;i<$lines;i++)) ; do - trday=`echo ${timerange[i]} | cut -d "_" -f 1` - trbegin=`echo ${timerange[i]} | cut -d "_" -f 2` - trend=`echo ${timerange[i]} | cut -d "_" -f 3` - if [ $trday == $wday ] && [ $trday != "X" ] && [ $trbegin != "X" ] && \ - [ $trbegin -le $time ] && [ $time -le $trend ]; then - echo $wday $time "[D H H]match ->" ${timerange[i]} - tr=${timerange[i]} - match=1 && break - fi - done - if [ $match == 1 ] ; then break ; fi - for ((i=0;i<$lines;i++)) ; do - trday=`echo ${timerange[i]} | cut -d "_" -f 1` - trbegin=`echo ${timerange[i]} | cut -d "_" -f 2` - trend=`echo ${timerange[i]} | cut -d "_" -f 3` - if [ $trday == $wday ] && [ $trbegin == "X" ] && [ $trend == "X" ]; then - echo $wday $time "[D _ _]match ->" ${timerange[i]} - tr=${timerange[i]} - match=1 && break - fi - done - if [ $match == 1 ] ; then break ; fi - for ((i=0;i<$lines;i++)) ; do - trday=`echo ${timerange[i]} | cut -d "_" -f 1` - trbegin=`echo ${timerange[i]} | cut -d "_" -f 2` - trend=`echo ${timerange[i]} | cut -d "_" -f 3` - if [ $trday == "X" ] && [ $trbegin != "X" ] && [ $trbegin -le $time ] && \ - [ $time -le $trend ]; then - echo $wday $time "[_ H H]match ->" ${timerange[i]} - tr=${timerange[i]} - match=1 && break - else - if [ ${timerange[$i]} == "X_X_X" ]; then - echo $wday $time "[_ _ _]match ->" ${timerange[i]} - tr="X_X_X" && match=1 - else - match=0 - fi - fi - done - if [ $match == 1 ] || [ $match == 0 ] ; then break ; fi -done -} -# get_machineconfig: helper function for ldapconf, writing machine -# config data of one timerange $tr into file "tmp/confvialdap/$tr" -get_machineconfig(){ -ldapsearch -x -H ldap://$ldapserver -b $1 -D $user -w $pwd -LLL \ -"(&(objectclass=machineconfig)(timerange=$tr))"|sed '/dn:/d'|sed '/ou=/d'|\ -sed '/dc=/d'|sed '/objectC*/d'|sed '/Tim*/d'|sed '/cn:/d'|sed '/desc*/d'|sed \ -'s/: /=/g'|sed 's/-/_/g' > tmp/confvialdap/$tr -} - -ldapconf () { -local ldapserver=$1 -error "$error_ldapcfg" -echo "not implemented" > /tmp/ldap-done -} - -####################################################################### # base passwd/shadow, the standard user present in every system. All # other system users should be generated within the service function basepasswd () { diff --git a/initramfs/initrd-stuff/etc/ldap-functions b/initramfs/initrd-stuff/etc/ldap-functions new file mode 100644 index 00000000..d2b6753e --- /dev/null +++ b/initramfs/initrd-stuff/etc/ldap-functions @@ -0,0 +1,75 @@ +####################################################################### +# configuration via ldap +# get_timeranges: helper function for ldapconf, retrieving timeranges +# of machineconfig-objects under search base $1 (Host,Group,Default) +get_timeranges(){ +trquery=`ldapsearch -x -H ldap://$ldapserver -b $1 -D $user -w $pwd -LLL \ +"(objectclass=machineconfig)" Timerange|sed -n '/Tim*/p'|sed 's/TimeRange: /#/'` +} +# matching_timerange: helper function for ldapconf to get "most +# specific timerange" matching actual time +matching_timerange(){ +match=0 +lines=$[`echo $trquery | sed 's/#/\n#/g'|wc -l` -1] +for ((i=0;i<$lines;i++)) ; do + timerange[$i]=`echo $trquery | cut -d "#" -f $[$i+2] | sed 's/ //g'` +done +while true ; do + for ((i=0;i<$lines;i++)) ; do + trday=`echo ${timerange[i]} | cut -d "_" -f 1` + trbegin=`echo ${timerange[i]} | cut -d "_" -f 2` + trend=`echo ${timerange[i]} | cut -d "_" -f 3` + if [ $trday == $wday ] && [ $trday != "X" ] && [ $trbegin != "X" ] && \ + [ $trbegin -le $time ] && [ $time -le $trend ]; then + echo $wday $time "[D H H]match ->" ${timerange[i]} + tr=${timerange[i]} + match=1 && break + fi + done + if [ $match == 1 ] ; then break ; fi + for ((i=0;i<$lines;i++)) ; do + trday=`echo ${timerange[i]} | cut -d "_" -f 1` + trbegin=`echo ${timerange[i]} | cut -d "_" -f 2` + trend=`echo ${timerange[i]} | cut -d "_" -f 3` + if [ $trday == $wday ] && [ $trbegin == "X" ] && [ $trend == "X" ]; then + echo $wday $time "[D _ _]match ->" ${timerange[i]} + tr=${timerange[i]} + match=1 && break + fi + done + if [ $match == 1 ] ; then break ; fi + for ((i=0;i<$lines;i++)) ; do + trday=`echo ${timerange[i]} | cut -d "_" -f 1` + trbegin=`echo ${timerange[i]} | cut -d "_" -f 2` + trend=`echo ${timerange[i]} | cut -d "_" -f 3` + if [ $trday == "X" ] && [ $trbegin != "X" ] && [ $trbegin -le $time ] && \ + [ $time -le $trend ]; then + echo $wday $time "[_ H H]match ->" ${timerange[i]} + tr=${timerange[i]} + match=1 && break + else + if [ ${timerange[$i]} == "X_X_X" ]; then + echo $wday $time "[_ _ _]match ->" ${timerange[i]} + tr="X_X_X" && match=1 + else + match=0 + fi + fi + done + if [ $match == 1 ] || [ $match == 0 ] ; then break ; fi +done +} +# get_machineconfig: helper function for ldapconf, writing machine +# config data of one timerange $tr into file "tmp/confvialdap/$tr" +get_machineconfig(){ +ldapsearch -x -H ldap://$ldapserver -b $1 -D $user -w $pwd -LLL \ +"(&(objectclass=machineconfig)(timerange=$tr))"|sed '/dn:/d'|sed '/ou=/d'|\ +sed '/dc=/d'|sed '/objectC*/d'|sed '/Tim*/d'|sed '/cn:/d'|sed '/desc*/d'|sed \ +'s/: /=/g'|sed 's/-/_/g' > tmp/confvialdap/$tr +} + +ldapconf () { +local ldapserver=$1 +error "$error_ldapcfg" +echo "not implemented" > /tmp/ldap-done +} |
