CVS: lunar/var/lib/lunar/functions config.lunar, 1.1.1.1, 1.2 depends.lunar, 1.3, 1.4 download.lunar, 1.6, 1.7 edit.lunar, 1.3, 1.4 locking.lunar, 1.2, 1.3 messages.lunar, 1.2, 1.3 modules.lunar, 1.7, 1.8 moonbase.lunar, 1.3, 1.4 optimize.lunar, 1.13, 1.14 postbuild.lunar, 1.3, 1.4 queue.lunar, 1.1.1.1, 1.2 recovery.lunar, 1.1.1.1, 1.2 sizes.lunar, 1.1.1.1, 1.2 sources.lunar, 1.3, 1.4 uniqid.lunar, 1.1, 1.2 updatelog.lunar, 1.6, 1.7 useradd.lunar, 1.1, 1.2 view.lunar, 1.1, 1.2

csm at lunar-linux.org csm at lunar-linux.org
Sun Aug 10 01:16:25 GMT 2003


Update of /var/cvs/lunar/lunar/var/lib/lunar/functions
In directory dbguin.lunar-linux.org:/tmp/cvs-serv1871/var/lib/lunar/functions

Modified Files:
	config.lunar depends.lunar download.lunar edit.lunar 
	locking.lunar messages.lunar modules.lunar moonbase.lunar 
	optimize.lunar postbuild.lunar queue.lunar recovery.lunar 
	sizes.lunar sources.lunar uniqid.lunar updatelog.lunar 
	useradd.lunar view.lunar 
Log Message:
merging theedge into lunar and removing subroutines


Index: config.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/config.lunar,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- config.lunar	2 Sep 2002 14:00:38 -0000	1.1.1.1
+++ config.lunar	10 Aug 2003 01:16:22 -0000	1.2
@@ -1,4 +1,4 @@
-############################################################
+#!/bin/bash
 #                                                          #
 # This code is written for Lunar Linux, see                #
 # http://www.lunar-linux.org                               #
@@ -19,8 +19,7 @@
 # function: write_config
 # usage   : write_config <line to remove> [<line to add>]
 # purpose : removes a line from the $LOCAL_CONFIG and adds another (if given)
-function write_config()
-{
+function write_config() {
    [ -z "$1" ] && return 1        
 
    TMP_LOCAL_CONFIG="/tmp/lunar.localconfig.$$"

Index: depends.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/depends.lunar,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- depends.lunar	16 Apr 2003 19:47:09 -0000	1.3
+++ depends.lunar	10 Aug 2003 01:16:22 -0000	1.4
@@ -1,4 +1,4 @@
-############################################################
+#!/bin/bash
 #                                                          #
 # This code is written for Lunar Linux, see                #
 # http://www.lunar-linux.org                               #
@@ -8,7 +8,7 @@
 # $FUNCTIONS/depends                                       #
 # includes find_depends is_depends in_depends              #
 # remove_depends add_depends run_depends                   #
-# handle_depends rework_module rework_list                 #
+# rework_module rework_list                                #
 # fix_depends satisfy_depends                              #
 #                                                          #
 # 20020710                                                 #
@@ -27,111 +27,85 @@
 # function : find_depends 
 # usage    : find_depends "module name"
 # purpose  : recursive dependency finder, no need to be installed
-function find_depends()
-{
-   [ -n "$1" ]                || return 1
-   run_details $1             || return 1
-   [ -n "$SCRIPT_DIRECTORY" ] || return 1   
+function find_depends() {
+  debug_msg "function find_depends ($@)"
 
-   REQ_DEPENDS="/tmp/lunar_req_depends.`uuidgen`"
-   rm -f $REQ_DEPENDS 2>/dev/null
+  # as always, use private depends() and optional_depends() functions
+  depends () {
+  debug_msg "  depends  ($@)"
+    if ! $(echo $FOUND_DEPENDS | grep -qw $1) ; then
+      export FOUND_DEPENDS="$FOUND_DEPENDS $1"
+      find_depends $1
+      echo $1
+    fi
+  }
 
-   DEPENDS_FILE=$SCRIPT_DIRECTORY/DEPENDS
-   [ -s "$DEPENDS_FILE" ]     || return 1
-   
-   grep -q ^depends $DEPENDS_FILE 2>/dev/null && {
-       grep ^depends $DEPENDS_FILE 2>/dev/null |
-       tr "\t" " "                             |
-       sed "s/^depends *//g"                   |
-       cut -d " " -f 1-1                       |
-       sed "s/[\'\"\\ &]//g"                   |
-       while read TMP_DEP
-       do
-          echo $TMP_DEP >> $REQ_DEPENDS
-          echo $TMP_DEP $1 >> $TMP_DEPENDS   
-       done
-   }
+  optional_depends() {
+  debug_msg "  optional_depends ($@)"
+    if ! $(echo $FOUND_DEPENDS | grep -qw $1) ; then
+      if module_installed $1 ; then
+        export FOUND_DEPENDS="$FOUND_DEPENDS $1"
+        find_depends $1
+        echo $1
+      fi
+    fi
+  }
+  
+  export FOUND_DEPENDS="$FOUND_DEPENDS $1"
+  if ! run_details $1 &> /dev/null ; then
+    exit 1
+  fi
 
-   grep -q ^optional_depends $DEPENDS_FILE 2>/dev/null && {
-       grep ^optional_depends $DEPENDS_FILE 2>/dev/null |
-       tr "\t" " "                                      |
-       sed "s/^optional_depends *//g"                   |
-       cut -d " " -f 1-1                                |
-       sed "s/[\'\"\\ &]//g"                            |
-       while read TMP_DEP
-       do
-          echo $TMP_DEP >> $REQ_DEPENDS
-          echo $TMP_DEP $1 >> $TMP_DEPENDS   
-       done
-   }
-   [ -s "$REQ_DEPENDS" ] && {
-      cat $REQ_DEPENDS |
-      while read REQ_DEP
-      do
-         grep -q " $REQ_DEP" $TMP_DEPENDS ||
-         find_depends $REQ_DEP
-      done
-   }
+  if [ -e "$MODULE_CONFIG" ] ; then
+    . "$MODULE_CONFIG"
+  fi
 
-   rm -f $REQ_DEPENDS 2>/dev/null
-   rm -f $OPT_DEPENDS 2>/dev/null
+  run_module_file $MODULE DEPENDS
 
 }
 
 
 
-is_depends()  {  (
-  #  Is $1 a previously selected dependency of any module.
-  EXIT_STATUS="false"
-  for  DEP  in  `cut  -d :  -f2-  $DEPENDS_STATUS  |
-                 grep  "^$1:"`
-  do
-    DEP_STATUS=`echo  "$DEP"  |  cut  -d :  -f2`
-    if    [  "$DEP_STATUS"  ==  "on"  ]
-    then  EXIT_STATUS="true"
-          break
-    fi
-  done
-  $EXIT_STATUS
-)  }
+is_depends()  {
+  debug_msg "is_depends ($@)"
+  # Is $1 a previously selected dependency of any module.
+  return $(cat $DEPENDS_STATUS | cut -d: -f2- | grep -q "^$1:on:")
+}
                                                                                 
                                                                                 
 in_depends()  {
-  #  Was $2 presented as a depenency for module $1
-  if    grep  -q  "^$1:$2"  $DEPENDS_STATUS
-  then  true
-  else  false
-  fi
+  debug_msg "in_depends ($@)"
+  # Was $2 presented as a depenency for module $1
+  return $(grep -q "^$1:$2:" $DEPENDS_STATUS)
 }
                                                                                 
                                                                                 
-remove_depends()
-{
+remove_depends() {
+  debug_msg "remove_depends ($@)"
   lock_file $DEPENDS_STATUS_BACKUP &&
   lock_file $DEPENDS_STATUS        ||
   return 1
                                                                                 
   if [ -n "$2" ] ; then
     if grep -q "^$1:$2:" $DEPENDS_STATUS ; then
-	    grep -v "^$1:$2:" $DEPENDS_STATUS_BACKUP > $DEPENDS_STATUS
+      grep -v "^$1:$2:" $DEPENDS_STATUS_BACKUP > $DEPENDS_STATUS
       verbose_msg "removing depends for \"$1\" on \"$2\""
-		fi
-  else
-	  if grep -q "^$1:" $DEPENDS_STATUS ; then
-      grep -v "^$1:" $DEPENDS_STATUS_BACKUP | \
-      grep -v ":$1:on:optional:" > $DEPENDS_STATUS
-      verbose_msg "removing all depends for and optional on \"$1\""
-		fi
+    fi
+  elif grep -q "^$1:" $DEPENDS_STATUS ; then
+    grep -v "^$1:" $DEPENDS_STATUS_BACKUP | \
+    grep -v ":$1:on:optional:" > $DEPENDS_STATUS
+    verbose_msg "removing all depends for and optional on \"$1\""
   fi
-  cat $DEPENDS_STATUS > $DEPENDS_STATUS_BACKUP
+
+  cp $DEPENDS_STATUS $DEPENDS_STATUS_BACKUP
                                                                                 
   unlock_file $DEPENDS_STATUS_BACKUP &&
   unlock_file $DEPENDS_STATUS
 }
                                                                                 
 
-add_depends()
-{
+add_depends() {
+  debug_msg "add_depends ($@)"
   if ! grep -q "^$1:$2:$3:$4:$5:$6$" $DEPENDS_STATUS ; then
 	  if grep -q "^$1:$2:" $DEPENDS_STATUS ; then
 		  remove_depends "$1" "$2"
@@ -148,347 +122,128 @@
   fi
 }
                                                                                 
-                                                                                
+     
 run_depends() {
-                                                                                
+  debug_msg "run_depends ($@)"
   # local definitions of depends and optional_depends!
   depends()  {
-    grep -q "^"$1"\$" $PREPD 2>/dev/null && return 0
+  debug_msg "  depends ($@)"
+    grep -q "^"$1"\$" $TEMP_PREPAREDDEPS 2>/dev/null && return 0
 
     if ! module_installed $1 && ! module_held $1 ; then
       if ! is_depends $1 && module_exiled $1 ; then
+        message "${MODULE_COLOR}${MODULE}:${PROBLEM_COLOR} ! Error: required dependency ${MODULE_COLOR}${1}${DEFAULT_COLOR}${PROBLEM_COLOR} is exiled and cannot be installed${DEFAULT_COLOR}"
         return 1
       else
         message "${MODULE_COLOR}${MODULE}: ${DEFAULT_COLOR}" \
                 "Adding required dependency${FILE_COLOR}"   \
                 "$1 ${DEFAULT_COLOR}"
         lin --deps $1
-        echo "$1" >> $PREPD
+        echo "$1" >> $TEMP_PREPAREDDEPS
       fi
     fi
     add_depends "$MODULE" "$1" "on" "required" "$2" "$3"
   }
                                                                                 
   optional_depends()  {
+  debug_msg "  optional_depends ($@)"
     # parameters:  $1 = module name
     #              $2 = configure parameter if module wanted
     #              $3 = configure parameter if module declined
     #              $4 = description of why to use this module.
                                                                                 
     if ! in_depends "$MODULE" "$1" ; then
-                                                                                
+                                                                               
       if module_exiled $1 ; then
-        verbose_msg "\"$MODULE\" optionally depends on \"$1\""
-        add_depends  "$MODULE"  "$1"  "off"  "optional"  "$2"  "$3"
+        verbose_msg "\"$MODULE\" optionally depends on exiled module \"$1\""
+        add_depends "$MODULE" "$1" "off" "optional" "$2" "$3"
       else
-                                                                                
-        if module_installed $1 || module_held $1 ; then
+        if module_installed $1 ; then
           DEFAULT="y"
 	else
           DEFAULT="n"
         fi
                                                                                 
-        if is_depends $1 ; then
-	  if query  "Install optional dependency $1 $4? " $DEFAULT ; then
-            lin  --deps  $1
-            add_depends  "$MODULE"  "$1"  "on"   "optional"  "$2"  "$3"
-          else
-	    add_depends  "$MODULE"  "$1"  "off"  "optional"  "$2"  "$3"
-	  fi
-        fi
+	if query  "Install optional dependency $1 $4? " $DEFAULT ; then
+          lin  --deps  $1
+          add_depends  "$MODULE"  "$1"  "on"   "optional"  "$2"  "$3"
+        else
+	  add_depends  "$MODULE"  "$1"  "off"  "optional"  "$2"  "$3"
+	fi
       fi
     fi
   }
                                                                                 
   prepare_depends_status
-  grep -q "^"$MODULE"\$" $PREPD 2>/dev/null && return 0
-  if  [  -x  $SCRIPT_DIRECTORY/DEPENDS  ];  then
+  grep -q "^"$MODULE"\$" $TEMP_PREPAREDDEPS 2>/dev/null && return 0
+  if [ -s "$SCRIPT_DIRECTORY/DEPENDS" ] ; then
     message  "${CHECK_COLOR}Checking dependencies for"  \
              "${MODULE_COLOR}${MODULE}"                   \
              "${DEFAULT_COLOR}"
-    . $SCRIPT_DIRECTORY/DEPENDS
-  fi
-}
-
-
-handle_depends()  {  true;  }
-
-
-# rework_module : check depends database for a module
-rework_module() {
-                                                                                
-  # we declare these local to override the systems default ones:
-  optional_depends()  {
-    if    module_exiled  $1
-    then  add_depends  "$MODULE"  "$1"  "off"  "optional"  "$2"  "$3"
-    else
-      if  module_installed  $1  ||
-          module_held       $1
-      then  add_depends  "$MODULE"  "$1"  "on"   "optional"  "$2"  "$3"
-      else  add_depends  "$MODULE"  "$1"  "off"  "optional"  "$2"  "$3"
-      fi
-    fi
-  }
-                                                                                
-  depends()  {
-    if  ! module_installed  $1   &&
-        ! module_held       $1
-    then
-      if  !  is_depends     $1   &&
-             module_exiled  $1
-      then  return  1
-      else
-        echo -e "${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}${MESSAGE_COLOR} is missing ${MODULE_COLOR}$1${DEFAULT_COLOR}"
-        CHANGED_MODULES="$CHANGED_MODULES $1"
-      fi
-    fi
-    add_depends  "$MODULE"  "$1"  "on"  "required"  "$2"  "$3"
-  }
-  run_depends() {
-    if  [  -x  $SCRIPT_DIRECTORY/DEPENDS  ];  then
-      show_fancy_progress "Processing: $MODULE"
-      . $SCRIPT_DIRECTORY/DEPENDS
-    fi
-  }
-                                                                                
-  # here starts the real work:
-  MODULE=$1
-                                                                                
-  # base vars needed to execute DEPENDS
-  SECTION=$(find_section $MODULE)
-  SCRIPT_DIRECTORY=$MOONBASE/$SECTION/$MODULE
-  MODULE_CONFIG=$CONFIG_CACHE/depends/$MODULE
-                                                                                
-  # reroute depends output to our private files:
-  OLD_DEPENDS_STATUS=$DEPENDS_STATUS
-  OLD_DEPENDS_STATUS_BACKUP=$DEPENDS_STATUS_BACKUP
-                                                                                
-  DEPENDS_STATUS=$TMP/depends
-  DEPENDS_STATUS_BACKUP=$TMP/depends.backup
-  touch $DEPENDS_STATUS
-  touch $DEPENDS_STATUS_BACKUP
-                                                                                
-  # fetch old depend data:
-  grep "^$MODULE:" $OLD_DEPENDS_STATUS | sort | uniq > $TMP/depends.old.$MODULE
-                                                                                
-  # fetch new depend data:
-  run_depends
-  grep "^$MODULE:" $DEPENDS_STATUS | sort | uniq > $TMP/depends.new.$MODULE
-                                                                                
-  if $(! diff -q $TMP/depends.old.$MODULE $TMP/depends.new.$MODULE &> /dev/null
-) ; then
-    echo -e "${MODULE_COLOR}$MODULE${DEFAULT_COLOR}${MESSAGE_COLOR} has changed depends:${DEFAULT_COLOR}"
-    CHANGED_MODULES="$CHANGED_MODULES $MODULE"
-    LIST=$(cat $TMP/depends.old.$MODULE $TMP/depends.new.$MODULE | cut -d: -f2 | sort | uniq )
-    for DEP in $LIST; do
-      OLDDEP=$(grep ":$DEP:" $TMP/depends.old.$MODULE)
-      NEWDEP=$(grep ":$DEP:" $TMP/depends.new.$MODULE)
-      if [ "$OLDDEP" != "$NEWDEP" ] ; then
-                                                                                
-        # diff style output for debugging:
-        # echo "- $OLDDEP"
-        # echo "+ $NEWDEP"
-                                                                                
-        # the tricky part is deciding what is necessary and what not:
-        OLD_STATUS=$(echo $OLDDEP | cut -d: -f3)
-        NEW_STATUS=$(echo $NEWDEP | cut -d: -f3)
-        OLD_REQD=$(echo $OLDDEP | cut -d: -f4)
-        NEW_REQD=$(echo $NEWDEP | cut -d: -f4)
-        OLD_ON_OPTS=$(echo $OLDDEP | cut -d: -f5)
-        NEW_ON_OPTS=$(echo $NEWDEP | cut -d: -f5)
-        OLD_OFF_OPTS=$(echo $OLDDEP | cut -d: -f6)
-        NEW_OFF_OPTS=$(echo $NEWDEP | cut -d: -f6)
-        if [ -z "$NEWDEP" ] ; then
-          echo -e "${MESSAGE_COLOR}* ${MODULE_COLOR}$DEP${DEFAULT_COLOR}${MESSAGE_COLOR} was removed from the dependancy list${DEFAULT_COLOR}"
-        else
-          if [ -z "$OLDDEP" ] ; then
-            echo -e "${MESSAGE_COLOR}* ${MODULE_COLOR}$DEP${DEFAULT_COLOR}${MESSAGE_COLOR} was added to the $NEW_REQD dependancy list${DEFAULT_COLOR}"
-          else
-            # the dep changed!
-            if [ "$OLD_STATUS" == "on" -a "$NEW_STATUS" == "on" ]; then
-              if [ "$OLD_REQD" == "required" -a "$NEW_REQD" == "optional" ]
-              then
-                echo -e "${MESSAGE_COLOR}* ${MODULE_COLOR}$DEP${DEFAULT_COLOR}${MESSAGE_COLOR} was changed to optional${DEFAULT_COLOR}"
-              elif [ "$OLD_REQD" == "optional" -a "$NEW_REQD" == "required" ]
-              then
-                echo -e "${MESSAGE_COLOR}* ${MODULE_COLOR}$DEP${DEFAULT_COLOR}${MESSAGE_COLOR} was changed to required${DEFAULT_COLOR}"
-              else
-                echo -e "${MESSAGE_COLOR}* ${MODULE_COLOR}$MODULE${DEFAULT_COLOR}${MESSAGE_COLOR} has new compile flags for ${MODULE_COLOR}$DEP${MESSAGE_COLOR}${DEFAULT_COLOR}"
-              fi
-            elif [ "$OLD_STATUS" == "off" -a "$NEW_STATUS" == "off" ]; then
-              if [ "$OLD_REQD" == "required" -a "$NEW_REQD" == "optional" ]
-              then
-                echo -e "${MESSAGE_COLOR}* ${MODULE_COLOR}$DEP${DEFAULT_COLOR}${MESSAGE_COLOR} was changed to optional${DEFAULT_COLOR}"
-              elif [ "$OLD_REQD" == "optional" -a "$NEW_REQD" == "required" ]
-              then
-                echo -e "${MESSAGE_COLOR}* ${MODULE_COLOR}$DEP${DEFAULT_COLOR}${MESSAGE_COLOR} was changed to required${DEFAULT_COLOR}"
-              else
-                echo -e "${MESSAGE_COLOR}* ${MODULE_COLOR}$MODULE${DEFAULT_COLOR}${MESSAGE_COLOR} has new compile flags for ${MODULE_COLOR}$DEP${MESSAGE_COLOR}${DEFAULT_COLOR}"
-              fi
-            elif [ "$OLD_STATUS" == "off" -a "$NEW_STATUS" == "on" ]; then
-              echo -e "${MESSAGE_COLOR}* $NEW_REQD ${MODULE_COLOR}$DEP${DEFAULT_COLOR}${MESSAGE_COLOR} was installed${DEFAULT_COLOR}"
-            elif [ "$OLD_STATUS" == "on" -a "$NEW_STATUS" == "off" ]; then
-              echo -e "${MESSAGE_COLOR}* $NEW_REQD ${MODULE_COLOR}$DEP${DEFAULT_COLOR}${MESSAGE_COLOR} was removed${DEFAULT_COLOR}"
-            else
-              echo -e "${$MESSAGE_COLOR}* ${MODULE_COLOR}$DEP${DEFAULT_COLOR}${MESSAGE_COLOR} ${PROBLEM_COLOR}missed exception $OLD_STATUS $NEW_STATUS${DEFAULT_COLOR}"
-            fi
-          fi
-        fi
-      fi
-    done
+    run_module_file $MODULE DEPENDS
   fi
-                                                                                
-  # clean up
-  rm -f $DEPENDS_STATUS
-  rm -f $DEPENDS_STATUS_BACKUP
-  DEPENDS_STATUS=$OLD_DEPENDS_STATUS
-  DEPENDS_STATUS_BACKUP=$OLD_DEPENDS_STATUS_BACKUP
-                                                                                
 }
 
 
-# rework_list : rework a list of modules and save output
-rework_list() {
-                                                                                
-  for MODULE in $* ; do
-    module_exiled $MODULE || rework_module $MODULE
-  done
-                                                                                
-}
-                                                                                
-
-# fix_depends : single pass to fix depends database
-fix_depends () {
-                                                                                
-  TMP=/tmp/lunar.fix
-  [ -d $TMP ] || mkdir -p $TMP
-                                                                                
-  CHANGED_MODULES=
-  # we NEED this
-  if [ -f "$INSTALL_QUEUE" ] ; then
-    rm -f $INSTALL_QUEUE
-    touch $INSTALL_QUEUE
-  fi
-                                                                                
-  if [ -n "$1" ] ; then
-    rework_list $*
-  else
-    rework_list $(cat $MODULE_STATUS | cut -d: -f1 | sort )
-  fi
-                                                                                
-  if [ -n "$CHANGED_MODULES" ] ; then
-                                                                                
-    for MODULE in $CHANGED_MODULES ; do
-      if [ ! -e $TMP/depends.new.$MODULE ] ; then
-        rework_module $MODULE
-      fi
-    done
-                                                                                
-    # this ensures the bastard doesn't recheck it:
-    if [ -z "$NOFIX" ] ; then
-      mv $DEPENDS_STATUS $TMP/depends
-      cp $TMP/depends $TMP/depends.filter
-      for MODULE in $CHANGED_MODULES ; do
-        grep -v "^$MODULE:" $TMP/depends.filter > $TMP/depends.filter~
-        mv $TMP/depends.filter~ $TMP/depends.filter
-      done
-      mv $TMP/depends.filter $DEPENDS_STATUS
-      cat $TMP/depends.new.* >> $DEPENDS_STATUS
-      cp $DEPENDS_STATUS $DEPENDS_STATUS_BACKUP
-    fi
-                                                                                
-    OLD_FIX=$FIX
-    unset FIX
-    OLD_lin_PASS=$lin_PASS; export lin_PASS=three
-                                                                                
-    for MODULE in $CHANGED_MODULES ; do
-      if [ -n "$FIXDEPENDS" ] ; then
-        # special case: when called with --fixdepends, skip recompile!
-        cp $TMP/depends $TMP/depends.filter
-        for MODULE in $CHANGED_MODULES ; do
-          grep -v "^$MODULE:" $TMP/depends.filter > $TMP/depends.filter~
-          mv $TMP/depends.filter~ $TMP/depends.filter
-        done
-        mv $TMP/depends.filter $DEPENDS_STATUS
-        cat $TMP/depends.new.* >> $DEPENDS_STATUS
-        cp $DEPENDS_STATUS $DEPENDS_STATUS_BACKUP
-      else
-        if [ -z "$NOFIX" ] ; then
-          if ! lin -c $MODULE ; then
-            # put back the faulty depends so we know fixing this failed
-            # and will be found again on the next run
-            cat $TMP/depends > $DEPENDS_STATUS
-            cp $DEPENDS_STATUS $DEPENDS_STATUS_BACKUP
-          else
-            # sometimes after lin all depends are gone! force it down it's throat
-            cp $TMP/depends $TMP/depends.filter
-            for MODULE in $CHANGED_MODULES ; do
-              grep -v "^$MODULE:" $TMP/depends.filter > $TMP/depends.filter~
-              mv $TMP/depends.filter~ $TMP/depends.filter
-            done
-            mv $TMP/depends.filter $DEPENDS_STATUS
-            cat $TMP/depends.new.* >> $DEPENDS_STATUS
-            cp $DEPENDS_STATUS $DEPENDS_STATUS_BACKUP
-          fi
-        fi
-      fi
-      remove_queue $INSTALL_QUEUE $MODULE
-    done
-                                                                                
-    FIX=$OLD_FIX
-    unset OLD_FIX
-    export lin_PASS=$OLD_lin_PASS
-                                                                                
-  fi
-                                                                                
-  rm -rf $TMP
-                                                                                
-}
-                                                                                
-                                                                                
+                                                                           
+                                                                   
 # function : satisfy_depends
 # usage    : satisfy_depends (operates on $MODULE variable)
 # purpose  : re-check module deps based on DEPENDS_CONFIG and DEPENDS_STATUS
+# NOTE: this is where a missing dependency gets installed! IOW we really do
+# "satisfy" any dependencies here!
 satisfy_depends()  {
-                                                                                
-  [ -n "$DEPS_ONLY" ] && return 0
-  unset  OPTS
-  MODULE_CONFIG=$DEPENDS_CONFIG/$MODULE
-                                                                                
-  if  [  -s  $MODULE_CONFIG  ];  then
-          .  $MODULE_CONFIG
+  debug_msg "satisfy_depends ($@)"
+  if [ -n "$DEPS_ONLY" ] ; then 
+    return 0
   fi
-                                                                                
-  TMP_FILE="/tmp/satisfy_depends.`uuidgen`"
-  grep  "^$MODULE:"  $DEPENDS_STATUS > $TMP_FILE
-                                                                                
+  
+  unset OPTS
+
+  if [ -s "$MODULE_CONFIG" ] ; then
+    . $MODULE_CONFIG
+  fi
+
+  TMP_FILE=$(temp_create "${MODULE}.satify-depends")
+  grep "^$MODULE:" $DEPENDS_STATUS > $TMP_FILE
+
   while read LINE; do
-    DEP_MODULE=`echo  $LINE  |  cut  -d :  -f2`
-    DEP_STATUS=`echo  $LINE  |  cut  -d :  -f3`
-        DEP_ON=`echo  $LINE  |  cut  -d :  -f5`
-       DEP_OFF=`echo  $LINE  |  cut  -d :  -f6`
-                                                                                
-    if  [  -n  "$FIX"  ]
-    then  if  DEP_STATUS="on"
-          then  lin  $FIX  $DEP_MODULE
-          fi
-    elif  [  "$DEP_STATUS"  ==  "off"  ]  ||
-          module_exiled  $DEP_MODULE
-    then  OPTS="$OPTS  $DEP_OFF"
+    DEP_MODULE=$(echo $LINE | cut -d: -f2)
+    DEP_STATUS=$(echo $LINE | cut -d: -f3)
+        DEP_ON=$(echo $LINE | cut -d: -f5)
+       DEP_OFF=$(echo $LINE | cut -d: -f6)
                                                                                 
-    elif  [  "$DEP_STATUS"  ==  "on"  ]   &&
-          !  module_installed  $DEP_MODULE  &&
-          !  module_held       $DEP_MODULE
-    then
-      if    lin  $SILENT  $COMPILE  $DEP_MODULE
-      then  OPTS="$OPTS  $DEP_ON"
-      else  exit  1
+    if [ -n "$FIX" ] ; then
+      if DEP_STATUS="on" ; then
+        lin $FIX $DEP_MODULE
       fi
-    else  OPTS="$OPTS  $DEP_ON"
+    elif [ "$DEP_STATUS" == "off" ] || module_exiled $DEP_MODULE ; then
+      OPTS="$OPTS $DEP_OFF"
+    elif [ "$DEP_STATUS" == "on" ] && ! module_installed $DEP_MODULE && \
+        ! module_held $DEP_MODULE ; then
+      if lin $SILENT $COMPILE $DEP_MODULE ; then
+        OPTS="$OPTS $DEP_ON"
+      else
+        exit 1
+      fi
+    else
+      OPTS="$OPTS $DEP_ON"
     fi
-                                                                                
   done < $TMP_FILE
-                                                                                
-  rm $TMP_FILE 2> /dev/null
-                                                                                
+                                                     
+  temp_destroy $TMP_FILE
 }
+
+
+# conflicts... remove conflicting modules
+conflicts() {
+  debug_msg "conflicts ($@)"
+  if module_installed $1 ; then
+    lrm $1
+  fi
+
+  true
+} 
+
+
+

Index: download.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/download.lunar,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- download.lunar	23 Apr 2003 23:07:56 -0000	1.6
+++ download.lunar	10 Aug 2003 01:16:22 -0000	1.7
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
 ############################################################
 #                                                          #
 # download.lunar - get sources from the net                #
@@ -33,26 +33,93 @@
 ############################################################
 
 
-get_cvs() {(
+get_svn() {
+  debug_msg "get_svn ($@)"
+  if ! module_installed subversion ; then
+    message "${PROBLEM_COLOR}! Cannot fetch SVN sources without \"subversion\" installed${DEFAULT_COLOR}"
+    exit 1
+  fi
+
+  SVN_URL=$(echo $1 | cut -d: -f1-2)
+  SVN_DIR=$(echo $1 | cut -d: -f3)
+
+  message  "${MESSAGE_COLOR}Downloading SVN module for" \
+ 	   "module ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
+
+  mk_source_dir /tmp/$MODULE-$VERSION
+  cd /tmp/$MODULE-$VERSION
+
+  if [ -f "$2" ] ; then
+    verbose_msg "Extracting local SVN copy"
+    # unpacking in last component dir of $SVN_DIR
+    CD=$(pwd -P)
+    if ! tar xjf $2 ; then
+      message "${PROBLEM_COLOR}Warning: bad local SVN copy, checking out fresh SVN copy${DEFAULT_COLOR}"
+      
+      rm_source_dir /tmp/$MODULE-$VERSION
+      mk_source_dir /tmp/$MODULE-$VERSION
+    fi
+    cd $CD
+  fi
+
+  NUM_RETRY=${NUM_RETRY:-5}
+  if [ "$NUM_RETRY" -eq 0 ]; then
+      NUM_RETRY=1000
+  fi
+
+  for (( TRY=1 ; $TRY<$NUM_RETRY+1 ; TRY++ )) ; do
+    if [ -d "${SVN_DIR}/.svn" ] ; then
+      cd ${SVN_DIR}
+      verbose_msg "[${TRY}] svn up"
+      svn up && GOT_SVN="yes" 
+      cd ${CD}
+    else
+      verbose_msg "[${TRY}] svn co $SVN_URL $SVN_DIR"
+      svn co $SVN_URL $SVN_DIR && GOT_SVN="yes"
+    fi
+
+    if [ "$?" == "0" ] ; then
+      break
+    fi
+
+    sleep 2
+  done
+  
+  if [ "$GOT_SVN" == "yes" ] ; then
+    message "${MESSAGE_COLOR}Creating ${FILE_COLOR}$2${DEFAULT_COLOR}"
+    # pack in last component dir of $SVN_DIR
+    tar cjf $2 $SVN_DIR
+  else
+    activity_log "lget"  "$MODULE"  "$VERSION"  "failed" "Could not get $1"
+  fi
+
+  cd /tmp
+  rm_source_dir /tmp/$MODULE-$VERSION
+
+}
+
+
+get_cvs() {
+  debug_msg "get_cvs ($@)"
   if ! module_installed cvs ; then
-    message "${PROBLEM_COLOR}Cannot fetch CVS sources without \"cvs\" installed!${DEFAULT_COLOR}"
+    message "${PROBLEM_COLOR}! Cannot fetch CVS sources without \"cvs\" installed!${DEFAULT_COLOR}"
     exit 1
   fi
 
   [ -f ~/.cvspass ] || touch ~/.cvspass
-
   CVSURL=$(echo $1 | sed "s:^cvs\://::")
   CVSARGS=$(echo $CVSURL | cut -d@ -f1)
   CVSSERVER=$(echo $CVSURL | cut -d@ -f2 | cut -d: -f1)
   CVSSPATH=$(echo $CVSURL | cut -d@ -f2 | cut -d: -f2)
   CVSMODULE=$(echo $CVSURL | cut -d@ -f2 | cut -d: -f3)
   CVSRELEASE=$(echo $CVSURL | cut -d@ -f2 | cut -d: -f4)
+  CVSOPTIONS=$(echo $CVSURL | cut -d@ -f2 | cut -d: -f5)
 
-  if [ ! -z $CVSRELEASE ]; then
+  if [ ! -z "$CVSRELEASE" ]; then
     CVSRELEASE="-r $CVSRELEASE"
   fi
 
-  export CVSROOT="$CVSARGS@$CVSSERVER:$CVSSPATH"
+  CVSROOT="$CVSARGS@$CVSSERVER:$CVSSPATH"
 
   message  "${MESSAGE_COLOR}Downloading CVS module"                      \
            "${FILE_COLOR}${CVSMODULE}${DEFAULT_COLOR}${MESSAGE_COLOR}"   \
@@ -60,37 +127,54 @@
 
   mk_source_dir /tmp/$MODULE-$VERSION
   cd /tmp/$MODULE-$VERSION
-
-  if [[ -f $SOURCE_CACHE/$2 ]]; then
+  
+  if [ -f "$2" ] ; then
     verbose_msg "Extracting local CVS copy"
     # unpacking in last component dir of $CVSMODULE
-    CD=$(pwd)
+    CD=$(pwd -P)
+    debug_msg "get_cvs: PWD=$PWD mkdir -p $(dirname $CVSMODULE)"
     mkdir -p $(dirname $CVSMODULE)
     cd $(dirname $CVSMODULE)
-    if ! tar xjf $SOURCE_CACHE/$2 ; then
-      message "${WARNING_COLOR}Warning: bad local CVS copy, checking out fresh CVS copy${DEFAULT_COLOR}"
+    debug_msg "get_cvs: PWD=$PWD tar xjf $2"
+    if ! tar xjf $2 ; then
+      message "${PROBLEM_COLOR}Warning: bad local CVS copy, checking out fresh CVS copy${DEFAULT_COLOR}"
       
       rm_source_dir /tmp/$MODULE-$VERSION
       mk_source_dir /tmp/$MODULE-$VERSION
+      cd /tmp/$MODULE-$VERSION
+    else
+      cd /tmp/$MODULE-$VERSION/$CVSMODULE
     fi
-    cd $CD
   fi
 
   verbose_msg "CVSROOT=\"$CVSROOT\""
 
-  if [[ -d $CVSMODULE/CVS ]]; then
-    verbose_msg "cvs -qz3 up -PAd $CVSRELEASE $CVSMODULE"
-    cvs -qz3 up -PAd $CVSRELEASE $CVSMODULE && GOT_CVS="yes" 
-  elif ! [[ -d CVS ]]; then
-    verbose_msg "cvs -qz3 co $CVSRELEASE $CVSMODULE"
-    cvs -qz3 co $CVSRELEASE $CVSMODULE && GOT_CVS="yes"
+  NUM_RETRY=${NUM_RETRY:-5}
+  if [ "$NUM_RETRY" -eq 0 ]; then
+    NUM_RETRY=1000
   fi
+
+  for (( TRY=1 ; $TRY<$NUM_RETRY+1 ; TRY++ )) ; do
+    if [ -d CVS ] ; then
+      verbose_msg "[${TRY}] cvs -qz3 up -PAd $CVSOPTIONS $CVSRELEASE"
+      cvs -qz3 up -PAd $CVSOPTIONS $CVSRELEASE && GOT_CVS="yes" 
+    else 
+      verbose_msg "[${TRY}] cvs -qz3 co $CVSOPTIONS $CVSRELEASE $CVSMODULE"
+      CVSROOT=$CVSROOT cvs -qz3 co $CVSOPTIONS $CVSRELEASE $CVSMODULE && GOT_CVS="yes"
+    fi
+
+    if [ "$?" == "0" ] ; then
+      break
+    fi
+
+    sleep 2
+  done
   
-  if [[ "$GOT_CVS" == "yes" ]]; then
-    message "${MESSAGE_COLOR}Creating ${FILE_COLOR}${SOURCE}${DEFAULT_COLOR}"
+  if [ "$GOT_CVS" == "yes" ] ; then
+    message "${MESSAGE_COLOR}Creating ${FILE_COLOR}${2}${DEFAULT_COLOR}"
     # pack in last component dir of $CVSMODULE
-    cd $(dirname $CVSMODULE)
-    tar cjf $SOURCE_CACHE/$2 $(basename $CVSMODULE)
+    cd /tmp/$MODULE-$VERSION/$(dirname $CVSMODULE)
+    tar cjf $2 $(basename $CVSMODULE)
     cd $CD
   else
     activity_log "lget"  "$MODULE"  "$VERSION"  "failed" "Could not get $CVSMODULE"
@@ -99,11 +183,12 @@
   cd /tmp
   rm_source_dir /tmp/$MODULE-$VERSION
 
-)}
+}
 
 
 erase()  {
-  if [ -z "$PARTIAL" ]; then
+  debug_msg "erase ($@)"
+  if [ "$PARTIAL" == "off" ]; then
     verbose_msg "erase: deleting \"$(guess_filename $1)\""
     rm -f $(guess_filename $1)
   fi
@@ -111,121 +196,117 @@
 
 
 call_wget()  {  
+  debug_msg "call_wget ($@)"
    [ -n "$http_proxy" ] && export http_proxy=$http_proxy
    [ -n  "$ftp_proxy" ] && export  ftp_proxy=$ftp_proxy
    [ -n   "$no_proxy" ] && export   no_proxy=$no_proxy
 
-   verbose_msg "calling \"wget $CACHE $RATE $FTP_CONNECTION $RETRIES $PARTIAL $1\""
-   wget $CACHE $RATE $FTP_CONNECTION $RETRIES $PARTIAL $1
+   debug_msg "call_wget: PWD=$PWD"
+   verbose_msg "calling \"wget $WGET_CACHE $WGET_RATE $WGET_FTP_CONNECTION $WGET_RETRIES $WGET_PARTIAL $1\""
+   wget $WGET_CACHE $WGET_RATE $WGET_FTP_CONNECTION $WGET_RETRIES $WGET_PARTIAL $1
 }
 
 
+# fuzzy_wget is a wrapper that tries to call possible mis-finenamed 
+# source tarballs (ie .tar.gz instead of .tar.bz2)
 fuzzy_wget()  {
+  debug_msg "fuzzy_wget ($@)"
 
-  FTP_CONNECTION="--passive-ftp"
-  [ "$FTP_ACTIVE"  == "on"   ] || 
-  [ "$FTP_PASSIVE" == "off"  ] && 
-  unset FTP_CONNECTION 
+  # this is what the download will be stored as initially:
+  TMP_FILE=/tmp/$(basename $2)
 
-  PARTIAL="-c"
-  [ "$CONTINUE" == "off" ] && unset PARTIAL
+  if [ "$FTP_ACTIVE" == "off" -o "$FTP_PASSIVE" == "on" ] ; then
+    WGET_FTP_CONNECTION="--passive-ftp"
+  fi
 
-  CACHE="--cache=on"
-  [ "$USE_CACHE" == "off" ] && CACHE="--cache=off"
+  if [ "$CONTINUE" == "off" ] ; then
+    erase $(guess_filename $TMP_FILE) 
+  else
+    WGET_PARTIAL="--continue"
+  fi
 
-  NUM_RETRY=${NUM_RETRY:=5}
-  RETRIES="--tries=${NUM_RETRY}"
+  if [ "$USE_CACHE" == "off" ] ; then
+    WGET_CACHE="--cache=off"
+  else
+    WGET_CACHE="--cache=on"
+  fi
 
-  [  -n  "$DOWNLOAD_RATE"  ] && RATE="--limit-rate=${DOWNLOAD_RATE}"
+  if [ -n "$DOWNLOAD_RATE" ] ; then
+    WGET_RATE="--limit-rate=${DOWNLOAD_RATE}"
+  fi
 
+  WGET_NUM_RETRY=${NUM_RETRY:=5}
+  WGET_RETRIES="--tries=${WGET_NUM_RETRY}"
   FUZZY=${FUZZY:=on}
 
-  S_FILE=`echo $2                 |
-          sed  "s/\.tar\.gz$//"   |
-          sed  "s/\.tgz$//"       |
-          sed  "s/\.tar\.bz2$//"`
+  S_FILE=$(basename $2 | sed -e "s/\.tar\.gz$//" -e "s/\.tgz$//" -e  "s/\.tar\.bz2$//")
 
-  if erase $1 && call_wget $1 ; then
-    FILE="$2"
+  if erase $2 && call_wget $1 ; then
+    FILE="$(basename $2)"
   elif [ "$FUZZY" == "off" ] ; then
     activity_log  "lget"  "$MODULE"  "$VERSION"  "failed" "broken URL: $1"
     return 1
-  elif erase $1 && call_wget $(dirname $1)/$S_FILE.tar.bz2 ; then
+  elif erase $2 && call_wget $(dirname $1)/$S_FILE.tar.bz2 ; then
     FILE="$S_FILE.tar.bz2"
-  elif erase $1 && call_wget $(dirname $1)/$S_FILE.tar.gz ; then
+  elif erase $2 && call_wget $(dirname $1)/$S_FILE.tar.gz ; then
     FILE="$S_FILE.tar.gz"
-  elif erase $1 && call_wget $(dirname $1)/$S_FILE.tgz ; then
+  elif erase $2 && call_wget $(dirname $1)/$S_FILE.tgz ; then
     FILE="$S_FILE.tgz"
   else
     activity_log  "lget"  "$MODULE"  "$VERSION"  "failed" "broken URL: $1"
-    false
-  fi
-
-}
-
-
-disconnect()  {
-
-  if    ps  -C disconnect  >  /dev/null
-  then  return
+    return 1
   fi
 
-  rm  -f           /tmp/disconnect
-  cat  <<  EOF  >  /tmp/disconnect
-#!/bin/sh
-
-while  ps  -A  |  grep  -q  "lget";  do  sleep  120;  done
-poff
-rm  -f  /tmp/disconnect
-EOF
-
-chmod  a+x  /tmp/disconnect
-            /tmp/disconnect  &
-
-}
-
-
-connect()  {
-
-  if  !  ifconfig  |  grep  -q  "^eth"   &&
-      !  ifconfig  |  grep  -q  "^wlan"  &&
-      !  ifconfig  |  grep  -q  "^ppp"   &&
-      !  ifconfig  |  grep  -q  "^tun";  then
-    pon
-
-    # Timeout in deciseconds to wait for Interface to come up.
-    TIMEOUT=30
-
-    until  ifconfig  |  grep  -q  eth   ||
-           ifconfig  |  grep  -q  ppp   ||
-           [  $TIMEOUT == 0  ]
-    do
-      sleep  10
-      (( TIMEOUT-- ))
-    done
-    disconnect
-
+  TMP_RESULTFILE=$(guess_filename $TMP_FILE)
+  if testpack $TMP_RESULTFILE ; then
+    install -m644 $TMP_RESULTFILE $(dirname $2)/$(basename $TMP_RESULTFILE)
+    rm $(guess_filename $TMP_RESULTFILE)
+    verbose_msg "download of \"$1\" successfull"
+  else
+    rm -f $(guess_filename $TMP_RESULTFILE)
   fi
-
 }
 
 
+# function: get_url
+# usage   : get_url URL DESTINATION
+#
+#   if left blank, destination defaults to $SOURCE_CACHE/$(filename URL)
+#   if specified, the remainder will be copied to $DESTINATION
+#
 get_url() {
-  if  [  -n  "$1"  ] ;  then
+(
+  cd /tmp
+  debug_msg "get_url ($@)"
+  if [ -n "$1" ] ; then
     if [ "${1:0:6}" == "cvs://" ] ; then
       # cvs urls
       CVS_THRESHOLD=${CVS_THRESHOLD:-10}
       if [ "$CVS_THRESHOLD" > 0 ] ; then
-        if [ ! -f $SOURCE_CACHE/$2 ] ; then
+        if [ ! -f "$2" ] ; then
 	  get_cvs $1 $2
-        elif [ "$(find $SOURCE_CACHE/$2 -amin +$CVS_THRESHOLD)" == "$SOURCE_CACHE/$2" ] ; then
+        elif [ "$(find $2 -amin +$CVS_THRESHOLD)" == "$2" ] ; then
 	  get_cvs $1 $2
 	else
-	  verbose_msg "skipping cvs update (less than $CVS_THRESHOLD mins old)"
+	  verbose_msg "Skipping cvs update (less than $CVS_THRESHOLD mins old)"
 	fi
       else
         get_cvs $1 $2
       fi
+    elif [ "${1:0:6}" == "svn://" ] ; then
+      # svn urls
+      SVN_THRESHOLD=${SVN_THRESHOLD:-10}
+      if [ "SVN_THRESHOLD" > 0 ] ; then
+        if [ ! -f "$2" ] ; then
+	  get_svn $1 $2
+	elif [ "$(find $2 -amin +$SVN_THRESHOLD)" == "$2" ] ; then
+	  get_svn $1 $2
+	else
+	  verbose_msg "Skipping svn update (less than $SVN_THRESHOLD mins old)"
+	fi
+      else
+        get_svn $1 $2
+      fi
     elif [ "$1:0:7}" == "cpan://" ] ; then
       # no way, this cannot be tru
       #
@@ -233,36 +314,41 @@
       # fetching sources and possibly have 'CPAN' do all the work for us
       # thereby not opposing the normal perl module modules (like File-Tail)
       #
+      # TODO play with this
       :
+    elif [ "{$1:0:5}" == "file:" ] ; then
+      # adding this since wget is a bitch and will not fetch this... sigh
+      # this will copy file to $2... so you may use it as you like
+      cp ${1/file:/} $2
     else
       # ordinary URL's handled by fuzzy_wget
-      if  [  -n  "$BASE_URL"  ];  then
-        URL=$BASE_URL/$2
+      if [ -n "$BASE_URL" ] ; then
+        URL=$BASE_URL/$(basename 2)
       fi
       connect          &&
       if [ -n "$BASE_URL" ] ; then
-        fuzzy_wget $BASE_URL/$2 $2
+        fuzzy_wget $BASE_URL/$(basename $2) $2
       elif ! fuzzy_wget $1 $2 ; then
         if [ -n "$LRESORT_URL" ] ; then
-          fuzzy_wget $LRESORT_URL/$2 $2
+          fuzzy_wget $LRESORT_URL/$(basename 2) $2
         fi
-      fi               &&
-      testpack  $2     &&
-      mv        $2  $SOURCE_CACHE &&
-      verbose_msg "download of \"$1\" successfull"
+      fi
     fi
   fi
+)
 }
 
 
 lget_lock()  {
-  echo $$ > /var/lock/lgetting.$MODULE
+  debug_msg "lget_lock ($@)"
+  echo $$ > /var/lock/lgetting.$1
 }
 
 
 lget_locked()  {
-  if [ -f "/var/lock/lgetting.$MODULE" ] &&
-        ps `cat /var/lock/lgetting.$MODULE` | grep  -q  "lget" ; then
+  debug_msg "lget_locked ($@)"
+  if [ -f "/var/lock/lgetting.$1" ] &&
+        ps `cat /var/lock/lgetting.$1` | grep  -q  "lget" ; then
     true
   else
     false
@@ -271,21 +357,25 @@
 
 
 lget_unlock()  {
-  rm -f /var/lock/lgetting.$MODULE &> /dev/null
+  debug_msg "lget_unlock ($@)"
+  rm -f /var/lock/lgetting.$1 &> /dev/null
 }
 
 
-download_module() { (
-
-  run_details $1 || exit 1
+download_module() {
+(
+  debug_msg "download_module ($@)"
+  if ! run_details $1 ; then
+    exit 1
+  fi
 
   MAX_SOURCES=${MAX_SOURCES:=100}
 
   # loop over all sources
   for (( N = 0 ; N < MAX_SOURCES ; N++ )) ; do
     # get the URL part
-    eval  SRC=\$$(echo SOURCE$N          | sed s/SOURCE0/SOURCE/  )
-    eval URLS=\${$(echo SOURCE${N}_URL    | sed s/SOURCE0/SOURCE/  )[@]}
+    eval SRC=\$$(echo SOURCE$N | sed s/SOURCE0/SOURCE/ )
+    eval URLS=\${$(echo SOURCE${N}_URL | sed s/SOURCE0/SOURCE/ )[@]}
 
     # continue (to next) if empty once, break if empty tiwce
     if [ -z "$SRC" ] ; then
@@ -310,12 +400,15 @@
       fi
 
       # quit if we did get it
-      if `guess_filename $SOURCE_CACHE/$SRC > /dev/null` ; then
-        if [ ${URL:0:6} == "cvs://" ] ; then
+      if [ -f "$(guess_filename $SOURCE_CACHE/$SRC)" ] ; then
+        if [ "${URL:0:6}" == "cvs://" ] ; then
 	  verbose_msg "trying to download \"$URL\""
-	  get_url $URL $SRC
+	  get_url $URL $SOURCE_CACHE/$SRC
+	elif [ "${URL:0:6}" == "svn://" ] ; then
+	  verbose_msg "trying to download \"$URL\""
+	  get_url $URL $SOURCE_CACHE/$SRC
 	else
-	  verbose_msg "skipping download of \"$SRC\" for module \"$MODULE\" (in cache)"
+	  verbose_msg "Skipping download of \"$SRC\" for module \"$MODULE\" (in cache)"
 	  continue 2
 	fi
       else
@@ -324,19 +417,22 @@
                  "${MESSAGE_COLOR}for module"               \
                  "${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
         verbose_msg "trying to download \"$URL\""
-	get_url $URL $SRC
+	get_url $URL $SOURCE_CACHE/$SRC
       fi
       
     done
   done
-  
-) }
+
+  return 0
+) 
+}
 
 
 testpack () {
-  FILENAME=`guess_filename $1` || FILENAME=`guess_filename $SOURCE_CACHE/$1`
-  if [ -f $FILENAME ] ; then
-    COMPRESSOR=`file -b $FILENAME | cut -d ' ' -f1`
+  debug_msg "testpack ($@)"
+  FILENAME=$(guess_filename $1) || FILENAME=$(guess_filename $SOURCE_CACHE/$1)
+  if [ -f "$FILENAME" ] ; then
+    COMPRESSOR=$(file -b $FILENAME | cut -d ' ' -f1)
     case $COMPRESSOR in
       bzip2)     bzip2 -tf  $FILENAME           >/dev/null 2>&1   ;;
       gzip)      gzip  -tf  $FILENAME           >/dev/null 2>&1   ;;

Index: edit.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/edit.lunar,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- edit.lunar	16 Apr 2003 19:47:09 -0000	1.3
+++ edit.lunar	10 Aug 2003 01:16:22 -0000	1.4
@@ -1,4 +1,4 @@
-####################################################################
+#!/bin/bash
 #                                                                  #
 #  edit.lunar - functions to edit files                            #
 #                                                                  #
@@ -15,8 +15,7 @@
 # usage    : patch_it patch_file patch_level
 # purpose  : calls "patch -px < $filename", where filename may be a variety
 #            of formats
-patch_it ()
-{ 
+patch_it () { 
   verbose_msg "patch_it \"$1\" \"$2\"";
   
   if [[ -n `echo $1 | grep .tar` ]] ; then
@@ -33,8 +32,8 @@
     GZCMD="cat"
   fi
 
-  TMPFILE1=/tmp/lunar.patch.`uuidgen`
-  TMPFILE2=/tmp/lunar.patch.`uuidgen`
+  TMPFILE1=$(temp_create "patch_1")
+  TMPFILE2=$(temp_create "patch_2")
 
   if $GZCMD $1 > $TMPFILE1 ; then
     # uncompress OK
@@ -42,14 +41,17 @@
       # untar OK
       if patch -N -p$2 < $TMPFILE2 ; then
         # patch cmd is OK
-	rm -f $TMPFILE1 $TMPFILE2
+        temp_destroy $TMPFILE1
+        temp_destroy $TMPFILE2
         return 0
       fi
     fi
   fi
 
-  message "${PROBLEM_COLOR}Broken patch file \"$1\"!${DEFAULT_COLOR}"
-  rm -f $TMPFILE1 $TMPFILE2
+  message "${PROBLEM_COLOR}! Broken patch file ${DEFAULT_COLOR}${FILE_COLOR}$1${DEFAULT_COLOR}"
+
+  temp_destroy $TMPFILE1
+  temp_destroy $TMPFILE2
   return -1
 }
 
@@ -57,8 +59,7 @@
 # function : sedit
 # usage    : sedit sed-statement file [file [file] ...]
 # purpose  : edit [files] with a sed function
-sedit ()
-{ 
+sedit () { 
     SEDIT=$1;
     shift;
     for FILE in $@;
@@ -73,6 +74,7 @@
 # usage    : edit_file FILENAME
 # purpose  : to edit a file
 edit_file() {
+  debug_msg "edit_file ($@)"
   ${EDITOR:-nano}  $1
 }
 

Index: locking.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/locking.lunar,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- locking.lunar	15 Mar 2003 18:53:31 -0000	1.2
+++ locking.lunar	10 Aug 2003 01:16:22 -0000	1.3
@@ -1,4 +1,4 @@
-############################################################
+#!/bin/bash
 #                                                          #
 # This code is written for Lunar Linux, see                #
 # http://www.lunar-linux.org                               #
@@ -19,10 +19,8 @@
 # function: lock_file
 # usage   : lock_file <absolute file name>
 # purpose : locks a file or wait until. Better use as lock_file <file> && || etc
-function lock_file()
-{
-   function file_lock()
-   {
+function lock_file() {
+   function file_lock() {
       #locking is disabled if ln or rm not found!!
       [ -x "/bin/ln" ] || return 0
       [ -x "/bin/rm" ] || return 0
@@ -71,11 +69,10 @@
 # function: unlock_file
 # usage   : unlock_file <absolute file name>
 # purpose : unlocks a file
-function unlock_file()
-{
-#unlocking is disabled if rm not found!!
-   [ -x "/bin/rm" ] || return 0
-   rm -f $1.lock 2>/dev/null && return 0
-   return 1
+function unlock_file() {
+  #unlocking is disabled if rm not found!!
+  [ -x "/bin/rm" ] || return 0
+  rm -f $1.lock 2>/dev/null && return 0
+  return 1
 }
 

Index: messages.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/messages.lunar,v
retrieving revision 1.2
retrieving revision 1.3
diff -u -d -r1.2 -r1.3
--- messages.lunar	16 Apr 2003 19:47:09 -0000	1.2
+++ messages.lunar	10 Aug 2003 01:16:22 -0000	1.3
@@ -1,4 +1,4 @@
-############################################################
+#!/bin/bash
 #                                                          #
 #  messages - lunar message display functions              #
 #                                                          #
@@ -30,36 +30,57 @@
 
 
 message() {
-  [ -n "$SILENT" ] || echo  -e  "$*"
+  if [ -z "$SILENT" ] ; then
+    echo -e "$*"
+  fi
 }
 
 
 verbose_msg() {
-  [ "$VERBOSE" != "on" ] || message "+ $*"
+  if [ "$VERBOSE" == "on" ] ; then
+    message "+ $*"
+  fi
+}
+
+
+debug_msg() {
+  if [ -n "$LUNAR_DEBUG" ] ; then
+    echo "++ $@" > /dev/stderr
+    if [ "$LUNAR_DEBUG" -ge "2" ] ; then
+      echo "++ $@" >> /tmp/lp_debuglog.$$
+      if [ -f /tmp/l_debug_var.$$ ] ; then
+        mv /tmp/l_debug_var.$$ /tmp/l_debug_var.$$.old
+      fi 
+      set | grep '^[A-Z]' | sed 's/^/VAR /' > /tmp/l_debug_var.$$
+      diff -U0 /tmp/l_debug_var.$$.old /tmp/l_debug_var.$$ | \
+          grep -v "^@@" | grep "VAR" | tee -a /tmp/lp_debuglog.$$ > /dev/stderr
+    fi
+  fi
 }
 
 
+# function : report FILE [description] MODULE VERSION
 report() {
-  if  [  ! -f  "$1"  ]; then
+  debug_msg "report ($@)"
+  if [ ! -f "$1" ] ; then
     return
   fi
 
-  if  [  "$VIEW_REPORTS"  ==  "on"  ];  then
-    VIEW_PROMPT="View $2 for ${MODULE_COLOR}${MODULE}-${VERSION_COLOR}${VERSION}${DEFAULT_COLOR}?"
-    sound  REPORT
-    if  query  "$VIEW_PROMPT" n; then
+  if [ "$VIEW_REPORTS" == "on" ] ; then
+    sound REPORT
+    if query "View $2 for ${MODULE_COLOR}${3}-${VERSION_COLOR}${4}${DEFAULT_COLOR}${QUERY_COLOR} ?" n ; then
       view_file $1
     fi
   fi
 
-  if  [  "$MAIL_REPORTS"  ==  "on"  ];  then
-    MAILTEMP="/tmp/lunar.mail.`uuidgen`" 
-    date  -u  > $MAILTEMP
-    echo     >> $MAILTEMP
-    cat $1   >> $MAILTEMP
-    mail  -s  "Lunar Report from $HOSTNAME : $2 for $MODULE-$VERSION"  \
-              $ADMIN  < $MAILTEMP  2>/dev/null
-    rm -f $MAILTEMP 2>/dev/null
+  if [ "$MAIL_REPORTS" == "on" ] ; then
+    TMP_MAIL=$(temp_create "mailreport")
+    date -u > $TMP_MAIL
+    echo >> $TMP_MAIL
+    view_file $1 >> $TMP_MAIL
+    mail -s "Lunar Report from $HOSTNAME : $2 for $3-$4"  \
+              $ADMIN < $TMP_MAIL 2>/dev/null
+    temp_destroy $TMP_MAIL
   fi
 
   true
@@ -67,6 +88,7 @@
 
 
 query() {
+  debug_msg "query ($@)"
   #  2 arguments
   #  query  "what do you want?  "  DEFAULT
 
@@ -102,6 +124,7 @@
 
 
 color()  {
+  debug_msg "color ($@)"
   case  $1  in
     off)  unset  MODULE_COLOR
           unset  VERSION_COLOR
@@ -123,9 +146,10 @@
 
 
 sound()  {
+  debug_msg "sound ($@)"
   case  $SOUND  in
     on)  SOUND_FILE=$SOUND_DIRECTORY/$SOUND_THEME/$1
-         if  [  -e  $SOUND_FILE  ];  then
+         if  [  -e "$SOUND_FILE" ] ; then
            (  cd  /  ;  play  $SOUND_FILE  & )
          fi
     ;;
@@ -137,6 +161,7 @@
 # usage    : show_fancy_progress <fancy_progress_var_string>
 # purpose  : display progress ex: show_fancy_progress "Processing: $MODULE"
 show_fancy_progress () {
+  debug_msg "show_fancy_progress  ($@)"
    echo -en "\r                                                                            \r$1\r"
 }
 

Index: modules.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/modules.lunar,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- modules.lunar	16 Apr 2003 19:47:09 -0000	1.7
+++ modules.lunar	10 Aug 2003 01:16:22 -0000	1.8
@@ -1,4 +1,4 @@
-############################################################
+#!/bin/bash
 #                                                          #
 # This code is written for Lunar Linux, see                #
 # http://www.lunar-linux.org                               #
@@ -7,40 +7,44 @@
 #                                                          #
 # $FUNCTIONS/modules                                       #
 # includes create_module_index, find_section               #
-#          list_sections, list_modules                     #
-#          get_moonbase_md5, set_moonbase_md5,             #
+#          list_sections, list_modules, list_installed     #
 #          check_module_index, run_details                 #
 #          module_installed, module_held, module_exiled    #
+#          hold_modules, unhold_modules                    #
 # 20020528                                                 #
 # 20030113 merging more functions in here - sofar          #
+# 20030417 adding hold routines - sofar                    #
 #                                                          #
 ############################################################
 #                                                          #
 # Copyrighted Kagan Kongar 2002 under GPLv2                #
 # Portions Copyrighted Chuck Mead 2002 under GPLv2         #
+# Portions Copyrighted Auke Kok 2003 under GPLv2           #
 #                                                          #
 ############################################################
 
+
 # function : list_sections
 # usage    : list_sections
 # purpose  : list the moonbase sections, filter out the specific files
 list_sections() {
-   check_module_index                                        &&
-   SECTIONS=`grep -v ^MOONBASE_MD5 $MODULE_INDEX  2>/dev/null | \
-             cut -d : -f 2-2                                  | \
-             sort                                             | \
-             uniq`
-   [ -n "$SECTIONS" ] && echo "$SECTIONS" && return 0
+  debug_msg "list_sections ($@)"
+  check_module_index
+  SECTIONS=$(grep -v ^MOONBASE_MD5 $MODULE_INDEX  2>/dev/null | \
+             cut -d : -f 2-2 | sort | uniq)
+  if [ -n "$SECTIONS" ] ; then
+    echo "$SECTIONS"
+    return 0
+  fi
 
-   SECTIONS=`ls  $MOONBASE       | \
-             grep -v "ChangeLog" | \
-             grep -v "CVS"       | \
-             grep -v "COPYING"   | \
-             grep -v "LICENSE"   | \
-             grep -v "README"`
-   [ -n "$SECTIONS" ] && echo "$SECTIONS" && return 0
+  SECTIONS=$(ls $MOONBASE | grep -v -e "ChangeLog" -e "CVS" -e "COPYING" \
+            -e "LICENSE" -e "README")
+  if [ -n "$SECTIONS" ] ; then
+    echo "$SECTIONS"
+    return 0
+  fi
 
-   return 1
+  return 1
 }
 
 
@@ -48,101 +52,101 @@
 # usage    : list_modules $SECTION
 # purpose  : list the modules in a section, filter out the specific files
 list_modules() {
+  debug_msg "list_modules ($@)"
   if [ -z "$1" ] ; then
     message "${PROBLEM_COLOR}list_modules(): no SECTION defined!${DEFAULT_COLOR}" 
     exit 1
   fi
 
-   for  MODULE  in  `ls $MOONBASE/$1 2>/dev/null | \
-                     grep -v "ChangeLog"               | \
-                     grep -v "CVS"                     | \
-                     grep -v "COPYING"                 | \
-                     grep -v "LICENSE"                 | \
-                     grep -v "README"`
-   do
-      echo "$MODULE" 
-   done
-   return 0
+  for MODULE in $(ls $MOONBASE/$1 2>/dev/null | \
+      grep -v -e "ChangeLog" -e "CVS" -e "COPYING" -e "LICENSE" -e "README")
+  do
+    echo "$MODULE" 
+  done
+  return 0
 }
 
+
 # function : list_moonbase
 # usage    : list_moonbase
 # purpose  : returns the names of all modules in moonbase
-list_moonbase()
-{
-  for  SECTION  in  $(list_sections) ;  do
+list_moonbase() {
+  debug_msg "list_moonbase ($@)"
+  for SECTION in $(list_sections) ; do
     list_modules $SECTION
   done				
 }
 
 
-# function : set_moonbase_md5
-# usage    : set_moonbase_md5
-# purpose  : creates the md5 value of overall moonbase
-set_moonbase_md5()
-{
-   MOONBASE_MD5=`echo $MOONBASE/*/* | md5sum | cut -d "-" -f 1-1`
-   echo $MOONBASE_MD5
+# function : list_installed
+# usage    : list_installed
+# purpose  : return a list of installed (or held) modules
+list_installed() {
+  debug_msg "list_installed ($@)"
+  grep -e ":installed:" -e ":held:" $MODULE_STATUS | cut -d: -f1 | sort
 }
 
 
-# function : get_moonbase_md5
-# usage    : get_moonbase_md5
-# purpose  : graps the MOONBASE_MD5 line from the $MODULE_INDEX
-get_moonbase_md5() 
-{
-   MOONBASE_MD5=`grep ^MOONBASE_MD5: $MODULE_INDEX | tail -1 2>/dev/null | \
-                 cut -d : -f 2-2`
-   [ -z "$MOONBASE_MD5" ] && MOONBASE_MD5="0"
-   echo "$MOONBASE_MD5"
-}
-
 # function: create_module_index
 # usage   : create_module_index
 # purpose : created an index file of module:section pair list
-create_module_index()
-{
-   remove_module_index()
-   {
-      lock_file $MODULE_INDEX
-      [ -f "$MODULE_INDEX" ] && cp $MODULE_INDEX /tmp && rm -f $MODULE_INDEX 2>/dev/null
-      unlock_file $MODULE_INDEX
-   }
+create_module_index() {
+  debug_msg "create_module_index ($@)"
+  # make sure it exists before trying to see it's writeable
+  touch $MODULE_INDEX &> /dev/null
+  
+  # silently fail if we cannot write to $MODULE_INDEX, it is okay
+  # for this to fail in case we are a mere user using lvu's search
+  # functionality
+  if [ ! -w "$MODULE_INDEX" ] ; then
+    return 0
+  fi
 
-   MODULE_INDEX=${MODULE_INDEX:=/var/state/lunar/module.index}
-   remove_module_index
+  lock_file $MODULE_INDEX || return 1
 
-   lock_file $MODULE_INDEX || return 1
+  rm -f $MODULE_INDEX 2>/dev/null
 
-   echo MOONBASE_MD5:`set_moonbase_md5` > $MODULE_INDEX
-   for  SECTION  in  $(list_sections) ; do
-      list_modules $SECTION | sed "s/$/:$SECTION/" >> $MODULE_INDEX
-    done
-   unlock_file $MODULE_INDEX
+  echo MOONBASE_MD5:`set_moonbase_md5` > $MODULE_INDEX
+  for SECTION in $(list_sections) ; do
+    list_modules $SECTION | sed "s/$/:$SECTION/" >> $MODULE_INDEX
+  done
+
+  unlock_file $MODULE_INDEX
 }  
 
+
 # function: check_module_index
 # usage   : check_module_index
 # purpose : checks if the index is up-to-date regarding to moonbase
-function check_module_index()
-{
-  [ `get_moonbase_md5` != `set_moonbase_md5` ] &&
-  [ "$UID" == "0" ]                            &&
-  create_module_index                          &&
-  return 0
-  return 1
+function check_module_index() {
+  debug_msg "function check_module_index ($@)"
+  if [ $(get_moonbase_md5) != $(set_moonbase_md5) ] ; then
+    create_module_index
+    return 0
+  else
+    return 1
+  fi
 }
 
+
 # function : find_section
 # usage    : find_section "module name"
 # purpose  : finds the section of a given module as parameter
-find_section()  
-{
-  local SECTION
+# returns  : (0) on success, (1) on failure, errors on stdout
+find_section() {
+  debug_msg "find_section ($@)"
 
-  SECTION=`grep ^$1: $MODULE_INDEX 2>/dev/null | head -n 1 | cut -d : -f 2-2`
+  ZLOCAL_OVERRIDES=${ZLOCAL_OVERRIDES:=off}
+  if [ "$ZLOCAL_OVERRIDES" == "on" ] ; then
+    if [ -d "$MOONBASE/zlocal/$1" ] ; then
+      echo "zlocal"
+      return 0
+    fi
+  fi
+
+  SECTION=$(grep ^$1: $MODULE_INDEX 2>/dev/null | head -n 1 | cut -d: -f2)
   if [ -n "$SECTION" ] ; then
-    if [ -d $MOONBASE/$SECTION/$1 ] ; then
+    if [ -d "$MOONBASE/$SECTION/$1" ] ; then
       echo "$SECTION"
       return 0
     fi
@@ -150,15 +154,15 @@
 
   check_module_index
 
-  SECTION=`grep ^$1: $MODULE_INDEX 2>/dev/null | head -n 1 | cut -d : -f 2-2` 
+  SECTION=$(grep ^$1: $MODULE_INDEX 2>/dev/null | head -n 1 | cut -d: -f2)
   if [ -n "$SECTION" ] ; then
-    if [ -d $MOONBASE/$SECTION/$1 ] ; then
+    if [ -d "$MOONBASE/$SECTION/$1" ] ; then
       echo "$SECTION"
       return 0
     fi
   fi
            
-  for  SECTION  in  $(list_sections) ; do
+  for SECTION in $(list_sections) ; do
     if [ -n "$(list_modules $SECTION | grep ^$MODULE$ )" ] ; then
       echo "$SECTION"
       return 0
@@ -168,77 +172,171 @@
   return 1
 }
 
+
 # function : run_details
-# usage    : run_details |module_name| ($MODULE is pre-defined or param)
+# usage    : run_details module_name ($MODULE is pre-defined or param)
 # purpose  : runs the DETAILS file of a module
+# returns  : (0) on success, (1) on failure, error messages on stdout
 run_details() {
+  debug_msg "run_details ($@)"
+  # Note: run_details doesn't EXIT the code, but merely drops a warning
+  # (return 1), which means that the calling code needs to decide 
+  # if this is a problem or not... -sofar
 
-   [ -z "$MODULE" ] && [ -z "$1" ] && return 1
-   [ -n "$1" ] && MODULE="$1"
-
-   local SECTION=$(find_section $MODULE)
-   [ -d "$MOONBASE/$SECTION/$MODULE" ] || {
-      message  "${PROBLEM_COLOR}Unable to find module"    \
-               "${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"  \
-               "${PROBLEM_COLOR}in ${FILE_COLOR}$MOONBASE${DEFAULT_COLOR}"
-      return 1
-   }
-
-   [ -f "$MOONBASE/$SECTION/$MODULE/DETAILS" ] || {
-      message  "${PROBLEM_COLOR}Module ${MODULE_COLOR}${MODULE}" \
+  if ! SECTION=$(find_section $1) ; then
+    message  "${PROBLEM_COLOR}Unable to find module ${MODULE_COLOR}${1}${DEFAULT_COLOR}"  \
+             "${PROBLEM_COLOR}in ${FILE_COLOR}$MOONBASE${DEFAULT_COLOR}"
+    return 1
+  else
+    if [ ! -f "$MOONBASE/$SECTION/$1/DETAILS" ] ; then
+      message  "${PROBLEM_COLOR}Module ${MODULE_COLOR}${1}" \
                "${DEFAULT_COLOR}${PROBLEM_COLOR}has no ${FILE_COLOR}DETAILS" \
-	       "${DEFAULT_COLOR}${PROBLEM_COLOR}file!${DEFAULT_COLOR}"
+               "${DEFAULT_COLOR}${PROBLEM_COLOR}file!${DEFAULT_COLOR}"
       return 1
-   }
+    fi
    
-   SCRIPT_DIRECTORY=$MOONBASE/$SECTION/$MODULE
-   . $SCRIPT_DIRECTORY/DETAILS &>/dev/null &&
-   SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-$BUILD_DIRECTORY/$MODULE-$VERSION}
+    SCRIPT_DIRECTORY=$MOONBASE/$SECTION/$1
+    run_module_file $1 DETAILS &> /dev/null &&
+    SOURCE_DIRECTORY=${SOURCE_DIRECTORY:-$BUILD_DIRECTORY/$1-$VERSION}
+    MODULE_CONFIG=${MODULE_CONFIG:-$DEPENDS_CONFIG/$1}
 
-   return 0        
+    return 0
+  fi
 }
 
+
 # function : run_module_file
-# usage    : run_module_file <script_name> SCRIPT_DIRECTORY MUST be predefined
+# usage    : run_module_file $MODULE $SCRIPTNAME 
 # purpose  : runs the given script for a pre-defined module
-run_module_file()
-{
-   [ -z "$SCRIPT_DIRECTORY" ]  && return 1
-   [ -s "$SCRIPT_DIRECTORY/$1" ] || return 1
-   verbose_msg "running \"$MODULE\" \"$1\" file"
-   [ "$TEST" != "on" ] && . $SCRIPT_DIRECTORY/$1 > /dev/null
+run_module_file() {
+  debug_msg "run_module_file ($@)"
+  if [ -z "$SCRIPT_DIRECTORY" ] ; then
+    if ! run_details $1 &> /dev/null ; then
+      return 1
+    fi
+  fi
+  if [ -e "$SCRIPT_DIRECTORY/$2" ] ; then
+    . $SCRIPT_DIRECTORY/$2
+  fi    
 }
 
 
-module_installed()
-{
-   if grep -q "^$1\:" $MODULE_STATUS 2>/dev/null ; then
-     STAT=`grep "^$1\:"        $MODULE_STATUS | tail -1 2>/dev/null | cut -d : -f3`
-   else
-     STAT=`grep "^$1-custom\:" $MODULE_STATUS | tail -1 2>/dev/null | cut -d : -f3`
-   fi
-   [  "$STAT"  ==  "installed"  ]
+# function : module_installed
+# usage    : module_installed $MODULE
+# purpose  : check if $MODULE is installed (or held)
+module_installed() {
+  $(cat $MODULE_STATUS | cut -d: -f1,3 | grep -q -e "^$1:installed" -e "^$1:held")
 }
 
 
+# function : module_held
+# usage    : module_held $MODULE
+# purpose  : check if $MODULE is held
 module_held() {
-   STAT=`grep "^$1\:" $MODULE_STATUS | tail -1 2>/dev/null | cut -d : -f3` &&
-   [ "$STAT" == "held" ]
+  debug_msg "module_held ($@)"
+  $(cat $MODULE_STATUS | cut -d: -f1,3 | grep -q "^$1:held")
 }
 
 
-module_exiled()  {
-   STAT=`grep "^$1\:" $MODULE_STATUS | tail -1 2>/dev/null | cut -d : -f3` &&
-   [ "$STAT" == "exiled" ]
+# function : module_exiled
+# usage    : module_exiled $MODULE
+# purpose  : check if $MODULE is exiled
+module_exiled() {
+  debug_msg "module_exiled ($@)"
+  $(cat $MODULE_STATUS | cut -d: -f1,3 | grep -q "^$1:exiled")
 }
 
 
+# function : installed_version
+# usage    : installed_version $MODULE
+# purpose  : return the installed version of $MODULE
 installed_version() {
-   if grep -q "^$1\:" $MODULE_STATUS 2>/dev/null ; then
-     echo `grep "^$1\:"        $MODULE_STATUS | tail -1 2>/dev/null | cut -d : -f4`
-   else  
-     echo `grep "^$1-custom\:" $MODULE_STATUS | tail -1 2>/dev/null | cut -d : -f4`
-   fi
+  debug_msg "installed_version ($@)"
+  grep "^$1:" $MODULE_STATUS | cut -d: -f4
+}
+
+
+# function : hold_modules
+# usage    : hold_modules $MODULE [$MODULE....]
+# purpose  : put modules on hold
+hold_modules() {
+  debug_msg "hold_modules ($@)"
+  if [ -n "$1" ] ; then
+    lock_file $MODULE_STATUS_BACKUP
+    lock_file $MODULE_STATUS
+    for MODULE in "$@" ; do
+      grep -v "^$MODULE:" $MODULE_STATUS > $MODULE_STATUS_BACKUP
+      grep "^$MODULE:" $MODULE_STATUS | sed "s:installed:held:" >> $MODULE_STATUS_BACKUP
+      cp $MODULE_STATUS_BACKUP $MODULE_STATUS
+    done
+    unlock_file $MODULE_STATUS
+    unlock_file $MODULE_STATUS_BACKUP
+  fi
+}
+
+
+# function : unhold_modules
+# usage    : unhold_modules $MODULE [$MODULE....]
+# purpose  : put modules on hold back to normal
+unhold_modules () {
+  debug_msg "unhold_modules  ($@)"
+  if [ -n "$1" ] ; then
+    lock_file $MODULE_STATUS_BACKUP
+    lock_file $MODULE_STATUS
+    for MODULE in "$@" ; do
+      grep -v "^$MODULE:" $MODULE_STATUS > $MODULE_STATUS_BACKUP
+      grep "^$MODULE:" $MODULE_STATUS | sed "s:held:installed:" >> $MODULE_STATUS_BACKUP
+      cp $MODULE_STATUS_BACKUP $MODULE_STATUS
+    done
+    unlock_file $MODULE_STATUS
+    unlock_file $MODULE_STATUS_BACKUP
+  fi
+}
+
+
+# function : exile_modules
+# usage    : exile_modules $MODULE [$MODULE....]
+# purpose  : put modules on exile
+exile_modules() {
+  debug_msg "exile_modules ($@)"
+  if [ -n "$1" ] ; then
+    lock_file $MODULE_STATUS_BACKUP
+    lock_file $MODULE_STATUS
+    for MODULE in "$@" ; do
+      grep -v "^$MODULE:" $MODULE_STATUS > $MODULE_STATUS_BACKUP
+      grep "^$MODULE:" $MODULE_STATUS | sed "s:installed:exiled:" >> $MODULE_STATUS_BACKUP
+      cp $MODULE_STATUS_BACKUP $MODULE_STATUS
+    done
+    unlock_file $MODULE_STATUS
+    unlock_file $MODULE_STATUS_BACKUP
+  fi
 }
 
 
+# function : unexile_modules
+# usage    : unexile_modules $MODULE [$MODULE....]
+# purpose  : put modules on exile back to normal
+unexile_modules () {
+  debug_msg "unexile_modules  ($@)"
+  if [ -n "$1" ] ; then
+    lock_file $MODULE_STATUS_BACKUP
+    lock_file $MODULE_STATUS
+    for MODULE in "$@" ; do
+      grep -v "^$MODULE:" $MODULE_STATUS > $MODULE_STATUS_BACKUP
+      grep "^$MODULE:" $MODULE_STATUS | sed "s:exiled:installed:" >> $MODULE_STATUS_BACKUP
+      cp $MODULE_STATUS_BACKUP $MODULE_STATUS
+    done
+    unlock_file $MODULE_STATUS
+    unlock_file $MODULE_STATUS_BACKUP
+  fi
+}
+
+
+module_needs_update () {
+  debug_msg "module_needs_update  ($@)"
+  if [ -n "$1" ] ; then
+    :
+  else
+    return 1
+  fi
+}

Index: moonbase.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/moonbase.lunar,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- moonbase.lunar	17 Jun 2003 14:22:59 -0000	1.3
+++ moonbase.lunar	10 Aug 2003 01:16:22 -0000	1.4
@@ -1,4 +1,4 @@
-############################################################
+#!/bin/bash
 #                                                          #
 # moonbase.lunar - get moonbase from the net               #
 #                                                          #
@@ -9,50 +9,97 @@
 ############################################################
 
 
-get_moonbase () {(
+get_moonbase () {
+(
+  debug_msg "get_moonbase  ($@)"
 
-  cd /tmp
+  SYSTEM_MOONBASE=/var/lib/lunar/moonbase
 
-  if [ "$UNIQID" == "" ]; then
-    mk_uniqid;
-  fi
+  # the following overrides run_details:
+  run_details() {
+  debug_msg "  run_details ($@)"
+        MODULE=moonbase
+       VERSION=`date -u +%Y%m%d.%H`
+        SOURCE=$(basename $MOONBASE_URL)
+    SOURCE_URL=${MOONBASE_URL[@]}
+         FUZZY=off
+       PARTIAL=off
+   CLEAR_CACHE=on
+  }
 
-  MODULE=moonbase
-  VERSION=`date -u +%Y%m%d.%H`
-  SOURCE=$(basename $MOONBASE_URL)
+  # make sure we set these values up front to be sure
+  run_details
+  rm -f /tmp/$SOURCE
 
-  [ ! -d /var/lib/lunar/moonbase ] && mkdir -p /var/lib/lunar/moonbase
-  [ ! -d /var/lib/lunar/moonbase/zlocal ] && mkdir -p /var/lib/lunar/moonbase/zlocal
+  if [ ! -d "$SYSTEM_MOONBASE" ] ; then
+    mkdir -p $SYSTEM_MOONBASE
+  fi
   
-  echo -e "${MESSAGE_COLOR}Downloading ${FILE_COLOR}${SOURCE}" \
-          "${DEFAULT_COLOR}${MESSAGE_COLOR}...${DEFAULT_COLOR}"
-
-  export FUZZY=off PARTIAL=off
-  rm -f $SOURCE_CACHE/$SOURCE /tmp/$SOURCE
+  if [ ! -d "$SYSTEM_MOONBASE/zlocal" ] ; then
+    mkdir -p $SYSTEM_MOONBASE/zlocal
+  fi
 
-  wget -O - >/dev/null "www.lunar-linux.org/cgi-bin/houston?loc=$UNIQID"
+  push_uniq_id
 
-  if get_url "$MOONBASE_URL" $(basename $MOONBASE_URL) ; then
+  if download_module $MODULE ; then
     echo -e "${MESSAGE_COLOR}Preparing to install ${FILE_COLOR}${SOURCE}" \
             "${DEFAULT_COLOR}${MESSAGE_COLOR}...${DEFAULT_COLOR}"       &&
-    mv /var/lib/lunar/moonbase/zlocal/ /var/lib/lunar/.zlocal-backup    &&
-    rm -rf /var/lib/lunar/moonbase                                      &&
-    mkdir /var/lib/lunar/moonbase                                       &&
-    mv /var/lib/lunar/.zlocal-backup /var/lib/lunar/moonbase/zlocal     &&
+    mv $SYSTEM_MOONBASE/zlocal/ /var/lib/lunar/.zlocal-backup    &&
+    rm -rf $SYSTEM_MOONBASE                                      &&
+    mkdir $SYSTEM_MOONBASE                                       &&
+    mv /var/lib/lunar/.zlocal-backup $SYSTEM_MOONBASE/zlocal     &&
     echo -e "${MESSAGE_COLOR}Extracting ${FILE_COLOR}${SOURCE}" \
             "${DEFAULT_COLOR}${MESSAGE_COLOR}...${DEFAULT_COLOR}"       &&
-    bzcat $SOURCE_CACHE/$SOURCE | tar x -C /var/lib/lunar               &&
+    bzcat $SOURCE_CACHE/$SOURCE | tar xv -C /var/lib/lunar | \
+          sed "s:^:/var/lib/lunar/:g" > $INSTALL_LOGS/$MODULE-$VERSION  &&
+    echo $INSTALL_LOGS/$MODULE-$VERSION >> $INSTALL_LOGS/$MODULE-$VERSION &&
     OUTCOME=success || OUTCOME=failed
-    rm -f $SOURCE_CACHE/$SOURCE
-    message "${MESSAGE_COLOR}Removed ${FILE_COLOR}${SOURCE}${DEFAULT_COLOR}"
-    echo -e "${MESSAGE_COLOR}Creating ${FILE_COLOR}${MODULE_INDEX}" \
-            "${DEFAULT_COLOR}${MESSAGE_COLOR}...${DEFAULT_COLOR}"
-    if [ -f $MODULE_INDEX ]; then
+
+    echo -e "${MESSAGE_COLOR}Created ${FILE_COLOR}$INSTALL_LOGS/$MODULE-$VERSION" \
+            "${DEFAULT_COLOR}${MESSAGE_COLOR}${DEFAULT_COLOR}"
+    add_module $MODULE installed $VERSION $(du -hs $SYSTEM_MOONBASE | cut -f1)
+    
+    # get ready to regenerate the module index cache file
+    TMP_MODULE_INDEX=$(temp_create "module-index")
+    cp $MODULE_INDEX $TMP_MODULE_INDEX
+    if [ -f "$MODULE_INDEX" ]; then
       rm -f $MODULE_INDEX
     fi
     create_module_index
-    activity_log "lin" "moonbase" "$VERSION" "$OUTCOME" "$INFO"
+    echo -e "${MESSAGE_COLOR}Created ${FILE_COLOR}${MODULE_INDEX}" \
+            "${DEFAULT_COLOR}${MESSAGE_COLOR}${DEFAULT_COLOR}"
+    display_moonbase_changes
   else
-    activity_log "lin" "moonbase" "$VERSION" "$OUTCOME" "$INFO"
+    OUTCOME=failed
+    INFO="Could not download a fresh moonbase"
   fi
-)}
+  activity_log "lin" "moonbase" "$VERSION" "$OUTCOME" "$INFO"
+)
+}
+
+
+# function : set_moonbase_md5
+# usage    : set_moonbase_md5
+# purpose  : creates the md5 value of overall moonbase
+set_moonbase_md5() {
+  debug_msg "set_moonbase_md5 ($@)"
+  MOONBASE_MD5=$(echo $MOONBASE/*/* | md5sum | cut -d "-" -f 1-1)
+  echo $MOONBASE_MD5
+}
+
+
+# function : get_moonbase_md5
+# usage    : get_moonbase_md5
+# purpose  : graps the MOONBASE_MD5 line from the $MODULE_INDEX
+get_moonbase_md5() {
+  debug_msg "get_moonbase_md5 ($@)"
+  MOONBASE_MD5=$(grep ^MOONBASE_MD5: $MODULE_INDEX | tail -1 2>/dev/null | \
+                cut -d : -f 2-2)
+  if [ -z "$MOONBASE_MD5" ] ; then
+    MOONBASE_MD5="0"
+  fi
+  echo "$MOONBASE_MD5"
+}
+
+
+

Index: optimize.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/optimize.lunar,v
retrieving revision 1.13
retrieving revision 1.14
diff -u -d -r1.13 -r1.14
--- optimize.lunar	16 Apr 2003 19:47:09 -0000	1.13
+++ optimize.lunar	10 Aug 2003 01:16:22 -0000	1.14
@@ -1,4 +1,4 @@
-#Copyrighted Jason Johnston  2002 under GPLv2
+#!/bin/bash
 
 # All specified optimizations are system wide,
 #  and apply to any module built using lin.
@@ -19,48 +19,61 @@
 #         of SSE instructions.
 # $LDF  = This sets the system wide linking optimizations.
 
-# Source in the optimization settings if it exists.
-if [[ -s /etc/lunar/local/optimizations ]]; then
-   . /etc/lunar/local/optimizations
-else
-  verbose_msg "initializing optimizations with hard-coded defaults"
-  echo -e PLATFOM=x86             '\n'    \
-          BUILD=i386-pc-linux-gnu '\n'    \
-	  MAKES=                  '\n'    \
-	  COPT=                   '\n'    \
-	  CCOPT=                  '\n'    \
-          BOPT=-O0                '\n'    \
-          CPU=i386                '\n'    \
-          SPD=( )                 '\n'    \
-	  STACK=                  '\n'    \
-          XTRA=( )                '\n'    \
-          FPM=                    '\n'    \
-	  CC_WARN=( )             '\n'    \
-	  CCC_WARN=( )            '\n'    \
-          LDF=( )                 '\n'    \
-          ADDON=( ) > /etc/lunar/local/optimizations
-fi
+
+
+# Usage   : bad_flags "list of flags to remove"
+# Example : bad_flags -ffast-math -funroll-loops
+bad_flags() {
+  debug_msg "bad_flags ($@)"
+  verbose_msg "bad_flags \"$@\""
+  if [[ "$1" == "ALL" ]]; then
+    unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
+  elif [[ "$1" == "compiler" ]]; then
+    unset CFLAGS CXXFLAGS CPPFLAGS
+  elif [[ "$1" == "linker" ]]; then
+    unset LDFLAGS
+  else
+    for BAD_FLAG in "$@" ; do
+      CFLAGS=$(echo $CFLAGS | sed s/$BAD_FLAG//)
+      CXXFLAGS=$(echo $CXXFLAGS | sed s/$BAD_FLAG//)
+      CPPFLAGS=$(echo $CPPFLAGS | sed s/$BAD_FLAG//)
+      LDFLAGS=$(echo $LDFLAGS | sed s/$BAD_FLAG//)
+    done
+  fi
+}
+
+
+use_wrappers() {
+  debug_msg "use_wrappers ($@)"
+  if [ "$GCCWRAPPERS" == "on" ] ; then
+    verbose_msg "Enabling gcc wrapper scripts to force optimizations"
+    export PATH=/var/lib/lunar/compilers:${PATH}
+  fi  
+}
+
 
 optimize_make() {
-  if [[ $PSAFE == "no" ]]; then
+  debug_msg "optimize_make ($@)"
+  if [ "$PSAFE" == "no" ] ; then
    unset MAKES
-  fi
-  if [[ $MAKES == "1" ]]; then
+  elif [ "$MAKES" == "1" ] ; then
    unset MAKES
   fi
   if module_installed linux-openmosix; then
     alias make="mosrun -h make"
-    if [[ $MAKES > 1 ]]; then
+    if [ "$MAKES" > 1 ] ]; then
       alias make="mosrun -h make -j$MAKES"
     fi
-  elif [[ $MAKES > 1 ]]; then
+  elif [ "$MAKES" > 1 ] ; then
     alias make="make -j$MAKES"
   fi
   verbose_msg "make=\"$(which make)\", MAKES=\"$MAKES\""
 }
  
+
 optimize_base() {
-   if ! [[ $1 ]]; then
+  debug_msg "optimize_base ($@)"
+   if ! [ "$1" ] ; then
       BOPT="None"
    fi
 
@@ -81,13 +94,15 @@
       Fastest) CFLAGS="-O3"
                CXXFLAGS="-O3"
                ;;
-      Smaller) CFLAGS="-Os"
+        Small) CFLAGS="-Os"
                CXXFLAGS="-Os"
                ;;
    esac
 }
 
+
 optimize_cpu()  {
+  debug_msg "optimize_cpu ($@)"
    if ! [[ $1 ]]; then
       if   [[ $PLATFORM == "Alpha" ]];   then
          CPU="ev4"
@@ -444,7 +459,9 @@
    esac
 }
 
+
 optimize_speed() {
+  debug_msg "optimize_speed ($@)"
    for A in ${SPD[@]}; do
       case $A in
              None) CFLAGS="$CFLAGS"
@@ -548,13 +565,23 @@
                      CFLAGS="$CFLAGS"
                      CXXFLAGS="$CXXFLAGS"
                    fi
+		 ;;
+	   Tracer) if [[ $GCCVER == "3" ]] ; then
+	             CFLAGS="$CFLAGS -ftracer"
+		     CXXFLAGS="$CXXFLAGS -ftracer"
+		   else
+		     CFLAGS="$CFLAGS"
+		     CXXFLAGS="$CXXFLAGS"
+		   fi
                  ;;
 
       esac
    done
 }
 
+
 optimize_stack() {
+  debug_msg "optimize_stack ($@)"
   if [[ $STACK > 0 ]]; then
     if [[ $PLATFORM == "x86" ]]; then
       STACK="-mpreferred-stack-boundary=$STACK" 
@@ -565,7 +592,9 @@
   fi
 }
 
+
 optimize_extra() {
+  debug_msg "optimize_extra ($@)"
  for A in ${XTRA[@]}; do
    case $A in
      None)     CFLAGS="$CFLAGS"
@@ -600,8 +629,10 @@
  done
 }
 
+
 # Set how floating point math is done
 optimize_fp() {
+  debug_msg "optimize_fp ($@)"
    case $1 in
       x387) if [[ $GCCVER == "3" ]];  then
               CFLAGS="$CFLAGS -mfpmath=387"
@@ -624,8 +655,10 @@
    esac
 }
 
+
 # Set up the Linker optimizations
 optimize_ld() {
+  debug_msg "optimize_ld ($@)"
    if [[ $LDFLAGS ]]; then
       unset LDFLAGS
    fi
@@ -648,7 +681,9 @@
    done
 }
 
+
 optimize_addon() {
+  debug_msg "optimize_addon ($@)"
   if ! [[ `grep ADDON /etc/lunar/local/optimizations` ]]; then
     echo ADDON=( None ) >> /etc/lunar/local/optimizations
     ADDON=( None )
@@ -680,17 +715,9 @@
   verbose_msg "CC_EXT=\"$CC_EXT\", CXX_EXT=\"$CXX_EXT\""
 }
 
-optimize_cc_warn() {
-  for W in ${CC_WARN[@]}; do
-    case $W in
-    Deprecated)
-      CFLAGS="$CFLAGS -Wno-deprecated"
-      ;;
-    esac
-  done
-}
 
 optimize_ccc_warn() {
+  debug_msg "optimize_ccc_warn ($@)"
   for W in ${CCC_WARN[@]}; do
     case $W in
     Deprecated)
@@ -701,11 +728,39 @@
   done
 }
 
-optimize_platform() {
-   unset CFLAGS CXXFLAGS LDFLAGS
-   GCCVER="$1"
 
-   case $PLATFORM in
+optimize() {
+  debug_msg "optimize ($@)"
+  # Source in the optimization settings if it exists.
+  if [ -s /etc/lunar/local/optimizations ] ; then
+    . /etc/lunar/local/optimizations
+  else
+    verbose_msg "initializing optimizations with hard-coded defaults"
+    echo -e PLATFORM=x86            '\n'    \
+BUILD=i386-pc-linux-gnu '\n'    \
+MAKES=                  '\n'    \
+COPT=                   '\n'    \
+CCOPT=                  '\n'    \
+BOPT=-O0                '\n'    \
+CPU=i386                '\n'    \
+SPD=( )                 '\n'    \
+STACK=                  '\n'    \
+XTRA=( )                '\n'    \
+FPM=                    '\n'    \
+CC_WARN=( )             '\n'    \
+CCC_WARN=( )            '\n'    \
+LDF=( )                 '\n'    \
+ADDON=( ) > /etc/lunar/local/optimizations
+  fi
+
+  #lets get the BUILD if it is not defined   
+  [ -z "$BUILD" ] && optimize_cpu $CPU
+  [ -n "$BUILD" ] && export BUILD || 
+  echo "Set your optimization preferences via lunar"
+
+  unset CFLAGS CXXFLAGS LDFLAGS
+
+  case $PLATFORM in
       x86)      optimize_make     $MAKES     &&
                 optimize_base     $BOPT      &&
                 optimize_cpu      $CPU       &&
@@ -713,45 +768,41 @@
                 optimize_extra    ${XTRA[@]} &&
 		optimize_stack               &&
                 optimize_fp       $FPM       &&
-		optimize_cc_warn             &&
 		optimize_ccc_warn            &&
                 optimize_ld       ${LDF[@]}  &&
 		optimize_addon
                 ;;
-      Alpha)    optimize_make  $MAKES     &&
-                optimize_base  $BOPT      &&
-                optimize_cpu   $CPU       &&
-                optimize_speed ${SPD[@]}  &&
-                optimize_extra ${XTRA[@]} &&
-                optimize_fp    $FPM       &&
-		optimize_cc_warn             &&
+      Alpha)    optimize_make     $MAKES     &&
+                optimize_base     $BOPT      &&
+                optimize_cpu      $CPU       &&
+                optimize_speed    ${SPD[@]}  &&
+                optimize_extra    ${XTRA[@]} &&
+                optimize_fp       $FPM       &&
 		optimize_ccc_warn            &&
-                optimize_ld    ${LDF[@]}  &&
+                optimize_ld       ${LDF[@]}  &&
 		optimize_addon
                 ;;
-      PowerPC)  optimize_make  $MAKES     &&
-                optimize_base  $BOPT      &&
-                optimize_cpu   $CPU       &&
-                optimize_speed ${SPD[@]}  &&
-                optimize_extra ${XTRA[@]} &&
-                optimize_fp    $FPM       &&
-		optimize_cc_warn             &&
+      PowerPC)  optimize_make     $MAKES     &&
+                optimize_base     $BOPT      &&
+                optimize_cpu      $CPU       &&
+                optimize_speed    ${SPD[@]}  &&
+                optimize_extra    ${XTRA[@]} &&
+                optimize_fp       $FPM       &&
 		optimize_ccc_warn            &&
-                optimize_ld    ${LDF[@]}  &&
+                optimize_ld       ${LDF[@]}  &&
 		optimize_addon
                 ;;
-      SPARC)    optimize_make  $MAKES     &&
-                optimize_base  $BOPT      &&
-                optimize_cpu   $CPU       &&
-                optimize_speed ${SPD[@]}  &&
-                optimize_extra ${XTRA[@]} &&
-                optimize_fp    $FPM       &&
-		optimize_cc_warn             &&
+      SPARC)    optimize_make     $MAKES     &&
+                optimize_base     $BOPT      &&
+                optimize_cpu      $CPU       &&
+                optimize_speed    ${SPD[@]}  &&
+                optimize_extra    ${XTRA[@]} &&
+                optimize_fp       $FPM       &&
 		optimize_ccc_warn            &&
-                optimize_ld    ${LDF[@]}  &&
+                optimize_ld       ${LDF[@]}  &&
 		optimize_addon
                 ;;
-   esac
+  esac
 
   export CC_EXT
   export CXX_EXT
@@ -761,14 +812,18 @@
   export CXXFLAGS
   export LDFLAGS
 
+  use_wrappers
+  verbose_msg "BUILD=\"$BUILD\""
+  verbose_msg "GCCVER=\"$GCCVER\""
   verbose_msg "CFLAGS=\"$CFLAGS\""
   verbose_msg "CXXFLAGS=\"$CXXFLAGS\""
   verbose_msg "LDFLAGS=\"$LDFLAGS\""
-
 }
 
+
 # This is the flow control and error checking for the menus.
 optimize_architecture()  {
+  debug_msg "optimize_architecture ($@)"
   # Make sure optimizations file exists, if not create it.
   if ! [[ -f /etc/lunar/local/optimizations ]]; then
     touch /etc/lunar/local/optimizations
@@ -781,8 +836,12 @@
     exit 0
   fi
 
-# Flow control for the menus. This will also check for gcc3,
-# if it exists it will allow more options.
+  if [ -f /etc/lunar/local/optimizations ] ; then
+    .  /etc/lunar/local/optimizations
+  fi
+
+  # Flow control for the menus. This will also check for gcc3,
+  # if it exists it will allow more options.
   TITLE="Lunar Optimizations"
 
   help compiler_help          &&
@@ -832,11 +891,6 @@
   menu radiolist              &&
   FPM=$RESULT
 
-  help cc_warn_help           &&
-  cc_warn             &&
-  menu checklist              &&
-  CC_WARN=$RESULT
-
   help ccc_warn_help          &&
   ccc_warn            &&
   menu checklist              &&
@@ -868,3 +922,5 @@
 
   optimize
 }
+
+

Index: postbuild.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/postbuild.lunar,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- postbuild.lunar	16 Apr 2003 19:47:09 -0000	1.3
+++ postbuild.lunar	10 Aug 2003 01:16:22 -0000	1.4
@@ -1,4 +1,4 @@
-############################################################
+#!/bin/bash
 #                                                          #
 # postbuild.lunar - Lunar install extensions               #
 #                                                          #
@@ -26,12 +26,13 @@
 
 
 gather_docs()  {
+  debug_msg "gather_docs ($@)"
   [ "$GARBAGE" == "on" ] || return 0
 
   DOC_DIR=$DOCUMENT_DIRECTORY/$MODULE
   mkdir  -p  $DOC_DIR
 
-  if [ -d $SOURCE_DIRECTORY ] ; then
+  if [ -d "$SOURCE_DIRECTORY" ] ; then
     ( cd $SOURCE_DIRECTORY && for FILE in \
       README* INSTALL* FAQ* CHAN* doc* DOC* *doc *sample* \
       conf SETUP NEWS Change* manual* Manual* ; do
@@ -46,6 +47,7 @@
 
 
 install_pam_confs()  {
+  debug_msg "install_pam_confs ($@)"
   if  [  -d  "$SCRIPT_DIRECTORY/pam.d"  ];  then
     verbose_msg "handling pam config files"
     cd       "$SCRIPT_DIRECTORY/pam.d"
@@ -62,7 +64,8 @@
 }
 
 
-install_xinetd_confs()  { (
+install_xinetd_confs()  {
+  debug_msg "install_xinetd_confs ($@)"
   if  [  -d  "$SCRIPT_DIRECTORY/xinetd.d"  ];  then
     cd       "$SCRIPT_DIRECTORY/xinetd.d"
     verbose_msg "handling xinetd config files"
@@ -85,10 +88,11 @@
       invoke_installwatch
     fi
   fi
-) }
+}
 
 
-use_xinetd()  { (
+use_xinetd()  {
+  debug_msg "use_xinetd ($@)"
   if  [  -d  $SCRIPT_DIRECTORY/xinetd.d  ]  &&
       !  grep  -q  "SERVICES="  $MODULE_CONFIG
   then
@@ -129,10 +133,11 @@
   else
     return 1
   fi
-) }
+}
 
 
-install_initd()  { (
+install_initd()  {
+  debug_msg "install_initd ($@)"
   [ -d /etc/init.d ] || mkdir -p /etc/init.d
 
   if  [ -d  $SCRIPT_DIRECTORY/init.d  ] ; then
@@ -164,10 +169,11 @@
     fi
 
   done
-) }
+}
 
 
-use_initd()  { (
+use_initd()  {
+  debug_msg "use_initd ($@)"
   if  [  -d  $SCRIPT_DIRECTORY/init.d  ] ; then
     cd $SCRIPT_DIRECTORY/init.d
 
@@ -191,10 +197,11 @@
 
     echo   "INITDSCRIPTS=\"$INSTALLED_INIDSCRIPTS\"" >> $MODULE_CONFIG
   fi
-) }
+}
 
 
-install_services()  { (
+install_services()  {
+  debug_msg "install_services ($@)"
   if  [  -f  $SCRIPT_DIRECTORY/services  ];  then
     export  IFS="$ENTER_IFS"
     cat  $SCRIPT_DIRECTORY/services  |
@@ -203,10 +210,11 @@
       echo      "$LINE"  >>  /etc/services
     done
   fi
-) }
+}
 
 
-install_bashmisc () { (
+install_bashmisc () {
+  debug_msg "install_bashmisc  ($@)"
   if [ -d $SCRIPT_DIRECTORY/profile.d ]; then
     [ -d /etc/profile.d ] || mkdir -p /etc/profile.d
     install -g 0 -o 0 -m 644 $SCRIPT_DIRECTORY/profile.d/*.rc /etc/profile.d
@@ -217,8 +225,5 @@
     cp $SCRIPT_DIRECTORY/skel/[!CVS]* /etc/skel &> /dev/null
     cp $SCRIPT_DIRECTORY/skel/.* /etc/skel &> /dev/null
   fi
-) }
-
-
-
+}
 

Index: queue.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/queue.lunar,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- queue.lunar	2 Sep 2002 14:00:38 -0000	1.1.1.1
+++ queue.lunar	10 Aug 2003 01:16:22 -0000	1.2
@@ -1,4 +1,4 @@
-############################################################
+#!/bin/bash
 #                                                          #
 # This code is written for Lunar Linux, see                #
 # http://www.lunar-linux.org                               #
@@ -26,7 +26,9 @@
 # purpose : adds an item to the end of a queue
 
 add_queue() {
+  debug_msg "add_queue ($@)"
    in_queue() {
+  debug_msg "   in_queue ($@)"
       grep -q "^"$2"\$" $1 && return 0 || return 1
    }
 
@@ -44,6 +46,7 @@
 # purpose : removes an item from a queue OR pops the first element from a queue
 
 remove_queue() {
+  debug_msg "remove_queue ($@)"
 
    [ -f "$1" ] || return 1
 

Index: recovery.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/recovery.lunar,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- recovery.lunar	2 Sep 2002 14:00:38 -0000	1.1.1.1
+++ recovery.lunar	10 Aug 2003 01:16:22 -0000	1.2
@@ -1,4 +1,4 @@
-############################################################
+#!/bin/bash
 #                                                          #
 # This code is written for Lunar Linux, see                #
 # http://www.lunar-linux.org                               #
@@ -20,6 +20,7 @@
 # usage    : rebuild_status_files
 # purpose  : rebuild the accidentally deleted status files
 rebuild_status_files() {
+  debug_msg "rebuild_status_files ($@)"
   message "${PROBLEM_COLOR} Unable to find MODULE_STATUS files\n"          \
           "${MODULE_COLOR}$MODULE_STATUS and $MODULE_STATUS_BACKUP"        \
           "${DEFAULT_COLOR}\n"                                             \
@@ -83,6 +84,7 @@
 # usage    : replace_status_file
 # purpose  : cp $MODULE_STATUS_BACKUP $MODULE_STATUS via query
 replace_status_file() {
+  debug_msg "replace_status_file ($@)"
 
    if ! [ -f "$MODULE_STATUS_BACKUP" ]; then rebuild_status_files; return; fi
     message  "${PROBLEM_COLOR}Unable to find MODULE_STATUS file"   \
@@ -111,6 +113,7 @@
 # usage    : check_status_files
 # purpose  : checks the avail of MODULE_STATUS and MODULE_STATUS_BACKUP files
 check_status_files() {
+  debug_msg "check_status_files ($@)"
    if ! [ -f "$MODULE_STATUS" ]; then replace_status_file; fi
    if ! [ -f "$MODULE_STATUS" ]; then echo "Unknown error!!!"; exit; fi
    if ! [ -f "$MODULE_STATUS_BACKUP" ]; then

Index: sizes.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/sizes.lunar,v
retrieving revision 1.1.1.1
retrieving revision 1.2
diff -u -d -r1.1.1.1 -r1.2
--- sizes.lunar	2 Sep 2002 14:00:38 -0000	1.1.1.1
+++ sizes.lunar	10 Aug 2003 01:16:22 -0000	1.2
@@ -1,4 +1,4 @@
-############################################################
+#!/bin/bash
 #                                                          #
 # This code is written for Lunar Linux, see                #
 # http://www.lunar-linux.org                               #
@@ -19,9 +19,8 @@
 # function: find_module_size
 # usage   : find_module_size <module> |version|
 # purpose : finds the installed size of module in KB
-find_module_size()
-{
-   #this functions checks the packages file if there is already size entry
+find_module_size() {
+   #this functions checks the modules file if there is already size entry
    module_size()
    {
       unset SIZE

Index: sources.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/sources.lunar,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- sources.lunar	16 Apr 2003 19:47:09 -0000	1.3
+++ sources.lunar	10 Aug 2003 01:16:22 -0000	1.4
@@ -1,3 +1,4 @@
+#!/bin/bash
 ############################################################
 #                                                          #
 # This code is written for Lunar Linux, see                #
@@ -6,7 +7,8 @@
 ############################################################
 #                                                          #
 # $FUNCTIONS/sources                                       #
-# includes sources, md5_verify_source                      #
+# includes sources, md5_verify_source, verify_sources      #
+# verify_source                                            #
 #                                                          #
 # 20020604                                                 #
 #                                                          #
@@ -16,110 +18,104 @@
 #                                                          #
 ############################################################
 
-# function : sources
-# usage    : sources <module_name> {MD5}
-# purpose  : displays the filenames and md5sums of sources for a given module
-sources()  
-{ (
 
+verify_source() {
+  debug_msg "verify_source ($@)"
+  VERIFIED="true"
+  for SOURCE_FILE in $@ ; do
+    if ! guess_filename $SOURCE_CACHE/$1 >/dev/null ; then
+      message "${PROBLEM_COLOR}Missing ${FILE_COLOR}${1}${DEFAULT_COLOR}"
+      message "${PROBLEM_COLOR}Lunar Install aborting.${DEFAULT_COLOR}"
+      activity_log "lin" "$MODULE" "$VERSION" "failed" "because it was missing source:  $1"
+      return 1
+    fi
+  done
+}
+
+
+# function : sources
+# usage    : sources <module_name> {MD5|VFY|
+# purpose  : displays the filenames and md5sums or VFY part of sources
+#            for a given module
+sources() {
+(
+  debug_msg "sources ($@)"
   MAX_SOURCES=${MAX_SOURCES:=100}
 
-  run_details $1 || return 1
+  if ! run_details $1 ; then
+    return 1
+  fi
 
-  if [ -z "$CVS_MODULE" ]; then
-    for (( CNT=0; CNT<=$MAX_SOURCES; CNT++ )) ; do
-      TEMP1=`echo SOURCE$CNT | sed s/SOURCE0/SOURCE/`
-      TEMP2=`echo SOURCE$(( CNT+1))`
-      TEMP3=`echo SOURCE$(( CNT+2))`
+  for (( CNT=0; CNT<=$MAX_SOURCES; CNT++ )) ; do
+    TEMP=SOURCE$((CNT))
+    TEMP=${TEMP/SOURCE0/SOURCE}
 
-      eval TEMP=\$$TEMP1
-      eval TEMP2=\$$TEMP2
-      eval TEMP3=\$$TEMP3
+    eval SRC1=\$${TEMP}
+    if [ "$2" == "MD5" ] ; then
+      eval SRC_MD5=\$${TEMP}_MD5
+      if [ -z "$SRC_MD5" ] ; then
+        SRC_MD5=0
+      fi
+    fi
 
-      TEMP1_MD5=${TEMP1}_MD5[@]
-      eval TEMP_MD5=\${$TEMP1_MD5}
-      TEMP_MD5=${TEMP_MD5:=0}
+    eval SRC2=\$SOURCE$((CNT+1))
+    eval SRC3=\$SOURCE$((CNT+2))
 
-      [ -n "$TEMP" ]         &&
-      echo  $TEMP            &&
-      [ "$2" == "MD5" ]      && 
-      echo  $TEMP_MD5 
+    if [ -n "$SRC1" ] ; then
+      echo $SRC1
+      if [ "$2" == "MD5" ] ; then
+        echo $SRC_MD5
+      fi
+    fi
+
+    #if two consequtive empty sources, then break
+    [ -z "$SRC2" ] && [ -z "$SRC3" ] && {
+      break
+    }
+  done
+)
+}
 
-      #if two consequtive empty sources, then break
-      [ -z "$TEMP2" ] && [ -z "$TEMP3" ]  && {
-      #lets clear the array
-        for (( CNT1=0; CNT1<=$CNT; CNT1++ ))
-        do
-          TEMP1=`echo SOURCE$CNT1 | sed s/SOURCE0/SOURCE/`
-          unset $TEMP1
-        done   
-        break
-      }
-    done
-  else
-    echo $MODULE-$VERSION.tar.bz2
-  fi
-) }
 
 # function : md5_verify_source
-# usage    : md5_verify_source filename_1 md5_1, filename_2 md52.....
+# usage    : md5_verify_source filename md5
 # purpose  : md5 verifies a filename
-md5_verify_source()
-{
-   ALL_OK=true   
-   while [ -n "$2" ]
-   do
-      verify_source $1 || return 1
-
-      verbose_msg "checking md5sum of \"$1\""
-
-      [ "$2" == "0" ]  && 
-      TEMP=0           || 
-      TEMP=`md5sum $SOURCE_CACHE/$1 | cut -d " " -f 1-1`
-      
-      [ "$TEMP" == "$2" ] || {
-         message  "${PROBLEM_COLOR}Wrong md5 sum for ${FILE_COLOR}${1}" \
-                   "${DEFAULT_COLOR}"
-         message  "${PROBLEM_COLOR}Removing ${FILE_COLOR}${SOURCE_CACHE}/${1}" \
-                  "${DEFAULT_COLOR}"
-         rm -f $SOURCE_CACHE/$1 2>/dev/null                             &&
-         message  "${FILE_COLOR}Removed!!${DEFAULT_COLOR}"              ||
-         message  "${PROBLEM_COLOR}Unable to remove!!${DEFAULT_COLOR}" 
-         ALL_OK=false
-      }
+md5_verify_source() {
+  debug_msg "md5_verify_source ($@)"
+  if [ "$2" != "$(md5sum $SOURCE_CACHE/$1 | cut -d " " -f 1-1)" ] ; then
+     return 1
+  fi
 
-      shift 2
-   done
-   $ALL_OK
 }
 
 
 unpack() {
+  debug_msg "unpack ($@)"
 
-    FILENAME=`guess_filename  $SOURCE_CACHE/$1`          &&
-  COMPRESSOR=`file  -b  $FILENAME  |  cut  -d ' '  -f1`  &&
+    FILENAME=$(guess_filename $SOURCE_CACHE/$1)
 
   verbose_msg "Unpacking \"$FILENAME\" in \"$(pwd)\""
 
-  case  $COMPRESSOR  in
-        bzip2)  bzip2  -cdf  $FILENAME  |  tar  -xf  -  ;;
-         gzip)  gzip   -cdf  $FILENAME  |  tar  -xf  -  ;;
-    compress*)  gzip   -cdf  $FILENAME  |  tar  -xf  -  ;;
-          Zip)  unzip  -q    $FILENAME                  ;;
+  case $(file -b $FILENAME | cut -d' ' -f1) in
+        bzip2)  tar jxf $FILENAME ;;
+         gzip)  tar zxf $FILENAME ;;
+	  tar)  tar xf $FILENAME ;;
+    compress*)  tar zxf $FILENAME ;;
+          Zip)  unzip -q $FILENAME ;;
           RPM)  rpmunpack  < $FILENAME  |  gzip  -d     \
                                         |  cpio  -idm   ;;
             *)  false                                   ;;
   esac
 
-  if [ $? != 0 ] ; then
-    message "${PROBLEM_COLOR}Error while unpacking \"$1\", aborting $0!${DEFAULT_COLOR}"
-    exit 1
+  if [ "$?" != 0 ] ; then
+    message "${PROBLEM_COLOR}! Error while unpacking ${FILE_COLOR}$SOURCE_CACHE/$1${DEFAULT_COLOR}${PROBLEM_COLOR}${DEFAULT_COLOR}"
+    return 1
   fi
   
   [ -n "$SOURCE_DIRECTORY" ] &&
   [ -d "$SOURCE_DIRECTORY" ]
   
-  if [[ `echo $CFLAGS | grep fbranch-probabilities` ]]; then
+  if [[ $(echo $CFLAGS | grep fbranch-probabilities) ]]; then
     chown -R 777 $SOURCE_DIRECTORY 2>&1 >/dev/null
   else
     chown -R root:root $SOURCE_DIRECTORY 2>&1 >/dev/null 
@@ -127,4 +123,118 @@
 }
 
 
+
+# usage : gpg_verify_src $SRC $GPG-SIG-URL $GPG-PUBLIC-KEYS-URL
+gpg_verify_source() {
+  debug_msg "gpg_verify_source($@)"
+  if [ ! -x /usr/bin/gpg ] ; then
+    message "${PROBLEM_COLOR}! Cannot verify sources without ${MODULE_COLOR}gpg${DEFAULT_COLOR}${PROBLEM_COLOR} installed${DEFAULT_COLOR}"
+    return 1
+  fi
+
+  # do we need to download a keyset?
+  if [ -n "$3" ] ; then
+    TMP_GPG_KEYS=$(temp_create "gpg-pubkeys")
+    verbose_msg "Downloading pub keys from \"$3\""
+    # TODO calling wget is a hack... we should accept file: urls too
+    if wget $3 -O $TMP_GPG_KEYS -q ; then
+      GNUPGHOME=/var/state/lunar/ gpg --import $TMP_GPG_KEYS
+    fi
+  fi
+  
+  # try to get the required key
+  TMP_GPG_SIG=$(temp_create "gpg-signature")
+  verbose_msg "Downloading signature \"$2\""
+  # TODO calling wget is a hack... we should accept file: urls too
+  if wget $2 -O $TMP_GPG_SIG -q ; then
+    verbose_msg "Verifying signature of \"$SOURCE_CACHE/$1\""
+    verbose_msg "GNUPGHOME=/var/state/lunar/ gpg --verify $TMP_GPG_SIG $SOURCE_CACHE/$1"
+    if ! GNUPGHOME=/var/state/lunar/ gpg --verify $TMP_GPG_SIG $SOURCE_CACHE/$1 ; then
+      verbose_msg "gpg exited with \"$?\""
+      temp_destroy $TMP_GPG_SIG
+      temp_destroy $TMP_GPG_KEYS
+      return 1
+    fi
+    temp_destroy $TMP_GPG_SIG
+    temp_destroy $TMP_GPG_KEYS
+  else
+    message "cannot download key!"
+    temp_destroy $TMP_GPG_SIG
+    temp_destroy $TMP_GPG_KEYS
+    return 1
+  fi
+
+}
+
+
+# usage: verify_all_sources $MODULE
+# check all sources regarding verification method
+verify_all_sources() {
+(
+  debug_msg "verify_all_sources ($@)"
+  MAX_SOURCES=${MAX_SOURCES:=100}
+
+  if ! run_details $1 ; then
+    return 1
+  fi
+
+  for (( C=0 ; C<=$MAX_SOURCES ; C++ )) ; do
+    TEMP=SOURCE$((C))
+    TEMP=${TEMP/SOURCE0/SOURCE}
+    eval SRC1=\$${TEMP}
+   
+    # it needs to exist prior before we can check it:
+    if ! verify_source $SRC1 ; then
+      return 1
+    fi
+
+    eval VFYS=\${${TEMP}_VFY[@]}
+
+    # cumulate result:
+    unset RESULT
+    if [ -n "$VFYS" ] ; then
+      # we need to check ALL args for validity... if one fails we should not
+      # trust the source
+      for VFY in $VFYS ; do
+        if [ "${VFY:0:4}" == "md5:" ] ; then
+	  if ! md5_verify_source $SRC1 $(echo $VFY | cut -d: -f2) ; then
+	    message "${PROBLEM_COLOR}!md5sum check failed for ${DEFAULT_COLOR}${FILE_COLOR}$SRC1${DEFAULT_COLOR}"
+	    RESULT=1
+	  fi
+	elif [ "${VFY:0:4}" == "gpg:" ] ; then
+	  if ! gpg_verify_source $SRC1 $(echo $VFY | cut -d: -f2-3) $(echo $VFY | cut -d: -f4-5) ; then
+	    message "${PROBLEM_COLOR}!gpg signature check failed for ${DEFAULT_COLOR}${FILE_COLOR}$SRC1${DEFAULT_COLOR}"
+	    RESULT=1
+	  fi
+        fi
+      # so what if?
+      if [ "$RESULT" == "1" ] ; then
+        # remove?
+	MODULE=$1
+	message "${MESSAGE_COLOR}You should remove ${DEFAULT_COLOR}${FILE_COLOR}$SRC1${DEFAULT_COLOR}${MESSAGE_COLOR} !${DEFAULT_COLOR}"
+	
+	if query "Remove \"$SOURCE_CACHE/$SRC1\" ? " y ; then
+          rm -f $SOURCE_CACHE/$SRC1
+	fi
+      fi
+      done
+    fi
+
+    # our fallthrough as usual:
+    eval SRC2=\$SOURCE$((C+1));
+    eval SRC3=\$SOURCE$((C+2));
+    [ -z "$SRC2" ] && [ -z "$SRC3" ] && break
+  done    
+ 
+  # result?
+  if [ -n "$RESULT" ] ; then
+    return 1
+  fi
+
+  # if we removed something we better make sure we break:
+  if ! verify_source $(sources $1) ; then
+    return 1
+  fi
+)
+}
 

Index: uniqid.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/uniqid.lunar,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- uniqid.lunar	17 Jun 2003 02:15:38 -0000	1.1
+++ uniqid.lunar	10 Aug 2003 01:16:22 -0000	1.2
@@ -1,4 +1,4 @@
-############################################################
+#!/bin/bash
 #                                                          #
 # uniqid.lunar - Make a uniqe id for tracking clients      #
 #                                                          #
@@ -8,33 +8,46 @@
 #                                                          #
 ############################################################
 
-mk_uniqid() {
 
-  if [ $UNIQID >= "" ]; then 
+push_uniq_id() {
+  debug_msg "push_uniq_id ($@)"
+  if [ -z "$UNIQID" ]; then
+    create_uniq_id
+  fi
+ 
+  verbose_msg "registering \"$UNIQID\" with server"
+  wget -q -O - "www.lunar-linux.org/cgi-bin/houston?loc=$UNIQID" 
+
+}
+
+
+create_uniq_id() {
+  debug_msg "create_uniq_id ($@)"
+  if [ -n "$UNIQID" ]; then 
     return
   fi
 
-  OS=`uname -s`
+  OS=$(uname -s)
 
   if [  "$OS"  == "OpenBSD" ]; then
     HASH="sha1"
     IFACE=`netstat -r | grep default | awk '{print $7}'`
-
   elif [  "$OS"  == "Linux" ]; then
     HASH="md5sum"
     IFACE=`netstat -r | grep default | awk '{print $8}'`
-
-  else exit 1
-
+  else
+    exit 1
   fi
 
-
-  echo "Interface=$IFACE"
   UNIQID=`ifconfig $IFACE |\
       awk '/addr.*[:]* [0-9a-fA-F][0-9a-fA-F]:[0-9a-fA-F][0-9a-fA-F]/ {print $NF}' |\
       tr 'A-Z' 'a-z' | $HASH | awk '{print $1}'`
   export UNIQID
+
+  verbose_msg "id(\"$IFACE\")=\"$UNIQID\""
+
   echo  "      UNIQID=$UNIQID"   >>   $LOCAL_CONFIG
+
 }
 
 

Index: updatelog.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/updatelog.lunar,v
retrieving revision 1.6
retrieving revision 1.7
diff -u -d -r1.6 -r1.7
--- updatelog.lunar	27 Mar 2003 17:41:11 -0000	1.6
+++ updatelog.lunar	10 Aug 2003 01:16:22 -0000	1.7
@@ -1,4 +1,4 @@
-############################################################
+#!/bin/bash
 #                                                          #
 # This code is written for Lunar Linux, see                #
 # http://www.lunar-linux.org                               #
@@ -15,84 +15,70 @@
 #                                                          #
 ############################################################
 
+
 # function : display_update_log 
 # usage    : display_update_log update|rebuild 
 # purpose  : display a log describing update successes, failures, and summaries
-
-display_update_log()  { 
+display_update_log() {
+  debug_msg "display_update_log ($@)"
   rm -f /var/log/lunar/update 
- 
   { 
-    display_success_info $1
-    if [  "$1" == "update" ]; then  
-      display_moonbase_changes
-    fi  
+    if [ -e "$TMP_LIN_SUCCESS" -a -e "$TMP_LIN_FAIL" ] ; then 
+      display_success_info
+    fi
   } | tee /var/log/lunar/update 
- 
-  rm -f /tmp/fail_$LOGTMP /tmp/success_$LOGTMP
 }
 
+
 # function : display_success_info 
 # usage    : display_success_info update|rebuild
 # purpose  : display a list of update successes and failures
-display_success_info()  {
-
-  touch /tmp/success_$LOGTMP /tmp/fail_$LOGTMP
+display_success_info() {
+  debug_msg "display_success_info ($@)"
 
-  NUMSUCCESS=`cat /tmp/success_$LOGTMP | wc -l` 
-  NUMFAILURES=`cat /tmp/fail_$LOGTMP | wc -l`  
+  NUMSUCCESS=$(cat $TMP_LIN_SUCCESS | wc -l)
+  NUMFAILURES=$(cat $TMP_LIN_FAIL | wc -l)
 
   message
-  message  "${MESSAGE_COLOR}Lunar $1 completed at `date`${DEFAULT_COLOR}"
-  message  "Successful ${1}s : " $NUMSUCCESS
-  message  "Failed ${1}s     : " $NUMFAILURES  
+  message  "${MESSAGE_COLOR}Lunar renew completed at `date`${DEFAULT_COLOR}"
+  message  "Successful  : " $NUMSUCCESS
+  message  "Failed      : " $NUMFAILURES  
   message  
   
   if  [  "$NUMSUCCESS" -gt "0"  ]; then   
     message  "${MESSAGE_COLOR}Successfully updated modules:${DEFAULT_COLOR}"  
-    cat  /tmp/success_$LOGTMP  
+    cat $TMP_LIN_SUCCESS  
     message  
   fi  
  
   if  [  "$NUMFAILURES" -gt "0"  ]; then    
     message  "${MESSAGE_COLOR}Failed updated modules:${DEFAULT_COLOR}"
-    cat  /tmp/fail_$LOGTMP   
+    cat $TMP_LIN_FAIL
     message   
   fi   
 
-  if [  "$1" == "update" ]; then 
-    display_moonbase_changes 
-  fi 
-
 }
 
 # function : display_moonbase_changes
 # usage    : display_moonbase_changes
 # purpose  : display a list of modules added or removed during this update
 display_moonbase_changes()  {  
-
-  MODULE_INDEX_BACKUP=/tmp/`basename $MODULE_INDEX`
-  
-  if [ -e "$MODULE_INDEX" ] && [ -e "$MODULE_INDEX_BACKUP" ]; then
-
-    NEW_MODULES=`diff -I MOONBASE_MD5 $MODULE_INDEX $MODULE_INDEX_BACKUP | grep '<' | wc -l`
-    DEL_MODULES=`diff -I MOONBASE_MD5 $MODULE_INDEX $MODULE_INDEX_BACKUP | grep '>' | wc -l`
+  debug_msg "display_moonbase_changes ($@)"
+  if [ -e "$MODULE_INDEX" ] && [ -e "$TMP_MODULE_INDEX" ]; then
+    NEW_MODULES=$(diff -I MOONBASE_MD5 $MODULE_INDEX $TMP_MODULE_INDEX | grep '<' | wc -l)
+    DEL_MODULES=$(diff -I MOONBASE_MD5 $MODULE_INDEX $TMP_MODULE_INDEX | grep '>' | wc -l)
   
     if [ "$NEW_MODULES" != "0" ]; then
       message "${MESSAGE_COLOR}New modules:${DEFAULT_COLOR}"
-      diff -I "MOONBASE_MD5:" $MODULE_INDEX $MODULE_INDEX_BACKUP | grep '<' | cut -d \  -f 2 -
+      diff -I "MOONBASE_MD5:" $MODULE_INDEX $TMP_MODULE_INDEX | grep '<' | cut -d \  -f 2 -
       message
     fi
 
     if [ "$DEL_MODULES" != "0" ]; then
       message "${MESSAGE_COLOR}Removed modules:${DEFAULT_COLOR}"
-      diff -I "MOONBASE_MD5:" $MODULE_INDEX $MODULE_INDEX_BACKUP | grep '>' | cut -d \  -f 2 -
+      diff -I "MOONBASE_MD5:" $MODULE_INDEX $TMP_MODULE_INDEX | grep '>' | cut -d \  -f 2 -
       message
     fi
-
-    rm -f $MODULE_INDEX_BACKUP
-
   fi
-  
 }
 

Index: useradd.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/useradd.lunar,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- useradd.lunar	15 Mar 2003 18:53:31 -0000	1.1
+++ useradd.lunar	10 Aug 2003 01:16:22 -0000	1.2
@@ -1,4 +1,4 @@
-############################################################
+#!/bin/bash
 #                                                          #
 # This code is written for Lunar Linux, see                #
 # http://www.lunar-linux.org                               #
@@ -20,17 +20,18 @@
 # usage   : add_priv_user username:groupname [adduseropts [adduseropts]...]
 # info    : adds username:groupname and passes adduseropts to 'adduser'
 function add_priv_user() {
+  debug_msg "function add_priv_user ($@)"
 
   USERNAME=$(echo $1 | cut -d: -f1)
   GROUPNAME=$(echo $1 | cut -d: -f2)
 
   if [ -z "$USERNAME" ] ; then
-    message "${PROBLEM_COLOR}add_priv_user: no username specified${DEFAULT_COLOR}"
+    message "${PROBLEM_COLOR}!add_priv_user: no username specified${DEFAULT_COLOR}"
     exit 1
   fi
 
   if [ -z "$GROUPNAME" ] ; then
-    message "${PROBLEM_COLOR}add_priv_user: no groupname specified${DEFAULT_COLOR}"
+    message "${PROBLEM_COLOR}!add_priv_user: no groupname specified${DEFAULT_COLOR}"
     exit 1
   fi
 
@@ -48,7 +49,7 @@
 	fi
       done
       if [ "$N" == "100" ] ; then
-        message "${PROBLEM_COLOR}add_priv_user: no more group id's left under gid=100, bailing out!${DEFAULT_COLOR}"
+        message "${PROBLEM_COLOR}!add_priv_user: no more group id's left under gid=100, bailing out!${DEFAULT_COLOR}"
 	exit 1
       fi
       verbose_msg "creating group \"$GROUPNAME\" with id=\"$N\""
@@ -63,7 +64,7 @@
       fi
     done
     if [ "$N" == "100" ] ; then
-      message "${PROBLEM_COLOR}add_priv_user: no more user id's left under uid=100, bailing out!${DEFAULT_COLOR}"
+      message "${PROBLEM_COLOR}!add_priv_user: no more user id's left under uid=100, bailing out!${DEFAULT_COLOR}"
       exit 1
     fi
     

Index: view.lunar
===================================================================
RCS file: /var/cvs/lunar/lunar/var/lib/lunar/functions/view.lunar,v
retrieving revision 1.1
retrieving revision 1.2
diff -u -d -r1.1 -r1.2
--- view.lunar	26 Mar 2003 23:20:54 -0000	1.1
+++ view.lunar	10 Aug 2003 01:16:22 -0000	1.2
@@ -1,4 +1,4 @@
-####################################################################
+#!/bin/bash
 #                                                                  #
 #  display.lunar - functions to view files                         #
 #                                                                  #
@@ -9,6 +9,7 @@
 # usage    : view_file FILENAME
 # purpose  : to view a file
 view_file()  {
+  debug_msg "view_file ($@)"
   if [ -n "$1" ] ; then
     # show a file $1
     case $(file -b $1 | cut -d' ' -f1) in




More information about the Lunar-commits mailing list