[Lunar-commits] r14857 - in lunar/branches/stable/var/lib/lunar: functions plugins

Auke Kok sofar at lunar-linux.org
Fri May 20 08:42:21 UTC 2005


Author: sofar
Date: 2005-05-20 08:42:19 +0000 (Fri, 20 May 2005)
New Revision: 14857

Added:
   lunar/branches/stable/var/lib/lunar/plugins/initd.plugin
   lunar/branches/stable/var/lib/lunar/plugins/postbuild-generic.plugin
Removed:
   lunar/branches/stable/var/lib/lunar/functions/postbuild.lunar
Modified:
   lunar/branches/stable/var/lib/lunar/functions/aliases.lunar
   lunar/branches/stable/var/lib/lunar/functions/build.lunar
   lunar/branches/stable/var/lib/lunar/functions/check.lunar
   lunar/branches/stable/var/lib/lunar/functions/config.lunar
   lunar/branches/stable/var/lib/lunar/functions/connect.lunar
   lunar/branches/stable/var/lib/lunar/functions/depends.lunar
   lunar/branches/stable/var/lib/lunar/functions/download.lunar
   lunar/branches/stable/var/lib/lunar/functions/edit.lunar
   lunar/branches/stable/var/lib/lunar/functions/kernel.lunar
   lunar/branches/stable/var/lib/lunar/functions/locking.lunar
   lunar/branches/stable/var/lib/lunar/functions/logging.lunar
   lunar/branches/stable/var/lib/lunar/functions/main.lunar
   lunar/branches/stable/var/lib/lunar/functions/messages.lunar
   lunar/branches/stable/var/lib/lunar/functions/misc.lunar
   lunar/branches/stable/var/lib/lunar/functions/modules.lunar
   lunar/branches/stable/var/lib/lunar/functions/optimize.lunar
   lunar/branches/stable/var/lib/lunar/functions/plugins.lunar
   lunar/branches/stable/var/lib/lunar/functions/prune.lunar
   lunar/branches/stable/var/lib/lunar/functions/sizes.lunar
   lunar/branches/stable/var/lib/lunar/functions/sources.lunar
   lunar/branches/stable/var/lib/lunar/functions/temp.lunar
   lunar/branches/stable/var/lib/lunar/functions/tracking.lunar
   lunar/branches/stable/var/lib/lunar/functions/uniqid.lunar
   lunar/branches/stable/var/lib/lunar/functions/updatelog.lunar
   lunar/branches/stable/var/lib/lunar/functions/useradd.lunar
Log:
Merge with theedge:
- alias fixes
- update plugin framework to include new plugin types
- ENV var protection enabled using 'local'
- moonbase update changes display fixes


Modified: lunar/branches/stable/var/lib/lunar/functions/aliases.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/aliases.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/aliases.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -12,6 +12,7 @@
 # translate %ALIAS if needed to a module name that is installed
 # and add it to the dependency chain if needed
 unalias() {
+  local TARGET TARGETS TARGETBYNUM N CHOICE
   if [ "${1:0:1}" == "%" ] ; then
     debug_msg "unalias($@)"
     TARGETS=$(grep "^$1:" $ALIASES | cut -d: -f2-)

Modified: lunar/branches/stable/var/lib/lunar/functions/build.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/build.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/build.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -28,6 +28,7 @@
 
 
 save_libraries()  {
+  local OLD_VERSION OLD_LOG OLD_LIBS SAVED LINE
   debug_msg "save_libraries ($@)"
 
   [ "$MODULE" == "glibc" ] && return 0
@@ -75,6 +76,7 @@
 
 
 release_saved_libraries()  {
+  local OLD_LIBS SAVED FILE
   debug_msg "release_saved_libraries ($@)"
   OLD_LIBS=$SOURCE_DIRECTORY/old.libraries
   SAVED=$OLD_LIBS/$MODULE.saved.libraries
@@ -91,6 +93,7 @@
 
 
 export_ld()  {
+  local DIRECTORY
   debug_msg "export_ld ($@)"
   for DIRECTORY in $* ; do
     if file -b $DIRECTORY/*.so* | grep  -q  "shared object" ; then
@@ -106,7 +109,7 @@
 
 prepare_install() {
   debug_msg "prepare_install ($@)"
-  if  module_installed $MODULE  || module_held $MODULE ; then
+  if module_installed $MODULE || module_held $MODULE ; then
     message  "${MESSAGE_COLOR}Preparing to install"  \
              "${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
     save_libraries
@@ -114,8 +117,12 @@
     lrm --upgrade $MODULE
     true
   fi
-  # turn on tracking now
+  # turn on tracking now 
   invoke_installwatch
+  plugin_call BUILD_INSTALL $MODULE
+  if [ $? == 2 ]; then
+    return 0
+  fi
 }
 
 
@@ -212,6 +219,7 @@
 
 
 default_cpan_pre_build() {
+  local CPAN_MODULE CPAN_SOURCE_BRANCH
   debug_msg "default_cpan_pre_build ($@)"
   mk_source_dir $SOURCE_DIRECTORY
   cd $SOURCE_DIRECTORY
@@ -223,6 +231,7 @@
 
 
 default_cpan_build() {
+  local CPAN_MODULE
   debug_msg "default_cpan_build ($@)"
   prepare_install
   verbose_msg "running \"default_cpan_build\""
@@ -236,9 +245,7 @@
         o conf keep_source_where $SOURCE_DIRECTORY
 	install $CPAN_MODULE
 	quit" | /usr/bin/cpan || exit 1
-  RESULT=$?
   rm_source_dir $SOURCE_DIRECTORY
-
 } > $C_FIFO 2>&1
 
 
@@ -249,59 +256,39 @@
     message "${PROBLEM_COLOR}WARNING: ${DEFAULT_COLOR}${FILE_COLOR}BUILD${DEFAULT_COLOR}${PROBLEM_COLOR} does not call prepare_install or installs zero files!${DEFAULT_COLOR}"
   fi
 
-  invoke_installwatch
-
-  {
-    gather_docs
-
-    install_pam_confs
-    install_services
-    install_xinetd_confs
-    install_bashmisc
-  } | tee -a $C_LOG
-  
-  install_initd
   update_plugin $MODULE install
 
-  devoke_installwatch
+  plugin_call BUILD_POST_BUILD $MODULE
+  if [ $? != 2 ]; then
+    message "${PROBLEM_COLOR}ERROR: problems running POST_BUILD plugins!${PROBLEM_COLOR}"
+    return 1
+  fi
+
   ldconfig
   release_saved_libraries
-  cd  /
+  cd /
 }
 
 
 syms_not_owned()  {
+  local DEST
   debug_msg "syms_not_owned ($@)"
-
-  cat  $1  |
   while read ITEM ; do
-
-    if  [  -h  "$ITEM"  ]   &&
-        [  -f  "$ITEM"  ];  then
-
-      DEST=$(  basename  $(  ls   -la  "$ITEM"  |
-                             cut  -d  '>'  -f2  |
-                             cut  -c  2-
-                          )
-            )
-
-      if  !  grep  -q  "$DEST"  "$1"
-      then   echo  -n  "$ITEM\|"
-             echo      "$ITEM"  >>  $TMPDIR/$MODULE.rejected.symlinks
+    if [ -h "$ITEM" ] && [ -f "$ITEM" ]; then
+      DEST=$(basename $(ls -la "$ITEM" | cut -d '>' -f2 | cut -c 2- ) )
+      if ! grep -q "$DEST" "$1" ; then
+	    echo -n "$ITEM\|"
+        echo "$ITEM" >> $TMPDIR/$MODULE.rejected.symlinks
       fi
-
     fi
-
-  done
-
+  done < $1
 }
 
 
 prepare_module_config()  {
   debug_msg "prepare_module_config ($@)"
-  if [ ! -x "$MODULE_CONFIG" ] ; then
-    touch $MODULE_CONFIG
-    chmod a+x $MODULE_CONFIG
+  if [ ! -e "$MODULE_CONFIG" ] ; then
+    > $MODULE_CONFIG
   fi
 }
 
@@ -316,12 +303,6 @@
   fi
 
   prepare_module_config
-
-  if ! use_xinetd ; then
-    if [ -n "$RECONFIGURE" ] || ! grep -q INITDSCRIPTS $MODULE_CONFIG ; then
-      use_initd
-    fi
-  fi
   grep -q "^"$MODULE"\$" $TEMP_PREPAREDDEPS 2>/dev/null && return 0
 
   # add custom passed OPTS before retreiving them
@@ -329,6 +310,7 @@
     OPTS="$(get_module_config OPTS) $PASS_OPTS"
     set_module_config OPTS "$OPTS"
   fi
+  plugin_call BUILD_CONFIGURE $MODULE
   run_module_file $MODULE CONFIGURE
 }
 
@@ -340,6 +322,7 @@
   cd $BUILD_DIRECTORY
 
   if verify_all_sources $MODULE ; then
+    plugin_call BUILD_PRE_BUILD $MODULE
     if [ -s $SCRIPT_DIRECTORY/PRE_BUILD ] ; then
       run_module_file $MODULE PRE_BUILD
     else
@@ -361,6 +344,7 @@
 
   verbose_msg "building \"$MODULE\" version \"$VERSION\" in `pwd`"
   
+  plugin_call BUILD_BUILD $MODULE
   if [ -s $SCRIPT_DIRECTORY/BUILD ] ; then
     run_module_file $MODULE BUILD
   else
@@ -381,16 +365,7 @@
 
 run_post_install() {
   debug_msg "run_post_install ($@)"
-  # keep a record of the module scripts used for every install
-  (
-    if [ ! -e /var/state/lunar/module_history ]; then
-      mkdir /var/state/lunar/module_history
-    fi
-    SCRIPT_DATE=$(date -u +%Y%m%d)                      &&
-    MH_NAME=$MODULE-$VERSION-$SCRIPT_DATE.tar.bz2  &&
-    cd $MOONBASE/$SECTION                               &&
-    tar -cjf /var/state/lunar/module_history/$MH_NAME $MODULE
-  )
+  plugin_call BUILD_POST_INSTALL $MODULE
   if [ -s $SCRIPT_DIRECTORY/POST_INSTALL ] ; then
     run_module_file $MODULE POST_INSTALL
   fi

Modified: lunar/branches/stable/var/lib/lunar/functions/check.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/check.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/check.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -23,12 +23,14 @@
 
 # rework_module : check depends database for a module
 rework_module() {
+  local MODULE
   debug_msg "rework_module ($@)"
                                                                                 
   # we declare these local to override the systems default ones:
   optional_depends()  {
+    local DEP
     debug_msg "  optional_depends ($@)"
-    DEP=$(unalias $1)
+    DEP=$(NEVER_ASK=1 DEPS_ONLY= unalias $1)
     if module_exiled $DEP ; then
       echo "$MODULE:$DEP:off:optional:$2:$3"
     else
@@ -41,8 +43,9 @@
   }
                                                                                 
   depends()  {
+    local DEP
     debug_msg "  depends ($@)"
-    DEP=$(unalias $1)
+    DEP=$(NEVER_ASK=1 DEPS_ONLY= unalias $1)
     if ! module_installed $DEP && ! module_held $DEP ; then
       if ! is_depends $DEP && module_exiled $DEP ; then
         return  1
@@ -59,7 +62,7 @@
    (
     if run_details $1 &> /dev/null ; then
       if [ -s "$SCRIPT_DIRECTORY/DEPENDS" ] ; then
-      run_module_file $MODULE DEPENDS
+      run_module_file $MODULE DEPENDS | grep -v '%'
       fi
     fi
    ) 
@@ -73,15 +76,16 @@
   lock_file $DEPENDS_STATUS_BACKUP                              &&
   lock_file $DEPENDS_STATUS                                     &&
   grep -v "^$MODULE:" $DEPENDS_STATUS_BACKUP > $DEPENDS_STATUS  &&
-  run_depends $MODULE >> $DEPENDS_STATUS                        &&
-  cat $DEPENDS_STATUS > $DEPENDS_STATUS_BACKUP                  &&
-  unlock_file $DEPENDS_STATUS                                   &&
+  run_depends $MODULE >> $DEPENDS_STATUS
+  cat $DEPENDS_STATUS > $DEPENDS_STATUS_BACKUP
+  unlock_file $DEPENDS_STATUS
   unlock_file $DEPENDS_STATUS_BACKUP
 }
 
 
 # fix_depends : single pass to fix depends database
 fix_depends () {
+  local LIST
   debug_msg "fix_depends  ($@)"
   
   if [ -n "$1" ] ; then
@@ -97,6 +101,7 @@
                                                                                 
 
 run_fix()  {
+  local MODULES MODULE
   debug_msg "run_fix ($@)"
   MODULES=$*
 
@@ -121,13 +126,16 @@
           if [ -n "$NOFIX" ] ; then
             continue
           fi
-          satisfy_depends      &&
-          FIX= satisfy_depends &&
+          NEVER_ASK=1 DEPS_ONLY= satisfy_depends      &&
+          NEVER_ASK=1 DEPS_ONLY= FIX= satisfy_depends &&
 
           if ! run_checks $MODULE ; then
+		    verbose_msg "Attempting to recompile \"$MODULE\""
             if ! FIX= lin --compile $MODULE ; then
+		      verbose_msg "Attempt to recompile \"$MODULE\" FAILED"
               continue
             elif ! run_checks $MODULE ; then
+		      verbose_msg "Attempt to recompile \"$MODULE\" succeeded but \"$MODULE\" still is broken!"
 			  continue
             fi
           fi
@@ -137,3 +145,4 @@
   done
 }
 
+

Modified: lunar/branches/stable/var/lib/lunar/functions/config.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/config.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/config.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -20,6 +20,7 @@
 
 
 set_config() {
+  local LINE NEW
   debug_msg "set_config ($@)"
 
   LINE=$(cat $1 | grep -w "$2=.*")

Modified: lunar/branches/stable/var/lib/lunar/functions/connect.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/connect.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/connect.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -34,6 +34,7 @@
 
 
 connect()  {
+  local TIMEOUT
   debug_msg "connect ($@)"
 
   if ! ifconfig | grep -q "^eth[0-9]\|^wlan[0-9]\|^ppp[0-9]\|^ath[0-9]\|^tun[0-9]\|ra[0-9]"

Modified: lunar/branches/stable/var/lib/lunar/functions/depends.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/depends.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/depends.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -25,9 +25,11 @@
 # usage    : find_depends "module name"
 # purpose  : recursive dependency finder, no need to be installed
 function find_depends() {
+  local TMP_FDEPS
   debug_msg "find_depends ($@)"
 
   find_depends_intern() {
+    local DEP STATE LINE
     grep "^$1:" $DEPENDS_CACHE | while read LINE ; do
       DEP=$(echo $LINE | cut -d: -f2)
       DEP=$(unalias $DEP)
@@ -57,6 +59,7 @@
 # usage    : LIST=$(sort_by_dependency $LIST)
 # purpose  : return a LIST sorted by dependency
 sort_by_dependency() {
+  local TMP_LIST TMP_ALL TMP_TSRT A B
   debug_msg "sort_by_dependency ($@)"
 
   TMP_LIST=$(temp_create "deptree.in")
@@ -155,6 +158,7 @@
   debug_msg "run_depends ($@)"
   # local definitions of depends and optional_depends!
   depends() {
+    local DEP
     debug_msg "  depends ($@)"
     DEP=$(unalias $1)
     if grep -q "^$DEP\$" $TEMP_PREPAREDDEPS 2>/dev/null ; then
@@ -181,6 +185,7 @@
                                                                                 
   optional_depends()  {
   debug_msg "  optional_depends ($@)"
+    local DEP DEFAULT DEPMOD_AVAIL
     # parameters:  $1 = module name
     #              $2 = configure parameter if module wanted
     #              $3 = configure parameter if module declined
@@ -240,11 +245,13 @@
 # NOTE: this is where a missing dependency gets installed! IOW we really do
 # "satisfy" any dependencies here!
 satisfy_depends()  {
+  local TMP_FILE DEP_MODULE DEP_STATUS DEP_ON DEP_OFF LINE
   debug_msg "satisfy_depends ($@)"
   if [ -n "$DEPS_ONLY" ] ; then 
     return 0
   fi
   
+  # make sure we start with clean OPTS here:
   unset OPTS
 
   if [ -s "$MODULE_CONFIG" ] ; then
@@ -255,7 +262,7 @@
   grep "^$MODULE:" $DEPENDS_STATUS > $TMP_FILE
 
   # first recursively check if all required dependencies are installed
-  for DEP_MODULE in $(find_depends $MODULE) ; do
+  for DEP_MODULE in $(find_depends $MODULE | grep -v '%') ; do
     if [ $DEP_MODULE != $MODULE ]; then
       if ! module_installed $DEP_MODULE ; then
         if ! SINGLE_MODULE=1 lin $SILENT $COMPILE $DEP_MODULE ; then
@@ -296,6 +303,7 @@
 
 # conflicts... remove conflicting modules
 conflicts() {
+  local DEP
   debug_msg "conflicts ($@)"
   DEP=$1
   if module_installed $DEP ; then
@@ -354,7 +362,9 @@
 }
 
 
-create_depends_cache() {
+create_depends_cache()
+{(
+  local TMP_DEP_CACHE DEPFILES DEPFILE MODULE
   debug_msg "create_depends_cache($@)"
 
   if [ ! -w $DEPENDS_CACHE -a -e $DEPENDS_CACHE ] ; then
@@ -398,11 +408,12 @@
   else
     verbose_msg "Skipping depends cache regeneration"
   fi
-}
+)}
 
 
 # list all installed modules depending on $1
 list_installed_depending() {
+  local SUBDEP
   debug_msg "list_installed_depending($2)"
   for SUBDEP in $(grep ":$1:" $DEPENDS_CACHE | cut -d: -f1) ; do
     if $(module_installed $SUBDEP ) ; then
@@ -411,3 +422,5 @@
     fi
   done
 }
+
+

Modified: lunar/branches/stable/var/lib/lunar/functions/download.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/download.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/download.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -34,6 +34,7 @@
 
 
 download_url() {
+    local RETVAL
 	debug_msg "download_url($@)"
 	verbose_msg "trying to download \"$URL\""
 	connect &&
@@ -49,6 +50,7 @@
 
 download_module() {
 (
+	local MAX_SOURCES SRC ALL_URLS URLS URL MLIST ALT REST HIT
 	debug_msg "download_module ($@)"
 	if ! run_details $1 ; then
 		exit 1
@@ -137,6 +139,7 @@
 
 
 testpack () {
+	local FILENAME
 	debug_msg "testpack ($@)"
 	if [ -f "$1" ]; then
 		FILENAME=$1
@@ -144,8 +147,7 @@
 		FILENAME=$SOURCE_CACHE/$1
 	fi
 	if [ -f "$FILENAME" ] ; then
-		COMPRESSOR=$(file -b $FILENAME | cut -d ' ' -f1)
-		case $COMPRESSOR in
+		case $(file -b $FILENAME | cut -d ' ' -f1) in
 			bzip2)
 				bzip2 -tf $FILENAME > /dev/null 2>&1
 				;;
@@ -171,6 +173,7 @@
 
 show_downloading()
 {
+	local DOWNLOAD_PID DOWNLOAD_LOG
 	debug_msg "show_downloading ($@)"
 	DOWNLOAD_PID=$(grep ^$MODULE: $TEMP_DOWNLOAD_PIDS | cut -d: -f2)
 	if [ -n "$DOWNLOAD_PID" ]; then

Modified: lunar/branches/stable/var/lib/lunar/functions/edit.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/edit.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/edit.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -16,6 +16,7 @@
 # purpose  : calls "patch -px < $filename", where filename may be a variety
 #            of formats
 patch_it () { 
+  local PATCH TARCMD GZCMD TMPFILE1 TMPFILE2
   verbose_msg "patch_it \"$1\" \"$2\"";
 
   # get patch from $SOURCE_CACHE automatically
@@ -66,7 +67,8 @@
 # function : sedit
 # usage    : sedit sed-statement file [file [file] ...]
 # purpose  : edit [files] with a sed function
-sedit () { 
+sedit () {
+  local SEDIT
   debug_msg "sedit ($@)"
   SEDIT=$1
   shift
@@ -82,7 +84,7 @@
 # purpose  : to edit a file
 edit_file() {
   debug_msg "edit_file ($@)"
-  ${EDITOR:-nano}  $1
+  ${EDITOR:-nano} $1
 }
 
 

Modified: lunar/branches/stable/var/lib/lunar/functions/kernel.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/kernel.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/kernel.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -44,15 +44,3 @@
 }
 
 
-# dummy caller:
-update_lilo() {
-	update_bootloader $1 $2
-}
-
-# dummy stub:
-update_grub() {
-	:
-}
-
-
-

Modified: lunar/branches/stable/var/lib/lunar/functions/locking.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/locking.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/locking.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -20,6 +20,7 @@
 # usage   : lock_file <absolute file name>
 # purpose : locks a file or wait until. Better use as lock_file <file> && || etc
 function lock_file() {
+   local TEMPFILE LOCKFILE STALE_PID
    debug_msg "lock_file ($@)"
    function file_lock() {
       #locking is disabled if ln or rm not found!!

Modified: lunar/branches/stable/var/lib/lunar/functions/logging.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/logging.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/logging.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -51,16 +51,8 @@
 
 activity_log()  {
   debug_msg "activity_log ($@)"
-
-    DATE=`date  -u  +%Y%m%d-%T`
-  COMMAND=$1
-   MODULE=$2
-  VERSION=$3
-  OUTCOME=$4
-     INFO=$5
-
   lock_file $ACTIVITY_LOG &&
-  echo "$DATE	$COMMAND	$MODULE	$VERSION	$OUTCOME	$INFO"  >> $ACTIVITY_LOG &&
+  echo -e "$(date -u +%Y%m%d-%T)\t$1\t$2\t$3\t$4\t$5" >> $ACTIVITY_LOG
   unlock_file $ACTIVITY_LOG
 }
 

Modified: lunar/branches/stable/var/lib/lunar/functions/main.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/main.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/main.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -84,6 +84,7 @@
 
 
 rebuild()  {
+  local LIST QUEUE TMP_QUEUE
   debug_msg "rebuild ($@)"
 
   message  "${MESSAGE_COLOR}Starting non-recursive rebuild${DEFAULT_COLOR}"

Modified: lunar/branches/stable/var/lib/lunar/functions/messages.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/messages.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/messages.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -51,11 +51,11 @@
 
 
 debug_msg() {
+  local PLUSSES
   if [ -n "$LUNAR_DEBUG" ] ; then
     if [ "$LUNAR_DEBUG" -ge "2" ] ; then
 	  PLUSSES="+++++++++++++++++++++++++*"
 	  echo -n "${PLUSSES:0:${#FUNCNAME[@]}} " >&2
-	  unset PLUSSES
 	fi
     if [ "$LUNAR_DEBUG" -ge "4" ] ; then
       echo -n "$(basename $0)[$$]: " >&2
@@ -91,6 +91,7 @@
 # usage : xterm_msg MESSAGE
 # purpose : To display a short message in the title bar of a X terminal
 xterm_msg() {
+  local MSG
   debug_msg "xterm_bar ($@)"
   case $TERM in
     xterm*|gnome*|konsole*|rxvt*)
@@ -102,6 +103,7 @@
 
 # function : report FILE [description] MODULE VERSION
 report() {
+  local TMP_MAIL
   debug_msg "report ($@)"
   if [ ! -f "$1" ] ; then
     return
@@ -129,6 +131,7 @@
 
 
 query() {
+  local RESPONSE
   debug_msg "query ($@)"
   # 2 arguments
   # query "what do you want?  "  DEFAULT
@@ -204,15 +207,14 @@
 }
 
 
-sound()  {
+sound()
+{
   debug_msg "sound ($@)"
-  case  $SOUND  in
-    on)  SOUND_FILE=$SOUND_DIRECTORY/$SOUND_THEME/$1
-         if  [  -e "$SOUND_FILE" ] ; then
-           (  cd  /  ;  play  $SOUND_FILE  & )
-         fi
-    ;;
-  esac
+  if [ "$SOUND" == "on" ]; then
+    if [ -f "$SOUND_DIRECTORY/$SOUND_THEME/$1" ]; then
+	  ( cd / ; play "$SOUND_DIRECTORY/$SOUND_THEME/$1" & )
+	fi
+  fi
 }
 
 

Modified: lunar/branches/stable/var/lib/lunar/functions/misc.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/misc.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/misc.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -30,6 +30,7 @@
 # usage    : VARIABLE=`directories < dirlistfile`
 # purpose  : to determine the directories from a given list
 directories() {
+  local ITEM
   debug_msg "directories ($@)"
   while read ITEM ; do
     if [ -d "$ITEM" ] && [ ! -h "$ITEM" ] ; then
@@ -43,6 +44,7 @@
 # usage    : VARIABLE=`files < dirlistfile`
 # purpose  : to determine the ordinary files from a given list
 files() {
+  local ITEM
   debug_msg "files ($@)"
   while read ITEM ; do
     if [ -f "$ITEM" ] && [ ! -h "$ITEM" ] ; then
@@ -56,6 +58,7 @@
 # usage    : VARIABLE=`symlinks < dirlistfile`
 # purpose  : to determine the symbolic links from a given list
 symlinks() {
+  local ITEM
   debug_msg "symlinks ($@)"
   while read ITEM ; do
     if [ -h "$ITEM" ] ; then
@@ -69,6 +72,7 @@
 # usage    : VARIABLE=`dirnames < dirlistfile`
 # purpose  : info about the real locations of symlinks
 dirnames() {
+  local FILE
   debug_msg "dirnames ($@)"
   while read FILE ; do
     dirname "$FILE"
@@ -80,6 +84,7 @@
 # usage    : VARIABLE=`exists < dirlistfile`
 # purpose  : filter out the non-existent files in a list
 exists() {
+  local ITEM
   debug_msg "exists ($@)"
   while read ITEM ; do
     if [ -e "$ITEM" ] ; then
@@ -93,10 +98,11 @@
 # usage    : filter $FILE
 # purpose  : filter stdin with files/dirs/symlinks provided in file $1.
 filter() {
+  local TMP_GREPRE
   debug_msg "filter ($@)"
   if [ -f "$1" ] ; then
     TMP_GREPRE=$(temp_create "fgrep")
-    directories < $1 | sed -e 's:^:^:g' -e 's:$:/:g'   >> $TMP_GREPRE
+    directories < $1 | sed -e 's:^:^:g' -e 's:$:/:g'   > $TMP_GREPRE
     files       < $1 | sed -e 's:^:^:g' -e 's:$:\$:g' >> $TMP_GREPRE
     symlinks    < $1 | sed -e 's:^:^:g' -e 's:$:\$:g' >> $TMP_GREPRE
     read

Modified: lunar/branches/stable/var/lib/lunar/functions/modules.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/modules.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/modules.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -59,6 +59,7 @@
 # usage    : list_moonbase
 # purpose  : returns the names of all modules in moonbase
 list_moonbase() {
+  local SECTION
   debug_msg "list_moonbase ($@)"
   for SECTION in $(list_sections) ; do
     list_modules $SECTION
@@ -79,6 +80,7 @@
 # usage   : create_module_index
 # purpose : created an index file of module:section pair list
 create_module_index() {
+  local TMP_INDEX
   debug_msg "create_module_index ($@)"
   # make sure it exists before trying to see it's writeable
   # this also assures that depends.cache gets remade
@@ -150,6 +152,7 @@
 # purpose  : finds the section of a given module as parameter
 # returns  : (0) on success, (1) on failure, errors on stdout
 find_section() {
+  local SECTION SECTIONS
   debug_msg "find_section ($@)"
 
   ZLOCAL_OVERRIDES=${ZLOCAL_OVERRIDES:=off}
@@ -202,6 +205,7 @@
 # purpose  : runs the DETAILS file of a module
 # returns  : (0) on success, (1) on failure, error messages on stdout
 run_details() {
+  local TMP_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 
@@ -313,6 +317,7 @@
 # usage    : hold_modules $MODULE [$MODULE....]
 # purpose  : put modules on hold
 hold_modules() {
+  local MODULE
   debug_msg "hold_modules ($@)"
   if [ -n "$1" ] ; then
     lock_file $MODULE_STATUS_BACKUP &&
@@ -321,8 +326,8 @@
       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 &&
+    done
+    unlock_file $MODULE_STATUS
     unlock_file $MODULE_STATUS_BACKUP
   fi
 }
@@ -332,6 +337,7 @@
 # usage    : unhold_modules $MODULE [$MODULE....]
 # purpose  : put modules on hold back to normal
 unhold_modules () {
+  local MODULE
   debug_msg "unhold_modules  ($@)"
   if [ -n "$1" ] ; then
     lock_file $MODULE_STATUS_BACKUP &&
@@ -340,8 +346,8 @@
       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 &&
+    done
+    unlock_file $MODULE_STATUS
     unlock_file $MODULE_STATUS_BACKUP
   fi
 }
@@ -351,6 +357,7 @@
 # usage    : exile_modules $MODULE [$MODULE....]
 # purpose  : put modules on exile
 exile_modules() {
+  local MODULE
   debug_msg "exile_modules ($@)"
   if [ -n "$1" ] ; then
     lock_file $MODULE_STATUS_BACKUP &&
@@ -363,8 +370,8 @@
         echo "$MODULE::exiled:0.0" >> $MODULE_STATUS_BACKUP
       fi
       cp $MODULE_STATUS_BACKUP $MODULE_STATUS
-    done &&
-    unlock_file $MODULE_STATUS &&
+    done
+    unlock_file $MODULE_STATUS
     unlock_file $MODULE_STATUS_BACKUP
   fi
 }
@@ -374,6 +381,7 @@
 # usage    : unexile_modules $MODULE [$MODULE....]
 # purpose  : put modules on exile back to normal
 unexile_modules () {
+  local MODULE
   debug_msg "unexile_modules  ($@)"
   if [ -n "$1" ] ; then
     lock_file $MODULE_STATUS_BACKUP &&
@@ -382,8 +390,8 @@
       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 &&
+    done
+    unlock_file $MODULE_STATUS
     unlock_file $MODULE_STATUS_BACKUP
   fi
 }
@@ -405,16 +413,16 @@
   lock_file $MODULE_STATUS                                     && 
   grep  -v  "^$1:" $MODULE_STATUS_BACKUP  >  $MODULE_STATUS 2>/dev/null
   cat $MODULE_STATUS >  $MODULE_STATUS_BACKUP               2>/dev/null
-  unlock_file $MODULE_STATUS                                   &&
-  unlock_file $MODULE_STATUS_BACKUP                            &&
+  unlock_file $MODULE_STATUS
+  unlock_file $MODULE_STATUS_BACKUP
 
   if [ -n "$EXILE" ] ; then
      exile_modules "$1"                                  &&
      lock_file $DEPENDS_STATUS_BACKUP                    &&
      lock_file $DEPENDS_STATUS                           &&
      grep  -v  ":$1:" $DEPENDS_STATUS_BACKUP  >   $DEPENDS_STATUS  &&
-     cat $DEPENDS_STATUS >  $DEPENDS_STATUS_BACKUP       &&
-     unlock_file $DEPENDS_STATUS                         &&
+     cat $DEPENDS_STATUS >  $DEPENDS_STATUS_BACKUP
+     unlock_file $DEPENDS_STATUS
      unlock_file $DEPENDS_STATUS_BACKUP
   fi
 }
@@ -436,8 +444,8 @@
   lock_file $MODULE_STATUS                                    &&
   grep -v "^$1:" $MODULE_STATUS_BACKUP > $MODULE_STATUS 2>/dev/null &&
   echo "$1:$(date -u +%Y%m%d):$2:$3:$4" >> $MODULE_STATUS     &&
-  cp $MODULE_STATUS $MODULE_STATUS_BACKUP                     &&
-  unlock_file $MODULE_STATUS                                  &&
+  cp $MODULE_STATUS $MODULE_STATUS_BACKUP
+  unlock_file $MODULE_STATUS
   unlock_file $MODULE_STATUS_BACKUP
 }
 
@@ -446,6 +454,7 @@
 # usage    : purge_modules
 # purpose  : purge modules that were removed from moonbase
 purge_modules() {
+  local MODULE
   debug_msg "purge_modules ($@)"
   verbose_msg "Discovering modules that were removed from moonbase"
   for MODULE in $(list_installed | grep -v "^moonbase$") ; do
@@ -492,6 +501,7 @@
 # usage    : list_expired_modules
 # purpose  : return a list of modules that need to be updated
 list_expired_modules() {
+  local MODULE
   debug_msg "list_expired_modules ($@)"
   for MODULE in $(list_installed) ; do
     if $(module_is_expired $MODULE) ; then
@@ -505,6 +515,7 @@
 # usage    : update_modules
 # purpose  : update all installed modules that need to be updated
 update_modules() {
+  local IFS LIST QUEUE MODULE
   debug_msg "update_modules ($@)"
 
   export IFS="$STANDARD_IFS"
@@ -540,31 +551,7 @@
 }
 
 
-find_pam_aware()  {
-  debug_msg "find_pam_aware ($@)"
 
-  cat  $MODULE_STATUS_BACKUP  |
-  while  read  LINE;  do
-                        
-    MODULE="`echo  $LINE  |  cut  -d  :  -f1`"
-    STATUS="`echo  $LINE  |  cut  -d  :  -f3`"
-                                              
-    if  [  "$STATUS"  ==  "installed"  ]   ||
-        [  "$STATUS"  ==  "held"       ];  then
-
-      SECTION=`find_section  $MODULE`
-                                    
-      if    [  -d  "$MOONBASE/$SECTION/$MODULE/pam.d"  ]  &&
-            [  "$MODULE"  !=  "Linux-PAM"              ]
-      then  echo  $MODULE
-      fi
-
-    fi
-  done
-
-}
-
-
 check_blacklist() {
   debug_msg "check_blacklist ($@)"
   # Copyrighted Jason Johnston  2002 under GPLv2
@@ -587,8 +574,7 @@
   # Usage check_checklist $MODULES
   PLATFORM=${PLATFORM:-x86}
   if [ -f /var/state/lunar/blacklist.$PLATFORM ] ; then
-    BLKLST=$(grep ^$MODULE$ /var/state/lunar/blacklist.$PLATFORM)
-    if [ "$BLKLST" == "$MODULE" ] ; then
+    if grep "^$MODULE$" /var/state/lunar/blacklist.$PLATFORM ; 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

Modified: lunar/branches/stable/var/lib/lunar/functions/optimize.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/optimize.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/optimize.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -631,6 +631,7 @@
 
 # Set up the Linker optimizations
 optimize_ld() {
+  local WL
   debug_msg "optimize_ld ($@)"
   if [[ $LDFLAGS ]]; then
     unset LDFLAGS

Modified: lunar/branches/stable/var/lib/lunar/functions/plugins.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/plugins.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/plugins.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -23,12 +23,18 @@
 	# first arg: plugin type
 	# second arg: function hook name
 	# Defined plugin types:
-	# 1 - SOURCE_DOWNLOAD - download some source code
-	# 2 - SOURCE_NEEDREFRESH - source exists but needs refresh
-    # 3 - SOURCE_VERIFY - perform intergity verification on a file
-	# 4 - SOURCE_UNPACK - unpack a certain file to $(PWD)
-	# 5 - MODULE_CHECK - perform integrity checking on installed modules
-	# 6 - KERNEL_UPDATEBOOTLOADER - automate bootloader maintenance
+	#  1 - SOURCE_DOWNLOAD         download some source code
+	#  2 - SOURCE_NEEDREFRESH      source exists but needs refresh
+    #  3 - SOURCE_VERIFY           perform intergity verification on a file
+	#  4 - SOURCE_UNPACK           unpack a certain file to $(PWD)
+	#  5 - MODULE_CHECK            integrity checking on installed modules
+	#  6 - KERNEL_UPDATEBOOTLOADER automate bootloader maintenance
+	#  7 - BUILD_CONFIGURE         called before running CONFIGURE
+	#  8 - BUILD_PRE_BUILD           ,,     ,,     ,,    PRE_BUILD 
+	#  9 - BUILD_BUILD               ,,     ,,     ,,    BUILD
+	# 10 - BUILD_INSTALL             ,,     ,,     ,,    INSTALL
+	# 11 - BUILD_POST_BUILD          ,,     ,,     ,,    POST_BUILD
+	# 12 - BUILD_POST_INSTALL        ,,     ,,     ,,    POST_INSTALL
 	LUNAR_PLUGINS=(${LUNAR_PLUGINS[@]} "$1:$2")
 	((LUNAR_PLUGIN_COUNT++))
 	debug_msg "Registered plugin #$LUNAR_PLUGIN_COUNT, $1 -> $2()"
@@ -36,6 +42,7 @@
 
 
 plugin_call() {
+    local REQUESTED_TYPE COUNT THIS_TYPE THIS_HANDLER RETVAL
 	debug_msg "plugin_call($@)"
 	# scan available plugins for plugin_type $1 and pass args to it
 	REQUESTED_TYPE=$1
@@ -50,16 +57,18 @@
 			if [ $RETVAL -eq 2 ]; then
 				continue
 			else
+				debug_msg "plugin $THIS_HANDLER returned \"$RETVAL\""
 				return $RETVAL
 			fi
 		fi
 	done
-	debug_msg "Finished running all plugins for type \"$1\""
+	debug_msg "Finished running all plugins for type \"$REQUESTED_TYPE\""
 	return 2
 }
 
 
 update_plugin() {
+	local SECTION PLUGIN
 	debug_msg "update_plugin($@)"
 	# update plugins of all modules or a specific one
 	#
@@ -91,6 +100,7 @@
 
 
 update_plugins() {
+	local MODULE
 	debug_msg "update_plugins($@)"
 	# rework all plugins	
 	verbose_msg "Updating plugins"

Deleted: lunar/branches/stable/var/lib/lunar/functions/postbuild.lunar

Modified: lunar/branches/stable/var/lib/lunar/functions/prune.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/prune.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/prune.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -13,6 +13,7 @@
 # usage    : prune
 # purpose  : prune all old logs, source copy's, install caches
 prune() {
+  local TMP_SPOOL_KEEP TMP_CACHE_KEEP MODULE SOURCE VERSION FILE LOGS
   debug_msg "prune ($@)"
 
   if [ -z "$BUILD" ] ; then

Modified: lunar/branches/stable/var/lib/lunar/functions/sizes.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/sizes.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/sizes.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -20,9 +20,11 @@
 # usage   : find_module_size <module> |version|
 # purpose : finds the installed size of module in KB
 find_module_size() {
+   local VERSION LINE SIZE0 SIZE
    #this functions checks the modules file if there is already size entry
    module_size()
    {
+      local SIZE
       unset SIZE
       [ -e "$MODULE_STATUS" ] &&
       SIZE=`grep  "^$1\:" $MODULE_STATUS | cut -d ":" -f 5-5`

Modified: lunar/branches/stable/var/lib/lunar/functions/sources.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/sources.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/sources.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -20,6 +20,7 @@
 
 
 verify_source() {
+  local VERIFIED SOURCE_FILE
   debug_msg "verify_source ($@)"
   VERIFIED="true"
   for SOURCE_FILE in $@ ; do
@@ -76,6 +77,7 @@
 
 
 unpack() {
+  local FILENAME
   debug_msg "unpack ($@)"
 
   FILENAME=$SOURCE_CACHE/$1
@@ -159,6 +161,7 @@
 
 
 rm_source_dir() {
+  local DEAD_DIR
   debug_msg "rm_source_dir ($@)"
 
   if [ "$KEEP_SOURCE" == "on" ] ; then
@@ -180,6 +183,7 @@
 
 
 mk_source_dir() {
+  local NEW_DIR
   debug_msg "mk_source_dir ($@)"
 
   # yes this sounds weird but it might happen: no dir $BUILD_DIRECTORY on

Modified: lunar/branches/stable/var/lib/lunar/functions/temp.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/temp.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/temp.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -18,6 +18,7 @@
 
 
 temp_create() {
+  local TMPFILE
   debug_msg "temp_create ($@)"
   TMPFILE=$MODULE
   if TMPFILE=$(mktemp -p "$TMPDIR" -t lunar.`basename $0`.$$.$TMPFILE.XXXXXXXXXX ) ; then

Modified: lunar/branches/stable/var/lib/lunar/functions/tracking.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/tracking.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/tracking.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -49,6 +49,7 @@
 # usage    : parse_iw
 # purpose  : remove unwanted accesses from the installwatch file
 parse_iw() {
+  local OMIT_IN
   debug_msg "parse_iw ($@)"
   OMIT_IN="	rename\|	symlink\|	unlink"
 
@@ -61,7 +62,7 @@
 # usage    : create_install_log
 # purpose  : create an install log
 create_install_log() {
-
+  local TMP_INST_LOG INST_LOG IFS MISOWNED_SYMLINKS
   debug_msg "create_install_log ($@)"
 
   TMP_INST_LOG=$(temp_create "install-log")
@@ -91,6 +92,7 @@
 
 
 create_md5sum_log()  {
+  local FILE
   debug_msg "create_md5sum_log ($@)"
 
   rm -f $MD5SUM_LOGS/$MODULE-$VERSION &> /dev/null

Modified: lunar/branches/stable/var/lib/lunar/functions/uniqid.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/uniqid.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/uniqid.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -22,6 +22,7 @@
 
 
 create_uniq_id() {
+  local OS HASH IFACE
   debug_msg "create_uniq_id ($@)"
   if [ -n "$UNIQID" ]; then 
     return

Modified: lunar/branches/stable/var/lib/lunar/functions/updatelog.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/updatelog.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/updatelog.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -34,6 +34,7 @@
 # usage    : display_success_info update|rebuild
 # purpose  : display a list of update successes and failures
 display_success_info() {
+  local NUMSUCCESS NUMFAILURES
   debug_msg "display_success_info ($@)"
 
   NUMSUCCESS=$(cat $TMP_LIN_SUCCESS | wc -l)
@@ -62,37 +63,56 @@
 # function : display_moonbase_changes
 # usage    : display_moonbase_changes
 # purpose  : display a list of modules added or removed during this update
-display_moonbase_changes()  {  
+display_moonbase_changes()  {
+  local MODULE_CHANGES NEW_MODULES DEL_MODULES MOV_MODULES M
   debug_msg "display_moonbase_changes ($@)"
-  MODULE_CHANGES=$(temp_create "module-changes")
 
   if [ -e "$MODULE_INDEX" ] && [ -e "$TMP_MODULE_INDEX" ]; then
-    diff -y $MODULE_INDEX $TMP_MODULE_INDEX | sort > $MODULE_CHANGES
+    MODULE_CHANGES=$(temp_create "module-changes")
+    diff -U0 $TMP_MODULE_INDEX $MODULE_INDEX | grep -v -e '^@@' -e '^---' -e '^+++' > $MODULE_CHANGES
 
-    NEW_MODULES=$(grep '<' $MODULE_CHANGES | wc -l)
-    DEL_MODULES=$(grep '>' $MODULE_CHANGES | wc -l)
-    MOV_MODULES=$(grep '|' $MODULE_CHANGES | wc -l)
-    message
+    MODULES=$(cat $MODULE_CHANGES | cut -d: -f1 | sed 's:^[+-]::' | sort -t : | uniq)
+	for M in $MODULES; do
+	  IN=$(grep "^-$M:" $MODULE_CHANGES)
+	  OUT=$(grep "^+$M:" $MODULE_CHANGES)
+	  if [ -z "$IN" -a -n "$OUT" ] ; then
+	    # new module:
+		NEW_MODULES="$NEW_MODULES $M"
+	  elif [ -n "$IN" -a -z "$OUT" ] ; then
+	    # removed module:
+		DEL_MODULES="$DEL_MODULES $M"
+	  else
+	    # moved module
+		MOV_MODULES="$MOV_MODULES $M"
+	  fi
+	done
 
-    if [ "$NEW_MODULES" != "0" ]; then
+    if [ -n "$NEW_MODULES" ]; then
       message "${MESSAGE_COLOR}New modules:${DEFAULT_COLOR}"
-      grep '<' $MODULE_CHANGES | tr -d '<' | sort -t : -k 2
+	  for M in $NEW_MODULES; do
+	   message "  $M"
+	  done
       message
     fi
 
-    if [ "$DEL_MODULES" != "0" ]; then
+    if [ -n "$DEL_MODULES" ]; then
       message "${MESSAGE_COLOR}Removed modules:${DEFAULT_COLOR}"
-      grep '>' $MODULE_CHANGES | tr -d '>\t ' | sort -t : -k 2
+	  for M in $DEL_MODULES; do
+	    message "  $M"
+	  done
       message
     fi
 
-    if [ "$MOV_MODULES" != "0" ]; then
+    if [ -n "$MOV_MODULES" ]; then
       message "${MESSAGE_COLOR}Moved modules:${DEFAULT_COLOR}"
-      grep '|' $MODULE_CHANGES | tr -d '>\t ' | sed -e 's#\(.*\):\(.*\)|\(.*\):\(.*\)#\1: \2 -> \4#g' | sort -t - -k 2
+	  for M in $MOV_MODULES; do
+	    INS=$(grep "^[-]$M:" $MODULE_CHANGES | cut -d: -f2)
+		OUTS=$(grep "^[+]$M:" $MODULE_CHANGES | cut -d: -f2)
+		message "  $M: $INS -> $OUTS"
+	  done
       message
     fi
+  temp_destroy $MODULE_CHANGES
   fi
-
-  temp_destroy $MODULE_CHANGES
 }
 

Modified: lunar/branches/stable/var/lib/lunar/functions/useradd.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/useradd.lunar	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/functions/useradd.lunar	2005-05-20 08:42:19 UTC (rev 14857)
@@ -20,6 +20,7 @@
 # usage   : add_priv_user username:groupname [adduseropts [adduseropts]...]
 # info    : adds username:groupname and passes adduseropts to 'adduser'
 function add_priv_user() {
+  local USERNAME GROUPNAME
   debug_msg "function add_priv_user ($@)"
 
   if [ -n "$INSTALLWATCHFILE" ] ; then

Added: lunar/branches/stable/var/lib/lunar/plugins/initd.plugin
===================================================================
--- lunar/branches/stable/var/lib/lunar/plugins/initd.plugin	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/plugins/initd.plugin	2005-05-20 08:42:19 UTC (rev 14857)
@@ -0,0 +1,86 @@
+#!/bin/bash
+#############################################################
+#                                                           #
+# initd.plugin - handling of initd.d files                  #
+#                                                           #
+#############################################################
+#                                                           #
+# Copyright 2005 by Auke Kok under GPLv2                    #
+#                                                           #
+#############################################################
+
+
+plugin_initd_configure()
+{
+  local SCRIPTS INITDSCRIPTS INSTALLED_INITDSCRIPTS
+  debug_msg "plugin_initd_configure ($@)"
+  if ! grep -q INITDSCRIPTS $DEPENDS_CONFIG/$MODULE && 
+      [ -d $SCRIPT_DIRECTORY/init.d ]; then
+    cd $SCRIPT_DIRECTORY/init.d
+
+    SCRIPTS=$(ls -1)
+    INITDSCRIPTS=$(grep -l "# chkconfig: " $SCRIPTS | cut -d/ -f2)
+
+    for INITDSCRIPT in $INITDSCRIPTS; do
+      if query "Invoke $INITDSCRIPT via init.d automatically at boot ?"  y
+      then
+        INSTALLED_INIDSCRIPTS=$(echo $INSTALLED_INIDSCRIPTS $INITDSCRIPT)
+      else
+        if [ -f /etc/init.d/$INITDSCRIPT ]; then
+          chkconfig --del $INITDSCRIPT
+          ls /etc/rc?.d/???$INITDSCRIPT > /dev/null 2>&1 &&
+                rm -f /etc/rc?.d/???$INITDSCRIPT
+        fi
+      fi
+    done
+    cd $SCRIPT_DIRECTORY
+
+    set_module_config "INITDSCRIPTS" "$INSTALLED_INIDSCRIPTS"
+  fi
+  return 2
+}
+
+
+plugin_initd_post_build()
+{
+  local SCRIPTS ALL_INITDSCRIPTS CHKCONFIG
+  debug_msg "plugin_initd_post_build ($@)"
+  [ -d /etc/init.d ] || mkdir -p /etc/init.d
+
+  if [ -d $SCRIPT_DIRECTORY/init.d ]; then
+    invoke_installwatch
+    verbose_msg "handling init.d scripts" | tee -a $C_LOG
+    cd $SCRIPT_DIRECTORY/init.d
+    SCRIPTS=$(ls -1)
+    ALL_INITDSCRIPTS=$(grep -l "# chkconfig: " $SCRIPTS | cut -d/ -f2)
+
+    for INITDSCRIPT in $ALL_INITDSCRIPTS; do
+      if [ ! -f /etc/init.d/$INITDSCRIPT ] ; then
+        /usr/bin/install -g 0 -o 0 -m 700 $SCRIPT_DIRECTORY/init.d/$INITDSCRIPT /etc/init.d/
+      fi
+    done
+    cd $SCRIPT_DIRECTORY
+    devoke_installwatch
+  fi
+
+  for INITDSCRIPT in $INITDSCRIPTS; do
+    ls /etc/rc?.d/???$INITDSCRIPT > /dev/null 2>&1 &&
+        rm -f /etc/rc?.d/???$INITDSCRIPT
+    invoke_installwatch
+    chkconfig --add $INITDSCRIPT
+    devoke_installwatch
+
+    CHKCONFIG=`grep '^# chkconfig:' /etc/init.d/$INITDSCRIPT | cut -d : -f 2-2`
+    if `echo $CHKCONFIG | grep -q $(/sbin/runlevel | cut -d ' ' -f 2-2) -`
+    then
+      ( cd / && /etc/init.d/$INITDSCRIPT stop )
+      ( cd / && /etc/init.d/$INITDSCRIPT start )
+    fi
+
+  done
+  return 2
+}
+
+
+plugin_register BUILD_CONFIGURE plugin_initd_configure
+plugin_register BUILD_POST_BUILD plugin_initd_post_build

Added: lunar/branches/stable/var/lib/lunar/plugins/postbuild-generic.plugin
===================================================================
--- lunar/branches/stable/var/lib/lunar/plugins/postbuild-generic.plugin	2005-05-20 08:36:45 UTC (rev 14856)
+++ lunar/branches/stable/var/lib/lunar/plugins/postbuild-generic.plugin	2005-05-20 08:42:19 UTC (rev 14857)
@@ -0,0 +1,111 @@
+#!/bin/bash
+#############################################################
+#                                                           #
+# postbuild-generic.plugin - postbuild handling of non-     #
+#                            module related files           #
+#                                                           #
+#############################################################
+#                                                           #
+# Copyright 2005 by Auke Kok under GPLv2                    #
+#                                                           #
+#############################################################
+
+
+plugin_services_post_build()
+{
+  local IFS LINE
+  debug_msg "plugin_services_post_build ($@)"
+  if [ -f $SCRIPT_DIRECTORY/services ]; then
+    export IFS="$ENTER_IFS"
+    while read LINE; do
+      grep -q "$LINE" /etc/services || echo "$LINE" >> /etc/services
+    done < $SCRIPT_DIRECTORY/services
+  fi
+  return 2
+}
+
+
+gather_docs()
+{
+  # function : gather_docs
+  # usage    : gather_docs LIST OF FILES
+  # purpose  : Installs extra documentation that came with the
+  #            module's source package into the module's
+  #            document directory (defined as Lunar's base
+  #            document directory plus the module name).
+  debug_msg "gather_docs ($@)"
+
+  DOC_DIR=${DOCUMENT_DIRECTORY}/${MODULE}
+  if [ -d "$SOURCE_DIRECTORY" ] ; then
+    cd $SOURCE_DIRECTORY
+    invoke_installwatch
+    mkdir -p $DOC_DIR
+    # For each parameter that is an existing file
+    for FILE in ${@}; do
+      if [ -e ${FILE} -a -f ${FILE} ] ; then
+        # copy it over to the doc directory creating directories as needed
+        verbose_msg "Installing extra documentation to: ${DOC_DIR}/${FILE}"
+        install -D -m 644 ${FILE} ${DOC_DIR}/${FILE}
+      fi
+    done
+    devoke_installwatch
+	# do not return 2 here: this function is called directly and
+	# must return true (0) here
+	return 0
+  fi
+  return 2
+}
+
+
+plugin_postbuild_gather_docs()
+{
+  # pre-conditions : user must have $GARBAGE="on" to have any
+  #                  of this actually happen.
+  debug_msg "plugin_postbuild_gather_docs ($@)"
+
+  DOC_DIR=${DOCUMENT_DIRECTORY}/${MODULE}
+
+  # This is the list of default extra documentation that is to be 
+  # installed automatically if the user has $GARBAGE=on.  Any other
+  # docs are left up to the module writer to get installed.
+  DEFAULT_DOCS="README* INSTALL* FAQ* CHAN* doc* DOC* *doc \
+                *sample* conf SETUP NEWS Change* manual* Manual*"
+
+  if [ -d "$SOURCE_DIRECTORY" ] ; then
+    cd $SOURCE_DIRECTORY
+
+    # Bail if the user doesn't want to install any extra documentation
+    if [ "$GARBAGE" != "on" ] ; then
+      return 2
+    fi
+    invoke_installwatch
+    mkdir -p $DOC_DIR
+    # No parameters were passed in, install the default docs
+    for FILE in ${DEFAULT_DOCS}; do
+      # copy all of the default docs (prune Makefiles)
+      if [ -e $FILE -a ! -f ${FILE}/Makefile ] ; then
+        verbose_msg "Installing default documentation to: ${DOC_DIR}/${FILE}"
+        cp -a $FILE $DOC_DIR 2> /dev/null
+      fi
+    done
+    devoke_installwatch
+  fi
+  return 2
+}
+
+
+plugin_archive_module()
+{
+  debug_msg "plugin_archive_module($@)"
+  # keep a record of the module scripts used for every install
+  if [ ! -e /var/state/lunar/module_history ]; then
+    mkdir -p /var/state/lunar/module_history
+  fi
+  tar -cj -C $MOONBASE/$SECTION -f /var/state/lunar/module_history/$MODULE-$VERSION-$(date -u +%Y%m%d).tar.bz2 $MODULE
+  return 2
+}
+
+
+plugin_register BUILD_POST_BUILD plugin_services_post_build
+plugin_register BUILD_POST_BUILD plugin_postbuild_gather_docs
+plugin_register BUILD_POST_BUILD plugin_archive_module



More information about the Lunar-commits mailing list