Author: glen                         Date: Thu Jul 28 13:12:28 2005 GMT
Module: SOURCES                       Tag: HEAD
---- Log message:
- script to verify rc-scripts.db.txt

---- Files affected:
SOURCES:
   scan-rc-scripts.db.sh (NONE -> 1.1)  (NEW)

---- Diffs:

================================================================
Index: SOURCES/scan-rc-scripts.db.sh
diff -u /dev/null SOURCES/scan-rc-scripts.db.sh:1.1
--- /dev/null   Thu Jul 28 15:12:28 2005
+++ SOURCES/scan-rc-scripts.db.sh       Thu Jul 28 15:12:23 2005
@@ -0,0 +1,42 @@
+#!/bin/sh
+# verifies *.init script chkconfig lines with rc-scripts.db.txt
+# this script must be run from directory whose CVS/Repository is 'SOURCES'
+# the rc-scripts.db.txt copy from cvs must reside in 
../PLD-doc/rc-scripts.db.txt
+#
+# 2005-07-28 [EMAIL PROTECTED]
+
+if [ ! -f SOURCES ]; then
+       wget http://cvs.pld-linux.org/cgi-bin/cvsweb/SOURCES
+       cvs up `grep '\.init"' SOURCES | perl -ne '/">(.+)</ and print "$1\n"'`
+fi
+
+startlevels=$(sed -e '/./{H;$!d;}' -e 'x;/Start/!d' 
../PLD-doc/rc-scripts.db.txt)
+stoplevels=$(sed -e '/./{H;$!d;}' -e 'x;/Stop/!d' ../PLD-doc/rc-scripts.db.txt)
+
+for a in *.init; do
+       svc=$(basename $a .init)
+
+       db_start=$(echo "$startlevels" | awk "\$2==\"$svc\"{print \$1}")
+       db_stop=$(echo "$stoplevels" | awk "\$2==\"$svc\"{print \$1}")
+       if [ -z "$db_start" ] || [ -z "$db_stop" ]; then
+               echo "$svc: missing from db"
+               continue
+       fi
+
+       start=$(awk '/^# chkconfig:/{print $4}' $a)
+       stop=$(awk '/^# chkconfig:/{print $5}' $a)
+       if [ "$start" != "$db_start" ]; then
+               if [ "$(echo "$db_start" | wc -l)" -gt 1 ]; then
+                       echo "$svc: duplicates: "$db_start
+               else
+                       echo "$svc: start mismatch: rc:$start db:$db_start"
+               fi
+       fi
+       if [ "$stop" != "$db_stop" ]; then
+               if [ "$(echo "$db_stop" | wc -l)" -gt 1 ]; then
+                       echo "$svc: duplicates: "$db_stop
+               else
+                       echo "$svc: stop mismatch: rc:$stop db:$db_stop"
+               fi
+       fi
+done
================================================================
_______________________________________________
pld-cvs-commit mailing list
[email protected]
http://lists.pld-linux.org/mailman/listinfo/pld-cvs-commit

Reply via email to