[Lunar-commits] CVS: theedge/var/lib/lunar/functions check.lunar, 1.22, 1.23 modules.lunar, 1.51, 1.52 recovery.lunar, 1.8, 1.9

Auke Kok sofar at lunar-linux.org
Sun Mar 20 16:53:05 UTC 2005


Update of /var/cvs/lunar/theedge/var/lib/lunar/functions
In directory espresso.foo-projects.org:/tmp/cvs-serv22173/var/lib/lunar/functions

Modified Files:
	check.lunar modules.lunar recovery.lunar 
Log Message:
Reworking some checks and code to be more consistent in using base functions, rewrite md5sum_check slightly


Index: check.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/check.lunar,v
retrieving revision 1.22
retrieving revision 1.23
diff -u -d -r1.22 -r1.23
--- check.lunar	20 Mar 2005 14:57:00 -0000	1.22
+++ check.lunar	20 Mar 2005 16:53:02 -0000	1.23
@@ -166,58 +166,41 @@
 
 md5sum_check()  {
   debug_msg "md5sum_check ($@)"
-  if  [  "$MD5SUM_CHECK"  ==  "off"  ];  then
+  if [ "$MD5SUM_CHECK" == "off" ]; then
     return
   fi
 
   MODULE=$1
-  VERSION=`installed_version  $MODULE`
+  VERSION=$(installed_version $MODULE)
   MD5_LOG="$MD5SUM_LOGS/$MODULE-$VERSION"
-
   MD5SUM_STATUS=0
 
-  if  [  -e  "$MD5_LOG"  ];  then
+  if [ -e "$MD5_LOG" ]; then
     IFS_OLD="$IFS"
-    export  IFS="	
+    export IFS="	
 "
 
-    OUTPUT=`cat  $MD5_LOG                                         |
-            grep      "/bin/\|/games/\|/include/\|/lib/\|/sbin/"  |
-            grep  -v  "/doc/\|/etc/\|/fonts/\|/man/\|/var/"       |
-            md5sum  --check  2>/dev/null                          |    
-            grep   -v       ": OK"                                |
-            cut    -d :  -f1`
+    OUTPUT=$(cat $MD5_LOG                                         |
+            grep "/bin/\|/games/\|/include/\|/lib/\|/sbin/"       |
+            grep -v "/doc/\|/etc/\|/fonts/\|/man/\|/var/"         |
+            md5sum --check 2>/dev/null | grep -v ": OK" | cut -d: -f1)
 
-    if  [  -n  "$OUTPUT"  ];  then
-      for  FILE  in  $OUTPUT;  do
-        if  [     -f  "$FILE"  ]  &&
-            [  !  -h  "$FILE"  ]  &&
-            file  -b  "$FILE"     |
-            egrep  -q  "executable|shared object|current ar archive"
-        then
-          MD5SUM=`md5sum  $FILE`
-          if  !  grep  -q  "$MD5SUM"  $MD5SUM_LOGS/*;  then
-            (  export  IFS="$IFS_OLD"
-               message  "${FILE_COLOR}${FILE}"               \
-                        "${DEFAULT_COLOR}of"                 \
-                        "${MODULE_COLOR}${MODULE}"           \
-                        "${PROBLEM_COLOR}has wrong md5sum."  \
-                        "${DEFAULT_COLOR}"
-            )
+    if [ -n "$OUTPUT" ]; then
+      for FILE in $OUTPUT; do
+        if [ -f "$FILE" ] && [ ! -h "$FILE" ] && file -b "$FILE" |
+		    egrep -q "executable|shared object|current ar archive" ; then
+          MD5SUM=$(md5sum "$FILE")
+          if ! grep -q "$MD5SUM" $MD5SUM_LOGS/*; then
+            message "${FILE_COLOR}$FILE${DEFAULT_COLOR} of ${MODULE_COLOR}$MODULE${PROBLEM_COLOR} has wrong md5sum.${DEFAULT_COLOR}"
             MD5SUM_STATUS=1
           fi
         fi
       done
     fi
   else
-    (  export  IFS="$IFS_OLD"  
-       message  "${MODULE_COLOR}${MODULE} "                 \
-                "${PROBLEM_COLOR}is missing a md5sum log."  \
-                "${DEFAULT_COLOR}"
-    )
-    MD5SUM_STATUS=1
+    message "${MODULE_COLOR}$MODULE${PROBLEM_COLOR}is missing a md5sum log.${DEFAULT_COLOR}"
   fi
-  return  $MD5SUM_STATUS
+  return $MD5SUM_STATUS
 }
 
 

Index: modules.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/modules.lunar,v
retrieving revision 1.51
retrieving revision 1.52
diff -u -d -r1.51 -r1.52
--- modules.lunar	16 Nov 2004 15:02:09 -0000	1.51
+++ modules.lunar	20 Mar 2005 16:53:02 -0000	1.52
@@ -400,13 +400,7 @@
   unlock_file $MODULE_STATUS_BACKUP                            &&
 
   if [ -n "$EXILE" ] ; then
-     lock_file $MODULE_STATUS_BACKUP                     &&
-     lock_file $MODULE_STATUS                            && 
-     echo  "$1::exiled:0.0"  >>  $MODULE_STATUS          &&
-     cat  $MODULE_STATUS      >  $MODULE_STATUS_BACKUP   &&
-     unlock_file $MODULE_STATUS                          &&
-     unlock_file $MODULE_STATUS_BACKUP                   &&
-
+     exile_modules "$1"                                  &&
      lock_file $DEPENDS_STATUS_BACKUP                    &&
      lock_file $DEPENDS_STATUS                           &&
      grep  -v  ":$1:" $DEPENDS_STATUS_BACKUP  >   $DEPENDS_STATUS  &&
@@ -429,10 +423,9 @@
   fi
 
   verbose_msg "updating lunar state files after module installation"
+  remove_module "$1"                                          &&
   lock_file $MODULE_STATUS_BACKUP                             &&
   lock_file $MODULE_STATUS                                    &&
-  # the next statement MUST be allowed to fail if statfiles are empty:
-  grep -v "^$1:" $MODULE_STATUS_BACKUP > $MODULE_STATUS 2>/dev/null
   echo "$1:$(date -u +%Y%m%d):$2:$3:$4" >> $MODULE_STATUS     &&
   cp $MODULE_STATUS $MODULE_STATUS_BACKUP                     &&
   unlock_file $MODULE_STATUS                                  &&

Index: recovery.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/recovery.lunar,v
retrieving revision 1.8
retrieving revision 1.9
diff -u -d -r1.8 -r1.9
--- recovery.lunar	9 Mar 2005 15:26:46 -0000	1.8
+++ recovery.lunar	20 Mar 2005 16:53:02 -0000	1.9
@@ -51,16 +51,17 @@
         VERSION=$(echo $MODULE_NAME | cut -d "-" -f "$COUNTS"-)
         SIZE=$(find_module_size $REAL_NAME $VERSION)
         DATE=$(ls -l $INSTALL_LOGS/$REAL_NAME-$VERSION --time-style=+%Y%m%d | awk '{print $6}')
+        remove_module "$REAL_NAME" &&
+        # adjusted add_module code that echos the DATE field ;^)
         lock_file $MODULE_STATUS &&
         lock_file $MODULE_STATUS_BACKUP &&
-        # adjusted add_module code that echos the DATE field ;^)
-        grep -v "^$REAL_NAME:" $MODULE_STATUS_BACKUP >$MODULE_STATUS 2>/dev/null &&
         echo "$REAL_NAME:$DATE:installed:$VERSION:$SIZE" >>$MODULE_STATUS &&
         cat $MODULE_STATUS >$MODULE_STATUS_BACKUP &&
         unlock_file $MODULE_STATUS_BACKUP &&
-        unlock_file $MODULE_STATUS
+        unlock_file $MODULE_STATUS &&
+
         message "Added: $REAL_NAME-$VERSION ($SIZE) ($DATE)"
-        break;
+        break
       fi
       ((COUNTS--))
     done



More information about the Lunar-commits mailing list