CVS: theedge/sbin lget,1.20,1.21 lin,1.59,1.60 lrm,1.16,1.17

sofar at lunar-linux.org sofar at lunar-linux.org
Mon Jul 28 21:51:53 GMT 2003


Update of /var/cvs/lunar/theedge/sbin
In directory dbguin.lunar-linux.org:/tmp/cvs-serv4782/sbin

Modified Files:
	lget lin lrm 
Log Message:
adding uniformly the --debug option. If you specify it twice it will dump VARs (and BTW make a huge mess in /tmp too). small oops in create_install_logs. rewrite of lrm to make it look like someone paid attention.

QOTD:
Be careful when you bite into your hamburger.
                -- Derek Bok


Index: lget
===================================================================
RCS file: /var/cvs/lunar/theedge/sbin/lget,v
retrieving revision 1.20
retrieving revision 1.21
diff -u -d -r1.20 -r1.21
--- lget	13 Jul 2003 20:49:54 -0000	1.20
+++ lget	28 Jul 2003 21:51:51 -0000	1.21
@@ -60,6 +60,7 @@
          --from)  SOURCE_CACHE=$2;  shift 2  ;;
          --help)  help;             exit  1  ;;
           --url)  BASE_URL="$2";    shift 2  ;;
+        --debug)  (( LUNAR_DEBUG++ )) ; export LUNAR_DEBUG; shift 1 ;;
               *)  help                       ;;
       esac
 
@@ -72,24 +73,20 @@
 
 
 strip_parameters()  {
-
-  while  [  -n  "$1"  ];  do
-
-    if  echo  "" $1  |  grep  -q  "^ -";  then
-
-      case  $1  in
+  while [ -n "$1" ] ; do
+    if echo "" $1 | grep -q "^ -" ; then
+      case $1 in
         --from)  shift 2  ;;
         --help)  shift 1  ;;
          --url)  shift 2  ;;
+       --debug)  shift 1  ;;
              *)  shift 1  ;;
       esac
-
-    else  echo  $1
-          shift 
+    else
+      echo $1
+      shift 
     fi
-
   done
-
 }
 
 

Index: lin
===================================================================
RCS file: /var/cvs/lunar/theedge/sbin/lin,v
retrieving revision 1.59
retrieving revision 1.60
diff -u -d -r1.59 -r1.60
--- lin	28 Jul 2003 17:40:42 -0000	1.59
+++ lin	28 Jul 2003 21:51:51 -0000	1.60
@@ -74,11 +74,12 @@
                 -f|--fix)  export FIX="$1";            shift 1  ;;
               -n|--nofix)  export FIX="--fix"
                            export NOFIX="$1";          shift 1  ;;
-	 -d|--fixdepends)  export FIXDEPENDS="$1";
+	 -d|--fixdepends)  export FIXDEPENDS="$1"
 	 		   export FIX="$1";            shift 1  ;;
                       -s)  export SEPARATE="$1";       shift 1  ;;
                    --url)  export BASE_URL="$2";       shift 2  ;;
-                 --debug)  export LUNAR_DEBUG=on;      shift    ;;
+                 --debug)  (( LUNAR_DEBUG++ )) 
+		           export LUNAR_DEBUG;         shift 1  ;;
                    --pam)  lin -c $(find_pam_aware);   shift 1  ;;
                        *)  help                                 ;;
       esac
@@ -94,6 +95,7 @@
     if  echo  "" $1  |  grep  -q  "^ -";  then
       case  $1  in
                   --deps)  shift 1  ;;
+ 		 --debug)  shift 1  ;;
         -r|--reconfigure)  shift 1  ;;
                   --from)  shift 2  ;;
                 --silent)  shift 1  ;;

Index: lrm
===================================================================
RCS file: /var/cvs/lunar/theedge/sbin/lrm,v
retrieving revision 1.16
retrieving revision 1.17
diff -u -d -r1.16 -r1.17
--- lrm	28 Jul 2003 17:40:42 -0000	1.16
+++ lrm	28 Jul 2003 21:51:51 -0000	1.17
@@ -140,72 +140,68 @@
 process_lrm_queue() {
   debug_msg "process_lrm_queue ($@)"
 
-   export TEMP_FILE=$(temp_create "lrm")
-   export TEMP2_FILE=$(temp_create "lrm")
-
-   [ "$LUNAR_DEBUG" == "on" ] && 
-   [ -s "$LRM_QUEUE" ]    && 
-      echo -e "\nWill process the modules: `cat $LRM_QUEUE | xargs`"
+  export TEMP_FILE=$(temp_create "lrm")
+  export TEMP2_FILE=$(temp_create "lrm")
 
-   while [ -s "$LRM_QUEUE" ]
-   do   
-      MODULE=`remove_queue $LRM_QUEUE`
-      [ "$TEST" == "on" ] && TEMP="-- TEST MODE -- : "
-      verbose_msg "${TEMP}removing \"$MODULE\""
+  while [ -s "$LRM_QUEUE" ]
+  do   
+    MODULE=$(remove_queue $LRM_QUEUE)
+    verbose_msg "${TEMP}removing \"$MODULE\""
 
-      run_details $MODULE &> /dev/null
+    run_details $MODULE &> /dev/null
 
-       VERSION=`installed_version  $MODULE`
-      INST_LOG=$INSTALL_LOGS/$MODULE-$VERSION
-       MD5_LOG=$MD5SUM_LOGS/$MODULE-$VERSION
+    VERSION=$(installed_version $MODULE)
+    INST_LOG=$INSTALL_LOGS/$MODULE-$VERSION
+    MD5_LOG=$MD5SUM_LOGS/$MODULE-$VERSION
 
-      run_module_file $MODULE PRE_REMOVE 
+    # time-out 1: PRE_REMOVE
+    run_module_file $MODULE PRE_REMOVE 
 
-      while read TARGET ; do
-         if ! [ -e "$TARGET" ] ; then
-            continue
-         fi
+    while read TARGET ; do
+      if ! [ -e "$TARGET" ] ; then
+        continue
+      fi
 
-         if grep -q -w "$TARGET\$" $PROTECTED $EXCLUDED ; then
-            verbose_msg "\"$TARGET\" is protected or excluded!!"
-            continue
-         fi
+      if grep -q -w "$TARGET\$" $PROTECTED $EXCLUDED ; then
+        verbose_msg "\"$TARGET\" is protected or excluded!!"
+        continue
+      fi
 
-         if [ -d "$TARGET" ] ; then
-            echo "$TARGET" >> $TEMP_FILE
-            continue
-         fi
+      if [ -d "$TARGET" ] ; then
+        echo "$TARGET" >> $TEMP_FILE
+        continue
+      fi
 
-         handle_config_files $TARGET
+      handle_config_files $TARGET
 
-         remove_something $TARGET
+      remove_something $TARGET
 
-      done < $INST_LOG
+    done < $INST_LOG
 
-      process_directories $TEMP_FILE $TEMP2_FILE
+    process_directories $TEMP_FILE $TEMP2_FILE
 
-      run_module_file $MODULE POST_REMOVE
+    # time-out 2: POST_REMOVE
+    run_module_file $MODULE POST_REMOVE
 
-      if [ "$KEEPCONFIG" == "on" ] ; then
-        verbose_msg "skipping removal of dependency listing and configs"
-      else
-        verbose_msg "removing module from dependency listing and configs"
-        remove_depends  $MODULE
-      fi
+    if [ "$KEEPCONFIG" == "on" ] ; then
+      verbose_msg "skipping removal of dependency listing and configs"
+    else
+      verbose_msg "removing module from dependency listing and configs"
+      remove_depends  $MODULE
+    fi
 
-      verbose_msg "removing module from installed list.. "
-      
-      [ "$TEST" != "on" ] && remove_module  $MODULE
+    # administration duty time:
+    verbose_msg "removing module from installed list.. "
+    remove_module $MODULE
 
-      message  "${LRM_COLOR}Removed${EXTEMP} module:"  \
-                "${MODULE_COLOR}${MODULE}"    \
-                "${DEFAULT_COLOR}"
+    message  "${LRM_COLOR}Removed${EXTEMP} module:"  \
+             "${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
 
-      [ "$TEST" != "on" ] &&
-      activity_log  "lrm"  "$MODULE" "$VERSION"  "success"
-   done
+    activity_log  "lrm"  "$MODULE" "$VERSION"  "success"
+  done
 }
 
+
 check_status() {
    module_installed $MODULE || {
       message  "${MODULE_COLOR}${MODULE}"  \
@@ -229,90 +225,67 @@
 
 
 downgrade() {
-   # a local function for listing the contents of install cache
-   list_available_cache()
-   {
-      ls -1 $INSTALL_CACHE/$MODULE-* |
-      while read LINE
-      do
-         echo "  $LINE"
-      done
-      exit 1
-   }
+  # a local function for listing the contents of install cache
+  list_available_cache() {
+    ls -1 $INSTALL_CACHE/$MODULE-* | while read LINE ; do
+      echo "$LINE"
+    done
+    exit 1
+  }
    
-   if [ "$TEST" != "on" ]; then 
-      root_check || exit 1
-   fi
+  root_check || exit 1
 
-   verbose_msg "running \"$MODULE\" DETAILS file"
-   run_details $MODULE &> /dev/null || return 1
+  verbose_msg "running \"$MODULE\" DETAILS file"
+  run_details $MODULE &> /dev/null || return 1
 
-   [ -z "$1" ] && {
-      echo "No version is entered. The below is the list of available files."
-      list_available_cache   
-   }
+  if [ -z "$1" ] ; then
+    echo "No version is entered. The below is the list of available files."
+    list_available_cache   
+  fi
 
-   local FILENAME="$MODULE-$1-$BUILD.tar.bz2"
-   [ -s $INSTALL_CACHE/$FILENAME ] || {
-      echo "Desired version is not available. Here is the available files"
-      list_available_cache
-   }
+  if [ ! -s $INSTALL_CACHE/$MODULE-$1-$BUILD.tar.bz2 ] ; then 
+    echo "Desired version is not available. Here is the available files"
+    list_available_cache
+  fi
 
-   verbose_msg "checking if \"$MODULE\" is installed"
-   local I_VERSION=`installed_version $MODULE`
-   [ -n "$I_VERSION" ] && 
-   {
-      verbose_msg "\"$I_VERSION\" of \"$MODULE\" is installed at the moment"
+  verbose_msg "checking if \"$MODULE\" is installed"
 
-      [ "$LUNAR_DEBUG" == "on" ] && 
-         echo -n "  Checking if desired version is the installed version..."
+  if [ -n "$(installed_version $MODULE)" ] ; then 
+    verbose_msg "\"$(installed_version $MODULE)\" of \"$MODULE\" is installed at the moment"
 
-      [ "$1" == "$I_VERSION" ] && 
-      {
-         [ "$LUNAR_DEBUG" == "on" ] && echo "YES!!"
-         echo "The downgrade version is the same as the installed version"
-         echo "Here is the available files." 
-         list_available_cache
-      } || 
-      {
-         [ "$LUNAR_DEBUG" == "on" ] && echo "NO"
-      }
+    if [ "$1" == "$I_VERSION" ] ; then
+      echo "The downgrade version is the same as the installed version"
+      echo "Here is the available files." 
+      list_available_cache
+    fi
 
-      verbose_msg "removing \"$MODULE-$I_VERSION\""
-      [ "$TEST" == "on" ] && lrm -ts $MODULE || lrm -s $MODULE
+    verbose_msg "removing \"$MODULE-$(installed_version $MODULE)\""
+    lrm -ts $MODULE || lrm -s $MODULE
 
-   } || {
-      verbose_msg "\"$MODULE\" is NOT installed at the moment"
-   }
+  else
+    verbose_msg "\"$MODULE\" is NOT installed at the moment"
+  fi
 
-   verbose_msg "installing \"$MODULE-$1\""
-   verbose_msg "extracting cached install file..."
-   [ "$TEST" == "on" ] && 
-   {
-      [ "$LUNAR_DEBUG" == "on" ] &&
-      bzcat $INSTALL_CACHE/$FILENAME | tar -kt $TAR_P -C /  ||
-      bzcat $INSTALL_CACHE/$FILENAME | tar -kt $TAR_P -C / >/dev/null
-      verbose_msg "adding module to installed list"
-   }
+  verbose_msg "installing \"$MODULE-$1\""
+  verbose_msg "extracting cached install file..."
+  
+  bzcat $INSTALL_CACHE/$FILENAME | tar -kt $TAR_P -C / >/dev/null
+  verbose_msg "adding module to installed list"
 
-   [ "$TEST" != "on" ] && 
-   {
-      [ "$LUNAR_DEBUG" == "on" ] &&
-      bzcat $INSTALL_CACHE/$FILENAME | tar -kx $TAR_P -C / ||
-      bzcat $INSTALL_CACHE/$FILENAME | 
-      tar -kx $TAR_P -C / 2>/dev/null >/dev/null
-      verbose_msg "adding module to installed list"
-      add_module $MODULE installed  $1
-      activity_log  "lrm downgrade"  "$MODULE"  "$1"  "success"
-   }
-    message  "${RESURRECT_COLOR}Downgraded module:"  \
-             "${MODULE_COLOR}${MODULE}"              \
-             "${DEFAULT_COLOR}"                      \
-             "version"                               \
-             "${VERSION_COLOR}${1}"                  \
-             "${DEFAULT_COLOR}" 
+  bzcat $INSTALL_CACHE/$FILENAME | 
+  tar -kx $TAR_P -C / 2>/dev/null >/dev/null
+  verbose_msg "adding module to installed list"
+  add_module $MODULE installed  $1
+  activity_log  "lrm downgrade"  "$MODULE"  "$1"  "success"
+
+  message  "${RESURRECT_COLOR}Downgraded module:"  \
+           "${MODULE_COLOR}${MODULE}"              \
+           "${DEFAULT_COLOR}"                      \
+           "version"                               \
+           "${VERSION_COLOR}${1}"                  \
+           "${DEFAULT_COLOR}" 
    
-   exit
+  exit
 }
 
 create_lrm_queue() {
@@ -378,7 +351,8 @@
       -s|--nosustain  ) export NOSUSTAIN=on;   shift ;;
       -k|--keepconfig ) export KEEPCONFIG=on;  shift ;;
       -t|--test       ) export TEST=on;        shift ;;
-      --debug         ) export LUNAR_DEBUG=on; shift;;
+         --debug      ) (( LUNAR_DEBUG++ ))
+		        export LUNAR_DEBUG;    shift ;;
       --) shift; break ;;
        *) help;  break ;;
    esac




More information about the Lunar-commits mailing list