[Fai-commit] r5868 - in trunk: debian lib

Thomas Lange lange at alioth.debian.org
Mon Jul 26 19:49:33 UTC 2010


Author: lange
Date: 2010-07-26 19:49:26 +0000 (Mon, 26 Jul 2010)
New Revision: 5868

Modified:
   trunk/debian/changelog
   trunk/lib/fai-savelog
Log:
fai-savelog: add messages, if some variables are not defined,
minor code cleanup

Modified: trunk/debian/changelog
===================================================================
--- trunk/debian/changelog	2010-07-23 18:43:07 UTC (rev 5867)
+++ trunk/debian/changelog	2010-07-26 19:49:26 UTC (rev 5868)
@@ -47,6 +47,8 @@
     Parser.pm,Sizes.pm,Volumes.pm: add $Id$
   * savelog.LAST: ignore ACPI Warning
   * control: fix duplicate Depends on iproute
+  * fai-savelog: add messages, if some variables are not defined,
+    minor code cleanup
 
   [ Michael Tautschnig ]
   * control: Move setup-storage to its own package (fai-setup-storage). Thanks

Modified: trunk/lib/fai-savelog
===================================================================
--- trunk/lib/fai-savelog	2010-07-23 18:43:07 UTC (rev 5867)
+++ trunk/lib/fai-savelog	2010-07-26 19:49:26 UTC (rev 5868)
@@ -6,7 +6,7 @@
 # fai-save-log -- save log files from fai to a local or remote location
 #
 # This script is part of FAI (Fully Automatic Installation)
-# (c) 2002-2007 by Thomas Lange, lange at informatik.uni-koeln.de
+# (c) 2002-2010 by Thomas Lange, lange at informatik.uni-koeln.de
 # Universitaet zu Koeln
 #
 #*********************************************************************
@@ -48,8 +48,7 @@
 
     mkdir -p $thislog
     cp -a $LOGDIR/* $thislog
-    chown root $thislog
-    chgrp adm  $thislog
+    chown root:adm $thislog
     chmod 0750 $thislog
     ln -snf $HOSTNAME $logbase/localhost
     ln -snf $FAI_ACTION-$fai_rundate $logbase/$HOSTNAME/last-$FAI_ACTION
@@ -59,7 +58,7 @@
 save_log_remote_shell() {
 
     local thislogdir
-    if [ -n "$LOGREMOTEDIR" ];then
+    if [ -n "$LOGREMOTEDIR" ]; then
 	thislogdir=$LOGREMOTEDIR/$HOSTNAME/
     else
 	thislogdir=$HOSTNAME/
@@ -69,11 +68,10 @@
     thislog=$thislogdir/$FAI_ACTION-$fai_rundate
 
     echo "Save log files via $remotesh to $LOGUSER@$LOGSERVER:$thislog"
-    find $LOGDIR -size 0 -type f -exec rm {} \;
+    find $LOGDIR -xdev -size 0 -type f -exec rm {} \;
     $remotesh -l $LOGUSER $LOGSERVER " \
        mkdir -p $thislog ;\
        cd $thislogdir ;\
-       rm -f last-$FAI_ACTION ;\
        ln -snf $FAI_ACTION-$fai_rundate last-$FAI_ACTION ;\
        ln -snf $FAI_ACTION-$fai_rundate last"
 
@@ -87,10 +85,16 @@
     # last action. The name of the log directory contains date and
     # time of the action performed
 
-    [ "$LOGUSER" ] || return
+    if [ -z "$LOGUSER" ]; then
+	echo "\$LOGUSER is undefined. Not saving log files to remote."
+	return
+    fi
     # LOGSERVER is overridable until now
     : ${LOGSERVER:=$SERVER}
-    [ "$LOGSERVER" ] || return
+    if [ -z "$LOGSERVER" ]; then
+	echo "\$LOGSERVER is undefined. Not saving log files to remote."
+	return
+    fi
 
     case "$FAI_LOGPROTO" in
 	ftp)
@@ -113,14 +117,13 @@
     cat <<EOF
 fai-savelog, save log files from fai to a local or remote location
 
-   Copyright (C) 2002-2009 by Thomas Lange
+   Copyright (C) 2002-2010 by Thomas Lange
 
 Usage: fai-savelog [OPTION]
 
    -r       Save log files to \$LOGSERVER using rcp or scp
    -l       Save log files to local directory \$FAI_ROOT/var/log/fai
 
-Report bugs to <lange at informatik.uni-koeln.de>.
 EOF
 exit 0
 }




More information about the Fai-commit mailing list