diff options
Diffstat (limited to 'initramfs/initrd-stuff/etc/functions')
-rw-r--r-- | initramfs/initrd-stuff/etc/functions | 94 |
1 files changed, 9 insertions, 85 deletions
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 () { |