Package: fai-client
Version: 3.2.4+svn4837-0ubuntu2.1
Severity: wishlist
Tags: patch

We use the command 'fai softupdate' in a daily cronjob to keep our
systems up to date. Right now for every softupdate run, fai prints out
alot of messages although it ran without errors. 
We modified files in our local site. I attach a patch including the
dirty/quick modifications. Regard this patch as a starting point for
a proper implementation please.


-- System Information:
Debian Release: lenny/sid
  APT prefers hardy-updates
  APT policy: (500, 'hardy-updates'), (500, 'hardy-security'), (500, 'hardy')
Architecture: i386 (i686)

Kernel: Linux 2.6.24-24-generic (SMP w/1 CPU core)
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/bash

Versions of packages fai-client depends on:
ii  file                   4.21-3ubuntu2     Determines file type using "magic"
ii  libapt-pkg-perl        0.1.21build3      Perl interface to libapt-pkg
ii  perl                   5.8.8-12ubuntu0.4 Larry Wall's Practical Extraction 

Versions of packages fai-client recommends:
ii  debconf-utils                 1.5.20     debconf utilities

-- no debconf information
--- bin/fai-do-scripts  2008-02-14 10:49:35.000000000 +0100
+++ bin_ea/fai-do-scripts       2009-08-04 16:19:39.000000000 +0200
@@ -54,12 +54,16 @@
 
     if [ $st -eq 0 ]; then
        res="OK."
+        # put result in the log file 
+        printf "%-20s $res\n" $cmd >> $LOGDIR/status.log
+
     else
        res="FAILED with exit code $st."
        savemaxstatus $st
+       printf "%-20s $res\n" $cmd  >>  $LOGDIR/status.log
+        printf "%-20s $res\n" $cmd 1>&2 
+
     fi
-    # put result in the log file and write to stdout
-    printf "%-20s $res\n" $cmd | tee -a $LOGDIR/status.log
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 call_conf() {
@@ -113,7 +117,7 @@
     case $filetype in
 
        *"POSIX shell script"*|*"executable shell script"*|*"/bash 
script"*|*"Bourne shell script"*|*"Bourne-Again shell script"*)
-           echo "Executing   $shelldebug shell: $file"
+#          echo "Executing   $shelldebug shell: $file"
            echo "=====   shell: $file   =====" >> $LOGDIR/shell.log 2>&1
            $shelldebug ./$file >> $LOGDIR/shell.log 2>&1
            fc_check_status $file $? | tee -a $LOGDIR/shell.log
--- bin/fai     2009-08-05 09:49:09.000000000 +0200
+++ bin_ea/fai  2009-08-04 15:03:56.000000000 +0200
@@ -131,15 +132,15 @@
 
     # these tasks can define variables, that are needed later
     [ -n "$etc_message" ] && echo ""
-    echo "$etc_message"
-    [ $do_init_tasks -eq 1 ] || echo "Using configuration files from 
$FAI_ETC_DIR"
-    unset etc_message
-    task confdir
-    task setup
-    task defclass
+    echo "$etc_message" > /dev/null
+    [ $do_init_tasks -eq 1 ] || echo "Using configuration files from 
$FAI_ETC_DIR" 
+    unset etc_message 
+    task confdir > /dev/null
+    task setup > /dev/null
+    task defclass > /dev/null
     unset cmdlineclasses renewclass
     [ $do_init_tasks -eq 1 ] && set_disk_info
-    task defvar
+    task defvar > /dev/null
     [ $do_init_tasks -eq 1 ] && load_keymap_consolechars
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
@@ -278,7 +279,7 @@
 chgrp adm  $LOGDIR
 chmod 0750 $LOGDIR
 
-fai_init
+fai_init 1> /dev/null
 if [ X$action = Xdirinstall ]; then
     [ -n "$newhostname" ] && echo "Hostname set to $HOSTNAME" | tee -a 
$LOGDIR/fai.log
     unset newhostname
@@ -298,7 +299,7 @@
 mkfifo $LOGDIR/logfifo
 tee -a $LOGDIR/fai.log < $LOGDIR/logfifo &
 # in bash &> redirect stdout and stderr to file
-fstart &> $LOGDIR/logfifo
+fstart &> $LOGDIR/logfifo > /dev/null
 rm $LOGDIR/logfifo
 sleep 1 # wait for tee to complete. One second should be ok
 # old code
@@ -318,4 +319,4 @@
 
 [ -L "/var/run/fai/current_config" ] && rm -f "/var/run/fai/current_config"
 
-echo "End of $0"
+echo "End of $0" > /dev/null
--- bin/install_packages        2008-02-14 10:49:35.000000000 +0100
+++ bin_ea/install_packages     2009-08-04 16:02:13.000000000 +0200
@@ -65,7 +65,7 @@
 $| = 1;
 # order of commands to execute
 
-my $aptopt='-y -o Dpkg::Options::="--force-confdef" -o 
Dpkg::Options::="--force-confold"';
+my $aptopt='-q=2 -y -o Dpkg::Options::="--force-confdef" -o 
Dpkg::Options::="--force-confold"';
 @commands = qw/y2i y2r yast rpmr urpmi urpme yumgroup yumi yumr smarti smartr 
hold taskrm taskinst clean-internal aptitude aptitude-r install unpack remove 
dselect-upgrade/;
 %command = (
           "install" => "apt-get $aptopt --fix-missing install",
@@ -128,7 +128,7 @@
   $cache = new AptPkg::Cache;
 }
 
-warn "$0: reading config files from directory $classpath\n";
+# warn "$0: reading config files from directory $classpath\n";
 # read all package config files
 foreach (@classes) {
   &readconfig($classpath,$_) if -f "$classpath/$_";
--- lib/subroutines     2009-08-05 09:49:09.000000000 +0200
+++ lib_ea1/subroutines 2009-08-04 16:25:56.000000000 +0200
@@ -140,7 +140,7 @@
        [ "$verbose" ] && echo "Skiping task_$taskname"
        sendmon "TASKSKIP $taskname"
     else
-       echo "Calling task_$taskname"
+       #echo "Calling task_$taskname"
        sendmon "TASKBEGIN $taskname"
        task_error=0   # task can set this variable to indicate an error
        task_error_func=''
@@ -272,7 +272,7 @@
        task_faiend
        exit 
     fi
-    echo "FAI_ACTION: $FAI_ACTION"
+    [ "softupdate" = $FAI_ACTION ] || echo "FAI_ACTION: $FAI_ACTION"
     case $FAI_ACTION in
 
        install)
@@ -291,7 +291,8 @@
            task dirinstall
            ;;
        softupdate)
-           echo Performing FAI system update. All data may be overwritten!
+# ea
+#          echo Performing FAI system update. All data may be overwritten!
            task softupdate
            ;;
        sysinfo)
@@ -541,19 +542,19 @@
     defnop wait_for_jobs
     save_dmesg
 
-    task mirror
-    task debconf
-    task updatebase
-    task instsoft
-    task configure
-    date
-    echo "The $FAI_ACTION took $(expr $(cut -d . -f 1 /proc/uptime) - 
$start_seconds) seconds."
+    task mirror  #1> /dev/null
+    task debconf #1> /dev/null
+    task updatebase 
+    task instsoft 
+    task configure 
+    # date
+    # echo "The $FAI_ACTION took $(expr $(cut -d . -f 1 /proc/uptime) - 
$start_seconds) seconds."
 
 
     rm -f $stamp
     # save again, because new messages could be created
     save_dmesg
-    task savelog
+    task savelog  > /dev/null
 
     if [ -f $stamp ]; then
        echo "Error while executing commands in subshell."
--- lib/subroutines-linux       2009-08-05 09:49:09.000000000 +0200
+++ lib_ea1/subroutines-linux   2009-08-04 15:42:56.000000000 +0200
@@ -232,13 +232,15 @@
 task_updatebase() {
 
     # maybe the base system is not up to date
-    echo "Updating base"
+    [ $FAI_ACTION = "softupdate" ] ||  echo "Updating base"
     updatebase
 }
 # - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
 task_instsoft() {
 
-    echo "Installing software may take a while"
+    #echo "Installing software may take a while"
+       #supertmp="$verbose"
+       #verbose=1
     if [ "$debug" ]; then
        install_packages | tee -a $LOGDIR/software.log
        task_error 471 $?
@@ -246,9 +248,13 @@
        install_packages </dev/null 2>&1 | tee -a $LOGDIR/software.log
        task_error 471 $?
     else
-       install_packages </dev/null >> $LOGDIR/software.log 2>&1
+       #echo "ich bin hier im 3. if!" >> $LOGDIR/software.log
+       #install_packages </dev/null >> $LOGDIR/software.log 2>&1
+#      install_packages </dev/null 1>> $LOGDIR/software.log
+       install_packages </dev/null 2>&1 | tee -a $LOGDIR/software.log 
        task_error 471 $?
     fi
+#      verbose="$supertmp"
     # This almost indicates an error
     egrep "^E:" $LOGDIR/software.log && task_error 472
     grep "Couldn't find any package whose name or description matched" 
$LOGDIR/software.log && task_error 321
--- lib/updatebase      2008-02-14 10:49:35.000000000 +0100
+++ lib_ea1/updatebase  2009-08-04 15:58:10.000000000 +0200
@@ -23,24 +23,25 @@
 
 # update the apt-get information inside the nfsroot 
 
-export aptopt='-y -o Dpkg::Options::="--force-confdef" -o 
Dpkg::Options::="--force-confold"'
+export aptopt='-q=2 -y -o Dpkg::Options::="--force-confdef" -o 
Dpkg::Options::="--force-confold"'
 $ROOTCMD apt-get $aptopt update
 $ROOTCMD apt-get $aptopt check
 [ $? -ne 0 ] && $ROOTCMD apt-get $aptopt -f install </dev/null 
 $ROOTCMD dpkg -C
 [ $? -ne 0 ] && yes '' | $ROOTCMD dpkg --configure -a 
 # using the above value, causes an error: "dpkg need action"
-export aptopt=
+export aptopt='-q=2 '
 # this may be removed in lenny
-if $ROOTCMD aptitude --help | grep -q safe-upgrade; then
-    $ROOTCMD aptitude -y safe-upgrade
-else
-    $ROOTCMD aptitude -y upgrade
-fi
+#if $ROOTCMD aptitude --help | grep -q safe-upgrade; then
+ #   $ROOTCMD aptitude $aptopt -y safe-upgrade
+#else
+#    $ROOTCMD aptitude $aptopt -y upgrade
+#fi
+$ROOTCMD apt-get $aptopt -y upgrade
 
-$ROOTCMD aptitude $aptopt -f -y dist-upgrade </dev/null
+$ROOTCMD apt-get  $aptopt -f -y dist-upgrade </dev/null
 # update dpkg info which packages are available
 tmp=$($ROOTCMD mktemp)
 $ROOTCMD apt-cache dumpavail > $FAI_ROOT/$tmp
-$ROOTCMD dpkg --update-avail $tmp
+$ROOTCMD dpkg --update-avail $tmp 1>/dev/null
 rm -f $FAI_ROOT/$tmp

Reply via email to