[Commits] CVS: theedge/var/lib/lunar/functions build.lunar, 1.9, 1.10 check.lunar, 1.4, 1.5 config.lunar, 1.3, 1.4 depends.lunar, 1.15, 1.16 download.lunar, 1.30, 1.31 edit.lunar, 1.7, 1.8 install.lunar, 1.12, 1.13 locking.lunar, 1.4, 1.5 messages.lunar, 1.11, 1.12 misc.lunar, 1.4, 1.5 modules.lunar, 1.24, 1.25 moonbase.lunar, 1.11, 1.12 optimize.lunar, 1.39, 1.40 postbuild.lunar, 1.7, 1.8 sizes.lunar, 1.4, 1.5 sources.lunar, 1.14, 1.15 tracking.lunar, 1.7, 1.8 uniqid.lunar, 1.5, 1.6

sofar at lunar-linux.org sofar at lunar-linux.org
Mon Aug 4 23:19:44 GMT 2003


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

Modified Files:
	build.lunar check.lunar config.lunar depends.lunar 
	download.lunar edit.lunar install.lunar locking.lunar 
	messages.lunar misc.lunar modules.lunar moonbase.lunar 
	optimize.lunar postbuild.lunar sizes.lunar sources.lunar 
	tracking.lunar uniqid.lunar 
Log Message:
Bugfixes and cleanups.
Adding ZLOCAL_OVERRIDE if you want modules in zlocal to override the moonbase ones (NOT RECOMMENDED)
Pathetically scanning if statements for empty arguments
committing SOURCE_VFY syntax... SOURCE_MD5 syntax is dead as of now in theedge... gpg lives!

shite I fergot the rest.

QOTD:
A bureaucrat's idea of cleaning up his files is to make a copy of everything
before he destroys it.


Index: build.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/build.lunar,v
retrieving revision 1.9
retrieving revision 1.10
diff -u -d -r1.9 -r1.10
--- build.lunar	29 Jul 2003 20:49:28 -0000	1.9
+++ build.lunar	4 Aug 2003 23:19:42 -0000	1.10
@@ -44,7 +44,7 @@
   grep   "/lib/"  $OLD_LOG  |
   while  read  LINE;  do
 
-    if   [  -f      $LINE   ]  &&
+    if [ -f "$LINE"  ]  &&
          file  -bL  $LINE   |
          grep  -q   "shared object"
     then
@@ -177,89 +177,76 @@
 default_pre_build() {
   debug_msg "default_pre_build ($@)"
   verbose_msg "running \"default_pre_build\""
-  if [[ $CVS_SERVER ]]; then
-    validate_source_dir  $SOURCE_DIRECTORY
-    if [[ -d $SOURCE_DIRECTORY ]] &&
-       [[ $KEEP_SOURCE == "on" ]]; then
-      cd $SOURCE_DIRECTORY &&
-      make clean
-    else
-      mk_source_dir        &&
-      cd                   $SOURCE_DIRECTORY &&
-      unpack               $MODULE-$VERSION.tar.bz2
-    fi
+  validate_source_dir  $SOURCE_DIRECTORY 
+  if [[ -d $SOURCE_DIRECTORY ]] &&
+     [[ $KEEP_SOURCE == "on" ]]; then
+    cd $SOURCE_DIRECTORY && 
+    make clean
   else
-    validate_source_dir  $SOURCE_DIRECTORY 
-    if [[ -d $SOURCE_DIRECTORY ]] &&
-       [[ $KEEP_SOURCE == "on" ]]; then
-      cd $SOURCE_DIRECTORY && 
-      make clean
-    else
-      mk_source_dir        $SOURCE_DIRECTORY &&
-      unpack               $SOURCE
-    fi
+    mk_source_dir        $SOURCE_DIRECTORY &&
+    unpack               $SOURCE
   fi
 }
 
 
 default_config() {
   debug_msg "default_config ($@)"
-   verbose_msg "running \"default_config\""
+  verbose_msg "running \"default_config\""
 
-   verbose_msg "CFLAGS=\"$CFLAGS\""            &&
-   verbose_msg "OPTS=\"$OPTS\""                &&
-   verbose_msg "./configure --build=$BUILD --prefix=/usr --sysconfdir=/etc --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man $OPTS"
+  verbose_msg "CFLAGS=\"$CFLAGS\""            &&
+  verbose_msg "OPTS=\"$OPTS\""                &&
+  verbose_msg "./configure --build=$BUILD --prefix=/usr --sysconfdir=/etc --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man $OPTS"
 
-   ./configure  --build=$BUILD            \
-                --prefix=/usr             \
-                --sysconfdir=/etc         \
-                --localstatedir=/var      \
-                --infodir=/usr/share/info \
-                --mandir=/usr/share/man   \
-                $OPTS
+  ./configure  --build=$BUILD            \
+               --prefix=/usr             \
+               --sysconfdir=/etc         \
+               --localstatedir=/var      \
+               --infodir=/usr/share/info \
+               --mandir=/usr/share/man   \
+               $OPTS
 } > $C_FIFO 2>&1
 
 
 default_cvs_config() {
   debug_msg "default_cvs_config ($@)"
-   verbose_msg "running \"default_cvs_config\""
+  verbose_msg "running \"default_cvs_config\""
 
-   verbose_msg "CFLAGS=\"$CFLAGS\""            &&
-   verbose_msg "OPTS=\"$OPTS\""                &&
-   verbose_msg "./autogen.sh --build=$BUILD --prefix=/usr --sysconfdir=/etc --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man $OPTS"
+  verbose_msg "CFLAGS=\"$CFLAGS\""            &&
+  verbose_msg "OPTS=\"$OPTS\""                &&
+  verbose_msg "./autogen.sh --build=$BUILD --prefix=/usr --sysconfdir=/etc --localstatedir=/var --infodir=/usr/share/info --mandir=/usr/share/man $OPTS"
 
-   ./autogen.sh --build=$BUILD            \
-                --prefix=/usr             \
-                --sysconfdir=/etc         \
-                --localstatedir=/var      \
-                --infodir=/usr/share/info \
-                --mandir=/usr/share/man   \
-                $OPTS
+  ./autogen.sh --build=$BUILD            \
+               --prefix=/usr             \
+               --sysconfdir=/etc         \
+               --localstatedir=/var      \
+               --infodir=/usr/share/info \
+               --mandir=/usr/share/man   \
+               $OPTS
 } > $C_FIFO 2>&1
 
 
 default_make() {
   debug_msg "default_make ($@)"
-   verbose_msg "running \"default_make\""
-   make                               &&
-   prepare_install                    &&
-   make    install
+  verbose_msg "running \"default_make\""
+  make                               &&
+  prepare_install                    &&
+  make    install
 } > $C_FIFO 2>&1
 
 
 default_build() {
   debug_msg "default_build ($@)"
-   verbose_msg "running \"default_build\""
-   default_config  &&
-   default_make
+  verbose_msg "running \"default_build\""
+  default_config  &&
+  default_make
 } > $C_FIFO 2>&1
 
 
 default_cvs_build() {
   debug_msg "default_cvs_build ($@)"
-   verbose_msg "running \"default_cvs_build\""
-   default_cvs_config  &&
-   default_make
+  verbose_msg "running \"default_cvs_build\""
+  default_cvs_config  &&
+  default_make
 } > $C_FIFO 2>&1
 
 
@@ -375,6 +362,7 @@
   debug_msg "purge_modules ($@)"
   verbose_msg "Discovering modules that were removed from moonbase"
   for MODULE in $(list_installed | grep -v "^moonbase$") ; do
+  (
     if ! run_details $MODULE &> /dev/null ; then
       message "${MODULE_COLOR}$MODULE${DEFAULT_COLOR}${MESSAGE_COLOR} was removed from ${FILE_COLOR}${MOONBASE}${DEFAULT_COLOR}"
       if query "Do you want to remove ${MODULE_COLOR}$MODULE${DEFAULT_COLOR}${QUERY_COLOR} ?" y ; then
@@ -384,6 +372,7 @@
         message "${MODULE_COLOR}$MODULE${DEFAULT_COLOR}${MESSAGE_COLOR} is kept and can be removed manually later${DEFAULT_COLOR}"
       fi
     fi
+  )
   done 
 }
 
@@ -394,6 +383,7 @@
 list_expired_modules() {
   debug_msg "list_expired_modules ($@)"
   for LINE in $(cat $MODULE_STATUS | grep -v "^moonbase" | sort) ; do
+  (
     MODULE=$(echo "$LINE" | cut -d: -f1)
     IDATE=$(echo "$LINE" | cut -d: -f2)
     STATUS=$(echo "$LINE" | cut -d: -f3)
@@ -408,6 +398,7 @@
 	fi
       fi
     fi
+  )
   done
 }
 
@@ -441,7 +432,7 @@
 # function : update_modules
 # usage    : update_modules
 # purpose  : update all installed modules that need to be updated
-update_modules() {(
+update_modules() {
   debug_msg "update_modules ($@)"
 
   export IFS="$STANDARD_IFS"
@@ -457,7 +448,6 @@
   verbose_msg "Sorting update queue"
   QUEUE=$(sort_by_dependency $LIST)
 
-
   message "${MESSAGE_COLOR}The following modules will be updated:${DEFAULT_COLOR}"
   TMP_QUEUE=$(temp_create "update-queue")
   for MODULE in $QUEUE ; do
@@ -475,7 +465,7 @@
   if [ -n "$QUEUE" ] ; then
     lin -c $QUEUE
   fi
-)}
+}
 
 
 
@@ -516,7 +506,7 @@
 
 }
 
-activity_log()  { (
+activity_log()  {
   debug_msg "activity_log ($@)"
 
     DATE=`date  -u  +%Y%m%d-%T`
@@ -529,7 +519,7 @@
   lock_file $ACTIVITY_LOG &&
   echo "$DATE	$COMMAND	$MODULE	$VERSION	$OUTCOME	$INFO"  >> $ACTIVITY_LOG &&
   unlock_file $ACTIVITY_LOG
-) }
+}
 
 
 syms_not_owned()  {
@@ -559,7 +549,7 @@
 }
 
 
-find_pam_aware()  { (
+find_pam_aware()  {
   debug_msg "find_pam_aware ($@)"
 
   cat  $MODULE_STATUS_BACKUP  |
@@ -581,6 +571,6 @@
     fi
   done
 
-) }
+}
 
 

Index: check.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/check.lunar,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- check.lunar	29 Jul 2003 20:49:28 -0000	1.4
+++ check.lunar	4 Aug 2003 23:19:42 -0000	1.5
@@ -25,7 +25,7 @@
 ############################################################
 
 
-ldd_check()  {  (
+ldd_check()  {
   debug_msg "ldd_check ($@)"
   if  [  "$LDD_CHECK"  ==  "off"    ] ;  then
     return
@@ -35,7 +35,7 @@
        I_LOG=$INSTALL_LOGS/$MODULE-$VERSION
   LDD_STATUS=0
 
-  if  [  -e  $I_LOG  ];  then
+  if  [  -e  "$I_LOG"  ];  then
     IFS_OLD="$IFS"
     export  IFS="	
 "
@@ -65,10 +65,10 @@
     done
   fi
   return  $LDD_STATUS
-) }
+}
 
 
-find_check()  { (
+find_check()  {
   debug_msg "find_check ($@)"
   if  [  "$FIND_CHECK"  ==  "off"             ]   ||
       [  "$1"           ==  "xfree86"         ]   ||
@@ -80,7 +80,7 @@
         I_LOG=$INSTALL_LOGS/$MODULE-$VERSION
   FIND_STATUS=0
 
-  if  [  -e  $I_LOG  ];  then
+  if  [  -e  "$I_LOG"  ];  then
     IFS_OLD="$IFS"
     export  IFS="	
 "
@@ -112,10 +112,10 @@
     FIND_STATUS=1
   fi
   return  $FIND_STATUS
-) }
+}
 
 
-sym_check()  { (
+sym_check()  {
   debug_msg "sym_check ($@)"
   if  [  "$SYM_CHECK"  ==  "off"  ];  then
     return
@@ -124,7 +124,7 @@
 	  VERSION=`installed_version  $MODULE`
         I_LOG=$INSTALL_LOGS/$MODULE-$VERSION
 
-  if  [  -e  $I_LOG  ];  then
+  if  [  -e  "$I_LOG"  ];  then
     IFS_OLD="$IFS"
     export  IFS="	
 "
@@ -146,10 +146,10 @@
       fi
     done
   fi
-) }
+}
 
 
-md5sum_check()  { (
+md5sum_check()  {
   debug_msg "md5sum_check ($@)"
   if  [  "$MD5SUM_CHECK"  ==  "off"  ];  then
     return
@@ -161,7 +161,7 @@
 
   MD5SUM_STATUS=0
 
-  if  [  -e  $MD5_LOG  ];  then
+  if  [  -e  "$MD5_LOG"  ];  then
     IFS_OLD="$IFS"
     export  IFS="	
 "
@@ -203,7 +203,7 @@
     MD5SUM_STATUS=1
   fi
   return  $MD5SUM_STATUS
-) }
+}
 
 
 run_checks() {
@@ -214,4 +214,4 @@
   md5sum_check $1
 }
 
-		
+

Index: config.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/config.lunar,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- config.lunar	29 Jul 2003 20:49:28 -0000	1.3
+++ config.lunar	4 Aug 2003 23:19:42 -0000	1.4
@@ -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/theedge/var/lib/lunar/functions/depends.lunar,v
retrieving revision 1.15
retrieving revision 1.16
diff -u -d -r1.15 -r1.16
--- depends.lunar	29 Jul 2003 20:49:28 -0000	1.15
+++ depends.lunar	4 Aug 2003 23:19:42 -0000	1.16
@@ -66,11 +66,11 @@
 
 
 
-is_depends()  {  (
+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()  {
@@ -176,7 +176,7 @@
                                                                                 
   prepare_depends_status
   grep -q "^"$MODULE"\$" $TEMP_PREPAREDDEPS 2>/dev/null && return 0
-  if [ -s $SCRIPT_DIRECTORY/DEPENDS ] ; then
+  if [ -s "$SCRIPT_DIRECTORY/DEPENDS" ] ; then
     message  "${CHECK_COLOR}Checking dependencies for"  \
              "${MODULE_COLOR}${MODULE}"                   \
              "${DEFAULT_COLOR}"
@@ -220,7 +220,7 @@
   }
   run_depends() {
   debug_msg "  run_depends ($@)"
-    if [ -s $SCRIPT_DIRECTORY/DEPENDS ] ; then
+    if [ -s "$SCRIPT_DIRECTORY/DEPENDS" ] ; then
       show_fancy_progress "Processing: $MODULE"
       run_module_file $MODULE DEPENDS
     fi
@@ -356,7 +356,7 @@
   if [ -n "$CHANGED_MODULES" ] ; then
                                                                                 
     for MODULE in $CHANGED_MODULES ; do
-      if [ ! -e $TMP/depends.new.$MODULE ] ; then
+      if [ ! -e "$TMP/depends.new.$MODULE" ] ; then
         rework_module $MODULE
       fi
     done
@@ -436,7 +436,7 @@
   
   unset OPTS
 
-  if [ -s $MODULE_CONFIG ] ; then
+  if [ -s "$MODULE_CONFIG" ] ; then
     . $MODULE_CONFIG
   fi
 

Index: download.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/download.lunar,v
retrieving revision 1.30
retrieving revision 1.31
diff -u -d -r1.30 -r1.31
--- download.lunar	29 Jul 2003 20:49:28 -0000	1.30
+++ download.lunar	4 Aug 2003 23:19:42 -0000	1.31
@@ -33,7 +33,7 @@
 ############################################################
 
 
-get_svn() {(
+get_svn() {
   debug_msg "get_svn ($@)"
   if ! module_installed subversion ; then
     message "${PROBLEM_COLOR}! Cannot fetch SVN sources without \"subversion\" installed${DEFAULT_COLOR}"
@@ -49,11 +49,11 @@
   mk_source_dir /tmp/$MODULE-$VERSION
   cd /tmp/$MODULE-$VERSION
 
-  if [[ -f $SOURCE_CACHE/$2 ]]; then
+  if [ -f "$2" ] ; then
     verbose_msg "Extracting local SVN copy"
     # unpacking in last component dir of $SVN_DIR
     CD=$(pwd -P)
-    if ! tar xjf $SOURCE_CACHE/$2 ; then
+    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
@@ -63,12 +63,12 @@
   fi
 
   NUM_RETRY=${NUM_RETRY:-5}
-  if [ $NUM_RETRY -eq 0 ]; then
+  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
+    if [ -d "${SVN_DIR}/.svn" ] ; then
       cd ${SVN_DIR}
       verbose_msg "[${TRY}] svn up"
       svn up && GOT_SVN="yes" 
@@ -85,10 +85,10 @@
     sleep 2
   done
   
-  if [[ "$GOT_SVN" == "yes" ]]; then
-    message "${MESSAGE_COLOR}Creating ${FILE_COLOR}${SOURCE}${DEFAULT_COLOR}"
+  if [ "$GOT_SVN" == "yes" ] ; then
+    message "${MESSAGE_COLOR}Creating ${FILE_COLOR}$2${DEFAULT_COLOR}"
     # pack in last component dir of $SVN_DIR
-    tar cjf $SOURCE_CACHE/$2 $SVN_DIR
+    tar cjf $2 $SVN_DIR
   else
     activity_log "lget"  "$MODULE"  "$VERSION"  "failed" "Could not get $1"
   fi
@@ -96,10 +96,10 @@
   cd /tmp
   rm_source_dir /tmp/$MODULE-$VERSION
 
-)}
+}
 
 
-get_cvs() {(
+get_cvs() {
   debug_msg "get_cvs ($@)"
   if ! module_installed cvs ; then
     message "${PROBLEM_COLOR}! Cannot fetch CVS sources without \"cvs\" installed!${DEFAULT_COLOR}"
@@ -115,7 +115,7 @@
   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
 
@@ -128,13 +128,15 @@
   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 -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
+    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
@@ -148,7 +150,7 @@
   verbose_msg "CVSROOT=\"$CVSROOT\""
 
   NUM_RETRY=${NUM_RETRY:-5}
-  if [ $NUM_RETRY -eq 0 ]; then
+  if [ "$NUM_RETRY" -eq 0 ]; then
     NUM_RETRY=1000
   fi
 
@@ -172,7 +174,7 @@
     message "${MESSAGE_COLOR}Creating ${FILE_COLOR}${2}${DEFAULT_COLOR}"
     # pack in last component dir of $CVSMODULE
     cd /tmp/$MODULE-$VERSION/$(dirname $CVSMODULE)
-    tar cjf $SOURCE_CACHE/$2 $(basename $CVSMODULE)
+    tar cjf $2 $(basename $CVSMODULE)
     cd $CD
   else
     activity_log "lget"  "$MODULE"  "$VERSION"  "failed" "Could not get $CVSMODULE"
@@ -181,7 +183,7 @@
   cd /tmp
   rm_source_dir /tmp/$MODULE-$VERSION
 
-)}
+}
 
 
 erase()  {
@@ -199,71 +201,89 @@
    [ -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"
     return 1
   fi
 
-  if testpack $(guess_filename $2) && mv $(guess_filename $2) $SOURCE_CACHE ; then
+  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 $2)
+    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() {
   debug_msg "get_url ($@)"
-  if  [  -n  "$1"  ] ;  then
+  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)"
@@ -275,9 +295,9 @@
       # svn urls
       SVN_THRESHOLD=${SVN_THRESHOLD:-10}
       if [ "SVN_THRESHOLD" > 0 ] ; then
-        if [ ! -f $SOURCE_CACHE/$2 ] ; then
+        if [ ! -f "$2" ] ; then
 	  get_svn $1 $2
-	elif [ "$(find $SOURCE_CACHE/$2 -amin +$SVN_THRESHOLD)" == "$SOURCE_CACHE/$2" ] ; then
+	elif [ "$(find $2 -amin +$SVN_THRESHOLD)" == "$2" ] ; then
 	  get_svn $1 $2
 	else
 	  verbose_msg "Skipping svn update (less than $SVN_THRESHOLD mins old)"
@@ -292,18 +312,23 @@
       # 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
     fi
@@ -334,7 +359,8 @@
 }
 
 
-download_module() { (
+download_module() {
+(
   debug_msg "download_module ($@)"
   if ! run_details $1 ; then
     exit 1
@@ -371,13 +397,13 @@
       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
-	elif [ ${URL:0:6} == "svn://" ] ; then
+	  get_url $URL $SOURCE_CACHE/$SRC
+	elif [ "${URL:0:6}" == "svn://" ] ; then
 	  verbose_msg "trying to download \"$URL\""
-	  get_url $URL $SRC
+	  get_url $URL $SOURCE_CACHE/$SRC
 	else
 	  verbose_msg "Skipping download of \"$SRC\" for module \"$MODULE\" (in cache)"
 	  continue 2
@@ -388,22 +414,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 () {
-  debug_msg "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/theedge/var/lib/lunar/functions/edit.lunar,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- edit.lunar	29 Jul 2003 20:49:28 -0000	1.7
+++ edit.lunar	4 Aug 2003 23:19:42 -0000	1.8
@@ -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 ${DEFAULT_COLOR}${FILE_COLOR}$1${DEFAULT_COLOR}"
-  rm -f $TMPFILE1 $TMPFILE2
+
+  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 $@;

Index: install.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/install.lunar,v
retrieving revision 1.12
retrieving revision 1.13
diff -u -d -r1.12 -r1.13
--- install.lunar	4 Aug 2003 18:49:22 -0000	1.12
+++ install.lunar	4 Aug 2003 23:19:42 -0000	1.13
@@ -43,12 +43,12 @@
   # maintainer at lunar-linux.org.
 
   # Usage check_checklist $MODULES
-  if ! [[ $PLATFORM ]]; then
+  if [ -z "$PLATFORM" ] ; then
     PLATFORM=x86
   fi
-  if [[ -f /var/state/lunar/blacklist.$PLATFORM ]]; then
-    BLKLST=`grep ^$MODULE$ /var/state/lunar/blacklist.$PLATFORM`
-    if [[ $BLKLST == $MODULE ]]; then
+  if [ -f /var/state/lunar/blacklist.$PLATFORM ] ; then
+    BLKLST=$(grep ^$MODULE$ /var/state/lunar/blacklist.$PLATFORM)
+    if [ "$BLKLST" == "$MODULE" ] ; then
       message "${PROBLEM_COLOR}! Module ${DEFAULT_COLOR}${MODULE_COLOR}$MODULE${DEFAULT_COLOR}${PROBLEM_COLOR} is blacklisted and will not be installed${DEFAULT_COLOR}"
       exit 0
     fi
@@ -74,7 +74,7 @@
 
 prepare_module_config()  {
   debug_msg "prepare_module_config ($@)"
-  if [ ! -x $MODULE_CONFIG  ] ; then
+  if [ ! -x "$MODULE_CONFIG" ] ; then
     touch $MODULE_CONFIG
     chmod a+x $MODULE_CONFIG
   fi
@@ -108,7 +108,7 @@
 
   cd $BUILD_DIRECTORY
 
-  if verify_sources ; then
+  if verify_all_sources $MODULE ; then
     if [ -s $SCRIPT_DIRECTORY/PRE_BUILD ] ; then
       run_module_file $MODULE PRE_BUILD
     else
@@ -253,7 +253,7 @@
 }
 
 
-run_fix()  { (
+run_fix()  {
   debug_msg "run_fix ($@)"
   MODULES=$*
 
@@ -297,10 +297,11 @@
           PASSED="$PASSED$MODULE:"
         else
           FIXED="no"
-          (  run_details $MODULE  &&
-             satisfy_depends      &&
-             unset FIX            &&
-             satisfy_depends
+          (  
+	    run_details $MODULE  &&
+            satisfy_depends      &&
+            unset FIX            &&
+            satisfy_depends
           )
 
           if  [  "$LDD_CHECK"  ==  "on"    ] ;  then
@@ -330,10 +331,11 @@
     done
   done
   rm  -f  /tmp/LD_LIBRARY_PATH_FILE
-) }
+}
 
 
-resurrect()  {  ( 
+resurrect()  {
+(
   debug_msg "resurrect ($@)"
   if ! run_details $1 ; then
     return 1
@@ -351,7 +353,7 @@
 
   CACHE_BZ="$INSTALL_CACHE/$MODULE-$VERSION-$BUILD.tar.bz2"
 
-  if [ -f $CACHE_BZ ] && bzip2 -tf $CACHE_BZ ; then
+  if [ -f "$CACHE_BZ" ] && bzip2 -tf $CACHE_BZ ; then
     message  "${RESURRECT_COLOR}Resurrecting ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR} ${MESSAGE_COLOR}version ${VERSION_COLOR}${VERSION}${DEFAULT_COLOR}"
     bzip2 -cd $CACHE_BZ | tar -Pkx 1>/dev/null 2>&1
     add_module $MODULE $STATUS $VERSION
@@ -362,7 +364,8 @@
   else
     false
   fi
-)  }
+)
+}
 
 
 show_download_progress()  {
@@ -398,7 +401,8 @@
 
 
 
-lin_module()  { (
+lin_module()  {
+(
   debug_msg "lin_module ($@)"
   # make sure we got all the info
   if ! run_details $1 ; then
@@ -451,7 +455,7 @@
 
       # important stuff here!!!
       invoke_installwatch &&
-      if ! [[ $CFLAGS ]] ; then
+      if [ -z "$CFLAGS" ] ; then
         optimize
       fi  &&
       
@@ -515,7 +519,8 @@
       return 1
     fi
   fi
-) }
+)
+}
 
 
 lin_locked()  {
@@ -555,22 +560,29 @@
 }
 
 
+build_module_depends() {
+(
+  debug_msg "build_module_depends ($@)"
+  run_details $1 &&
+  run_configure &&
+  run_depends &&
+  satisfy_depends
+)
+}
+
+
 build_depends()  {
   debug_msg "build_depends ($@)"
   for MODULE in $@ ; do
     if ! module_installed $MODULE || [ ! -n "$PROBE" ] ; then
       if ! module_held $MODULE ; then
-        ( 
-          run_details $MODULE  &&
-          run_configure        &&
-          run_depends          &&
-          satisfy_depends
-        )
+        build_module_depends $MODULE
       else
         verbose_msg "Skipping dependency checking of held module \"$MODULE\""
       fi
     fi
   done
 }
+
 
 

Index: locking.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/locking.lunar,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- locking.lunar	29 Jul 2003 20:49:28 -0000	1.4
+++ locking.lunar	4 Aug 2003 23:19:42 -0000	1.5
@@ -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/theedge/var/lib/lunar/functions/messages.lunar,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- messages.lunar	29 Jul 2003 20:49:28 -0000	1.11
+++ messages.lunar	4 Aug 2003 23:19:42 -0000	1.12
@@ -149,7 +149,7 @@
   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
     ;;

Index: misc.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/misc.lunar,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- misc.lunar	29 Jul 2003 20:49:28 -0000	1.4
+++ misc.lunar	4 Aug 2003 23:19:42 -0000	1.5
@@ -99,16 +99,20 @@
   BASENAME=${BASENAME/.tar.bz2/}
   BASENAME=${BASENAME/.tgz/}
 
-  if [ -f $FILENAME ] ; then
+  if [ -f "$FILENAME" ] ; then
+    debug_msg "guess_filename: $FILENAME"
     echo $FILENAME
   elif [ "$FUZZY" == "off" ] ; then
     return 1
-  elif [ -f $BASENAME.tar.gz ] ; then
+  elif [ -f "$BASENAME.tar.gz" ] ; then
     echo $BASENAME.tar.gz
-  elif [ -f $BASENAME.tar.bz2 ] ; then
+    debug_msg "guess_filename: $BASENAME.tar.gz"
+  elif [ -f "$BASENAME.tar.bz2" ] ; then
     echo $BASENAME.tar.bz2
-  elif [ -f $BASENAME.tgz ] ; then
+    debug_msg "guess_filename: $BASENAME.tar.bz2"
+  elif [ -f "$BASENAME.tgz" ] ; then
     echo $BASENAME.tgz
+    debug_msg "guess_filename: $BASENAME.tgz"
   else
     return 1
   fi
@@ -120,7 +124,7 @@
 # purpose  : filter stdin with files/dirs/symlinks provided in file $1.
 filter() {
   debug_msg "filter ($@)"
-  if [ -f $1 ] ; then
+  if [ -f "$1" ] ; then
     grep -v $(
       for DIR in `directories < $1 2>/dev/null` ; do
         echo -n "^$DIR\|"

Index: modules.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/modules.lunar,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- modules.lunar	29 Jul 2003 20:49:28 -0000	1.24
+++ modules.lunar	4 Aug 2003 23:19:42 -0000	1.25
@@ -27,7 +27,7 @@
 # function : list_sections
 # usage    : list_sections
 # purpose  : list the moonbase sections, filter out the specific files
-list_sections() {(
+list_sections() {
   debug_msg "list_sections ($@)"
   check_module_index
   SECTIONS=$(grep -v ^MOONBASE_MD5 $MODULE_INDEX  2>/dev/null | \
@@ -45,13 +45,13 @@
   fi
 
   return 1
-)}
+}
 
 
 # function : list_modules
 # usage    : list_modules $SECTION
 # purpose  : list the modules in a section, filter out the specific files
-list_modules() {(
+list_modules() {
   debug_msg "list_modules ($@)"
   if [ -z "$1" ] ; then
     message "${PROBLEM_COLOR}list_modules(): no SECTION defined!${DEFAULT_COLOR}" 
@@ -64,18 +64,18 @@
     echo "$MODULE" 
   done
   return 0
-)}
+}
 
 
 # function : list_moonbase
 # usage    : list_moonbase
 # purpose  : returns the names of all modules in moonbase
-list_moonbase() {(
+list_moonbase() {
   debug_msg "list_moonbase ($@)"
   for SECTION in $(list_sections) ; do
     list_modules $SECTION
   done				
-)}
+}
 
 
 # function : list_installed
@@ -98,7 +98,7 @@
   # 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
+  if [ ! -w "$MODULE_INDEX" ] ; then
     return 0
   fi
 
@@ -120,7 +120,7 @@
 # purpose : checks if the index is up-to-date regarding to moonbase
 function check_module_index() {
   debug_msg "function check_module_index ($@)"
-  if [ `get_moonbase_md5` != `set_moonbase_md5` ] ; then
+  if [ $(get_moonbase_md5) != $(set_moonbase_md5) ] ; then
     create_module_index
     return 0
   else
@@ -133,11 +133,20 @@
 # usage    : find_section "module name"
 # purpose  : finds the section of a given module as parameter
 # returns  : (0) on success, (1) on failure, errors on stdout
-find_section() {(
+find_section() {
   debug_msg "find_section ($@)"
+
+  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
@@ -147,7 +156,7 @@
 
   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
@@ -161,7 +170,7 @@
   done
 
   return 1
-)}
+}
 
 
 # function : run_details
@@ -215,8 +224,7 @@
 # function : module_installed
 # usage    : module_installed $MODULE
 # purpose  : check if $MODULE is installed (or held)
-module_installed()
-{
+module_installed() {
   $(cat $MODULE_STATUS | cut -d: -f1,3 | grep -q -e "^$1:installed" -e "^$1:held")
 }
 

Index: moonbase.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/moonbase.lunar,v
retrieving revision 1.11
retrieving revision 1.12
diff -u -d -r1.11 -r1.12
--- moonbase.lunar	29 Jul 2003 20:49:28 -0000	1.11
+++ moonbase.lunar	4 Aug 2003 23:19:42 -0000	1.12
@@ -9,7 +9,8 @@
 ############################################################
 
 
-get_moonbase () {(
+get_moonbase () {
+(
   debug_msg "get_moonbase  ($@)"
 
   SYSTEM_MOONBASE=/var/lib/lunar/moonbase
@@ -30,11 +31,11 @@
   run_details
   rm -f /tmp/$SOURCE
 
-  if [ ! -d $SYSTEM_MOONBASE ] ; then
+  if [ ! -d "$SYSTEM_MOONBASE" ] ; then
     mkdir -p $SYSTEM_MOONBASE
   fi
   
-  if [ ! -d $SYSTEM_MOONBASE/zlocal ] ; then
+  if [ ! -d "$SYSTEM_MOONBASE/zlocal" ] ; then
     mkdir -p $SYSTEM_MOONBASE/zlocal
   fi
 
@@ -61,7 +62,7 @@
     # 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
+    if [ -f "$MODULE_INDEX" ]; then
       rm -f $MODULE_INDEX
     fi
     create_module_index
@@ -73,7 +74,8 @@
     INFO="Could not download a fresh moonbase"
   fi
   activity_log "lin" "moonbase" "$VERSION" "$OUTCOME" "$INFO"
-)}
+)
+}
 
 
 # function : set_moonbase_md5

Index: optimize.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/optimize.lunar,v
retrieving revision 1.39
retrieving revision 1.40
diff -u -d -r1.39 -r1.40
--- optimize.lunar	29 Jul 2003 20:49:28 -0000	1.39
+++ optimize.lunar	4 Aug 2003 23:19:42 -0000	1.40
@@ -20,53 +20,24 @@
 # $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 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"
-#
-
 
 # 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
+  if [[ "$1" == "ALL" ]]; then
     unset CFLAGS CXXFLAGS CPPFLAGS LDFLAGS
-  elif [[ $1 == "compiler" ]]; then
+  elif [[ "$1" == "compiler" ]]; then
     unset CFLAGS CXXFLAGS CPPFLAGS
-  elif [[ $1 == "linker" ]]; then
+  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//`
+    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
 }
@@ -83,18 +54,17 @@
 
 optimize_make() {
   debug_msg "optimize_make ($@)"
-  if [[ $PSAFE == "no" ]]; then
+  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\""
@@ -103,7 +73,7 @@
 
 optimize_base() {
   debug_msg "optimize_base ($@)"
-   if ! [[ $1 ]]; then
+   if ! [ "$1" ] ; then
       BOPT="None"
    fi
 
@@ -761,9 +731,36 @@
 
 optimize() {
   debug_msg "optimize ($@)"
-   unset CFLAGS CXXFLAGS LDFLAGS
+  # 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
 
-   case $PLATFORM in
+  #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       &&
@@ -805,7 +802,7 @@
                 optimize_ld       ${LDF[@]}  &&
 		optimize_addon
                 ;;
-   esac
+  esac
 
   export CC_EXT
   export CXX_EXT
@@ -816,11 +813,11 @@
   export LDFLAGS
 
   use_wrappers
+  verbose_msg "BUILD=\"$BUILD\""
   verbose_msg "GCCVER=\"$GCCVER\""
   verbose_msg "CFLAGS=\"$CFLAGS\""
   verbose_msg "CXXFLAGS=\"$CXXFLAGS\""
   verbose_msg "LDFLAGS=\"$LDFLAGS\""
-
 }
 
 

Index: postbuild.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/postbuild.lunar,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- postbuild.lunar	29 Jul 2003 20:49:28 -0000	1.7
+++ postbuild.lunar	4 Aug 2003 23:19:42 -0000	1.8
@@ -32,7 +32,7 @@
   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
@@ -64,7 +64,7 @@
 }
 
 
-install_xinetd_confs()  { (
+install_xinetd_confs()  {
   debug_msg "install_xinetd_confs ($@)"
   if  [  -d  "$SCRIPT_DIRECTORY/xinetd.d"  ];  then
     cd       "$SCRIPT_DIRECTORY/xinetd.d"
@@ -88,10 +88,10 @@
       invoke_installwatch
     fi
   fi
-) }
+}
 
 
-use_xinetd()  { (
+use_xinetd()  {
   debug_msg "use_xinetd ($@)"
   if  [  -d  $SCRIPT_DIRECTORY/xinetd.d  ]  &&
       !  grep  -q  "SERVICES="  $MODULE_CONFIG
@@ -133,10 +133,10 @@
   else
     return 1
   fi
-) }
+}
 
 
-install_initd()  { (
+install_initd()  {
   debug_msg "install_initd ($@)"
   [ -d /etc/init.d ] || mkdir -p /etc/init.d
 
@@ -169,10 +169,10 @@
     fi
 
   done
-) }
+}
 
 
-use_initd()  { (
+use_initd()  {
   debug_msg "use_initd ($@)"
   if  [  -d  $SCRIPT_DIRECTORY/init.d  ] ; then
     cd $SCRIPT_DIRECTORY/init.d
@@ -197,10 +197,10 @@
 
     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"
@@ -210,10 +210,10 @@
       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
@@ -225,8 +225,5 @@
     cp $SCRIPT_DIRECTORY/skel/[!CVS]* /etc/skel &> /dev/null
     cp $SCRIPT_DIRECTORY/skel/.* /etc/skel &> /dev/null
   fi
-) }
-
-
-
+}
 

Index: sizes.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/sizes.lunar,v
retrieving revision 1.4
retrieving revision 1.5
diff -u -d -r1.4 -r1.5
--- sizes.lunar	29 Jul 2003 20:49:28 -0000	1.4
+++ sizes.lunar	4 Aug 2003 23:19:42 -0000	1.5
@@ -19,8 +19,7 @@
 # function: find_module_size
 # usage   : find_module_size <module> |version|
 # purpose : finds the installed size of module in KB
-find_module_size()
-{
+find_module_size() {
    #this functions checks the modules file if there is already size entry
    module_size()
    {

Index: sources.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/sources.lunar,v
retrieving revision 1.14
retrieving revision 1.15
diff -u -d -r1.14 -r1.15
--- sources.lunar	29 Jul 2003 20:49:28 -0000	1.14
+++ sources.lunar	4 Aug 2003 23:19:42 -0000	1.15
@@ -1,4 +1,5 @@
 #!/bin/bash
+############################################################
 #                                                          #
 # This code is written for Lunar Linux, see                #
 # http://www.lunar-linux.org                               #
@@ -32,17 +33,12 @@
 }
 
 
-verify_sources() {
-  debug_msg "verify_sources ($@)"
-  md5_verify_source $(sources $MODULE MD5)
-}
-
-
 # function : sources
 # usage    : sources <module_name> {MD5|VFY|
 # purpose  : displays the filenames and md5sums or VFY part of sources
 #            for a given module
-sources() { (
+sources() {
+(
   debug_msg "sources ($@)"
   MAX_SOURCES=${MAX_SOURCES:=100}
 
@@ -60,11 +56,6 @@
       if [ -z "$SRC_MD5" ] ; then
         SRC_MD5=0
       fi
-    elif [ "$2" == "VFY" ] ; then
-      eval SRC_VFY=\$${TEMP}_VFY
-      if [ -z "$SRC_VFY" ] ; then
-        SRC_VFY=0
-      fi
     fi
 
     eval SRC2=\$SOURCE$((CNT+1))
@@ -74,8 +65,6 @@
       echo $SRC1
       if [ "$2" == "MD5" ] ; then
         echo $SRC_MD5
-      elif [ "$2" == "VFY" ] ; then
-        echo $SRC_VFY
       fi
     fi
 
@@ -84,40 +73,19 @@
       break
     }
   done
-) }
+)
+}
 
 
 # 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() {
   debug_msg "md5_verify_source ($@)"
-  ALL_OK=true   
-  while [ -n "$2" ]
-  do
-    if ! verify_source $1 ; then
-      return 1
-    fi
-
-    if [ "$2" == "0" ] ; then
-      TEMP=0
-    else
-      verbose_msg "checking md5sum of \"$1\""
-      TEMP=$(md5sum $SOURCE_CACHE/$1 | cut -d " " -f 1-1)
-    fi
-      
-    if [ "$TEMP" != "$2" ] ; then 
-       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
-    fi
+  if [ "$2" != "$(md5sum $SOURCE_CACHE/$1 | cut -d " " -f 1-1)" ] ; then
+     return 1
+  fi
 
-    shift 2
-  done
-  $ALL_OK
 }
 
 
@@ -139,7 +107,7 @@
             *)  false                                   ;;
   esac
 
-  if [ $? != 0 ] ; then
+  if [ "$?" != 0 ] ; then
     message "${PROBLEM_COLOR}! Error while unpacking ${FILE_COLOR}$SOURCE_CACHE/$1${DEFAULT_COLOR}${PROBLEM_COLOR}${DEFAULT_COLOR}"
     return 1
   fi
@@ -158,6 +126,7 @@
 
 # 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
@@ -167,6 +136,7 @@
   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
@@ -175,22 +145,96 @@
   # 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 \"$1\""
-    verbose_msg "GNUPGHOME=/var/state/lunar/ gpg --verify $TMP_GPG_SIG $1"
-    if GNUPGHOME=/var/state/lunar/ gpg --verify $TMP_GPG_SIG $1 ; then
-      echo good!
-    else
-      echo bad!
+    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_SIG
-    verbose_msg "result was \"$?\""
+    temp_destroy $TMP_GPG_SIG
+    temp_destroy $TMP_GPG_KEYS
   else
-    message "B()RK"
-    temp_destroy $TMP_SIG
-    exit 1
+    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: tracking.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/tracking.lunar,v
retrieving revision 1.7
retrieving revision 1.8
diff -u -d -r1.7 -r1.8
--- tracking.lunar	2 Aug 2003 22:16:36 -0000	1.7
+++ tracking.lunar	4 Aug 2003 23:19:42 -0000	1.8
@@ -71,7 +71,6 @@
   debug_msg "create_install_log ($@)"
 
   TMP_INST_LOG=$(temp_create "install-log")
-  chmod 644 $TMP_INST_LOG
   INST_LOG="$INSTALL_LOGS/$MODULE-$VERSION"
   rm -f $INST_LOG &> /dev/null
 
@@ -94,7 +93,7 @@
                       echo  -n  "/dev/null")
 
   if [ "$MISOWNED_SYMLINKS" == "/dev/null" ] ; then
-    cp $TMP_INST_LOG $INST_LOG
+    install -m644 $TMP_INST_LOG $INST_LOG
   else
     grep -v "$MISOWNED_SYMLINKS" $TMP_INST_LOG > $INST_LOG
   fi
@@ -129,7 +128,7 @@
 }
 
 
-boost()	{ (
+boost()	{
   debug_msg "boost ($@)"
 
   create_install_log    &&
@@ -141,6 +140,6 @@
 
   rm  -f  $BOOST_LOCK
 
-) }
+}
 
 

Index: uniqid.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/uniqid.lunar,v
retrieving revision 1.5
retrieving revision 1.6
diff -u -d -r1.5 -r1.6
--- uniqid.lunar	29 Jul 2003 20:49:28 -0000	1.5
+++ uniqid.lunar	4 Aug 2003 23:19:42 -0000	1.6
@@ -11,7 +11,7 @@
 
 push_uniq_id() {
   debug_msg "push_uniq_id ($@)"
-  if [ "$UNIQID" == "" ]; then
+  if [ -z "$UNIQID" ]; then
     create_uniq_id
   fi
  
@@ -23,11 +23,11 @@
 
 create_uniq_id() {
   debug_msg "create_uniq_id ($@)"
-  if [ $UNIQID >= "" ]; then 
+  if [ -n "$UNIQID" ]; then 
     return
   fi
 
-  OS=`uname -s`
+  OS=$(uname -s)
 
   if [  "$OS"  == "OpenBSD" ]; then
     HASH="sha1"




More information about the Lunar-commits mailing list