CVSROOT    : /cvsroot/undernet-ircu
Module     : ircu2.10
Branch tags: u2_10_11_03
Commit time: 2002-12-13 07:58:49 UTC

Modified files:
  Tag: u2_10_11_03
     tools/linesync/linesync.sh

Log message:

Author: Isomer <[EMAIL PROTECTED]>
Log message:

Updated linesync.sh

---------------------- diff included ----------------------
Index: ircu2.10/tools/linesync/linesync.sh
diff -u ircu2.10/tools/linesync/linesync.sh:1.1.2.2.6.1 
ircu2.10/tools/linesync/linesync.sh:1.1.2.2.6.2
--- ircu2.10/tools/linesync/linesync.sh:1.1.2.2.6.1     Wed Dec 11 11:55:12 2002
+++ ircu2.10/tools/linesync/linesync.sh Thu Dec 12 23:58:38 2002
@@ -68,13 +68,27 @@
 }
 
 # Try to find programs we will need
-locate_program wget && locate_program egrep && locate_program md5sum
+locate_program wget && locate_program egrep
 
 # try to find GNU awk
 awk_cmd=`which gawk`
-if [ $? ]; then
-       awk_cmd=""
+if [ $? -ne 0 ]; then
+        awk_cmd=""
 fi
+
+# try to find an appropriate md5 program
+# BSD md5 capability courtesy of spale
+md5_cmd=`which md5sum`
+if [ -z "$md5_cmd" ]; then
+       md5_cmd=`which md5`
+       if [ -z "$md5_cmd" ]; then
+               echo "No MD5 capable programs found (I looked for md5sum and md5)."
+               exit
+       else
+               md5_cmd="$md5_cmd -q"
+       fi
+fi
+
 if [ -z "$awk_cmd" ]; then
        locate_program awk
        is_gawk=`echo | awk --version | head -1 | egrep '^GNU.+$'`
@@ -164,7 +178,7 @@
 fi
 
 # Get the checksum
-CKSUM=`md5sum $TMPFILE|cut -d' ' -f1`
+CKSUM=`$md5_cmd $TMPFILE|cut -d' ' -f1`
 
 check_file="$tmp_path/linesync.sum.$TS"
 for ck_server in $LINE_CHECK; do
@@ -185,7 +199,7 @@
 # Replace the marked block in ircd.conf with the new version
 
 $awk_cmd ' 
-$0=="# BEGIN LINESYNC" { chop++; print $0; next }
+$0=="# BEGIN LINESYNC" { chop++; print; next }
 $0=="# END LINESYNC" {
         command="cat " syncfile
         while ((command | getline avar) > 0) { print avar }
----------------------- End of diff -----------------------

Reply via email to