[Lunar-commits] CVS: theedge/var/lib/lunar/functions check.lunar,
1.24, 1.25 plugins.lunar, 1.3, 1.4
Auke Kok
sofar at lunar-linux.org
Fri Mar 25 17:56:16 UTC 2005
- Previous message: [Lunar-commits] CVS: moonbase/gnome-platform/libxslt BUILD, 1.1,
NONE
- Next message: [Lunar-commits] CVS: theedge/var/lib/lunar/plugins
check-find.plugin, NONE, 1.1 check-ldd.plugin, NONE,
1.1 check-md5sum.plugin, NONE, 1.1 check-symlinks.plugin, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
Update of /var/cvs/lunar/theedge/var/lib/lunar/functions
In directory espresso.foo-projects.org:/tmp/cvs-serv11404/var/lib/lunar/functions
Modified Files:
check.lunar plugins.lunar
Log Message:
Rewriting fix code:
- now plugins instead of one large file
- lunar fix/nofix now runs better per-module
- global lunar fix/nofix doesn't perform expensive ld_export overhead
Index: check.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/check.lunar,v
retrieving revision 1.24
retrieving revision 1.25
diff -u -d -r1.24 -r1.25
--- check.lunar 24 Mar 2005 16:38:59 -0000 1.24
+++ check.lunar 25 Mar 2005 17:56:14 -0000 1.25
@@ -1,215 +1,23 @@
#!/bin/bash
-# #
-# check/lunar - checking functions #
-# #
############################################################
-# cast is part of the sorcery spell management utility #
-# Copyright 2001 by Kyle Sallee #
-############################################################
-# #
-# this WAS the cast script of a source based Linux distro, #
-# calls Sorcerer GNU/Linux, or SGL. SGL is no longer #
-# available with GPL license. Since this script was taken #
-# before licensing scheme change, no legal problems I #
-# guess. #
# #
-# the code is re-written for Lunar. The previous Copyright #
-# notices are kept; just in case some code is left :=) #
-# Kagan Kongar <kongar at tsrsb.org.tr>, 20020519 #
+# check/lunar - module santy checking functions #
# #
############################################################
# #
-# Parts Copyrighted Jason Johnston 2002 under GPLv2 #
-# Parts Copyrighted Kagan Kongar 2002 under GPLv2 #
+# Copyright 2005 Auke Kok under GPLv2 #
# #
############################################################
-ldd_check() {
- debug_msg "ldd_check ($@)"
- if [ "$LDD_CHECK" == "off" ] ; then
- return
- fi
- MODULE=$1
- VERSION=`installed_version $MODULE`
- I_LOG=$INSTALL_LOGS/$MODULE-$VERSION
- LDD_STATUS=0
-
- if [ -e "$I_LOG" ]; then
- IFS_OLD="$IFS"
- export IFS="
-"
-
- LOG=`cat $I_LOG |
- grep "/bin/\|/games/\|/lib/\|/sbin/" |
- grep -v "/doc/\|/fonts/\|/include/\|/locale/\|/man/\|/modules/\|/var/"`
-
- for FILE in $LOG; do
- if [ -f "$FILE" ] &&
- [ ! -h "$FILE" ] &&
- file -b "$FILE" |
- grep -q "ELF" &&
- ldd "$FILE" 2>&1 |
- grep -q "not found"
- then
- ( export IFS="$IFS_OLD"
- message "${FILE_COLOR}${FILE}" \
- "${DEFAULT_COLOR}of" \
- "${MODULE_COLOR}${MODULE}" \
- "${PROBLEM_COLOR}is broken." \
- "${DEFAULT_COLOR}"
- ldd "$FILE" 2>&1 | grep "not found"
- )
- LDD_STATUS=1
- fi
- done
- fi
- return $LDD_STATUS
-}
-
-
-find_check() {
- debug_msg "find_check ($@)"
- if [ "$FIND_CHECK" == "off" ] ||
- [ "$1" == "xfree86" ] ||
- [ "$1" == "xfree86-custom" ]; then
- return
- fi
- MODULE=$1
- VERSION=`installed_version $MODULE`
- I_LOG=$INSTALL_LOGS/$MODULE-$VERSION
- FIND_STATUS=0
-
- if [ -e "$I_LOG" ]; then
- IFS_OLD="$IFS"
- export IFS="
-"
-
- LOG=`cat $I_LOG |
- grep "/bin/\|/games/\|/include/\|/lib/\|/sbin/" |
- grep -v "/doc/\|/etc/\|/fonts/\|/man/\|/var/"`
-
- for ITEM in $LOG ; do
- if [ -e "$ITEM" ]; then
- true
- else
- ( export IFS="$IFS_OLD"
- message "${FILE_COLOR}${ITEM}" \
- "${DEFAULT_COLOR}of" \
- "${MODULE_COLOR}${MODULE}" \
- "${PROBLEM_COLOR}is missing." \
- "${DEFAULT_COLOR}"
- )
- FIND_STATUS=1
- fi
- done
- else
- ( export IFS="$IFS_OLD"
- message "${MODULE_COLOR}${MODULE} " \
- "${PROBLEM_COLOR}is missing an install log." \
- "${DEFAULT_COLOR}"
- )
- FIND_STATUS=1
- fi
- return $FIND_STATUS
-}
-
-
-remove_line() {
- debug_msg "remove_line ($@)"
- F_TMP=$(temp_create "${MODULE}.remove-line")
- cp $I_LOG $F_TMP
- grep -v $ITEM $F_TMP > $I_LOG
- temp_destroy $F_TMP
-
- message "Symbolic link: ${SYMLINK_COLOR}${ITEM}${DEFAULT_COLOR}" \
- "is owned by ${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
- message "Target of symbolic link is ${FILE_COLOR}${TARGET}${DEFAULT_COLOR}"
- message "${FILE_COLOR}${TARGET}${DEFAULT_COLOR} is owned by $(grep "^$TARGET$" $INSTALL_LOGS/* | cut -d: -f1)"
- message "Removed: ${SYMLINK_COLOR}${ITEM}${DEFAULT_COLOR} from ${I_LOG}"
-}
-
-
-sym_check() {
- debug_msg "sym_check ($@)"
- if [ "$SYM_CHECK" == "off" ]; then
- return
- fi
- MODULE=$1
- VERSION=`installed_version $MODULE`
- I_LOG=$INSTALL_LOGS/$MODULE-$VERSION
-
- if [ -e "$I_LOG" ]; then
- IFS_OLD="$IFS"
- export IFS="
-"
-
- LOG=`cat $I_LOG`
-
- for ITEM in $LOG ; do
- if [ -h "$ITEM" ] &&
- [ -f "$ITEM" ]
- then
- TARGET=$( basename $( ls -la "$ITEM" |
- cut -d '>' -f2 |
- cut -c 2-
- )
- )
- if ! grep -q "$TARGET" $I_LOG
- then ( export IFS="$IFS_OLD"; remove_line )
- fi
- fi
- done
- fi
-}
-
-
-md5sum_check() {
- debug_msg "md5sum_check ($@)"
- if [ "$MD5SUM_CHECK" == "off" ]; then
- return
- fi
-
- MODULE=$1
- VERSION=$(installed_version $MODULE)
- MD5_LOG="$MD5SUM_LOGS/$MODULE-$VERSION"
- MD5SUM_STATUS=0
-
- if [ -e "$MD5_LOG" ]; then
- IFS_OLD="$IFS"
- export IFS="
-"
-
- OUTPUT=$(cat $MD5_LOG |
- grep "/bin/\|/games/\|/include/\|/lib/\|/sbin/" |
- grep -v "/doc/\|/etc/\|/fonts/\|/man/\|/var/" |
- md5sum --check 2>/dev/null | grep -v ": OK" | cut -d: -f1)
-
- if [ -n "$OUTPUT" ]; then
- for FILE in $OUTPUT; do
- if [ -f "$FILE" ] && [ ! -h "$FILE" ] && file -b "$FILE" |
- egrep -q "executable|shared object|current ar archive" ; then
- MD5SUM=$(md5sum "$FILE")
- if ! grep -q "$MD5SUM" $MD5SUM_LOGS/*; then
- message "${FILE_COLOR}$FILE${DEFAULT_COLOR} of ${MODULE_COLOR}$MODULE${PROBLEM_COLOR} has wrong md5sum.${DEFAULT_COLOR}"
- MD5SUM_STATUS=1
- fi
- fi
- done
- fi
- else
- message "${MODULE_COLOR}$MODULE${PROBLEM_COLOR}is missing a md5sum log.${DEFAULT_COLOR}"
- fi
- return $MD5SUM_STATUS
-}
-
-
run_checks() {
debug_msg "run_checks ($@)"
- sym_check $1
- find_check $1 &&
- ldd_check $1 &&
- md5sum_check $1
+ verbose_msg "Running sanity checks for module \"$1\""
+ plugin_call MODULE_CHECK $1
+ if [ $? == 2 ]; then
+ return 0
+ fi
+ return 1
}
@@ -262,12 +70,12 @@
# remove whatever depends was residing in the depends state file and
# append the new output:
- remove_depends $MODULE &&
- lock_file $DEPENDS_STATUS &&
- lock_file $DEPENDS_STATUS_BACKUP &&
- run_depends $MODULE >> $DEPENDS_STATUS &&
- cat $DEPENDS_STATUS > $DEPENDS_STATUS_BACKUP &&
- unlock_file $DEPENDS_STATUS &&
+ 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 &&
unlock_file $DEPENDS_STATUS_BACKUP
}
@@ -296,23 +104,10 @@
MODULES=$(list_installed | grep -v moonbase)
fi
- if [ -z "$EXPORT_LD_PATH" ] ; then
- verbose_msg "Saving LD_LIBRARY_PATH=\"$LD_LIBRARY_PATH\""
- export EXPORT_LD_PATH=$(find /usr/lib -type d ! -empty)
- fi
- if [ "$LDD_CHECK" == "on" ] ; then
- LD_LIBRARY_PATH_OLD="$LD_LIBRARY_PATH"
- export_ld $EXPORT_LD_PATH
- fi
-
- until [ "$FIXED" == "yes" ] || [ "$HOPELESS" == "yes" ] ; do
- FIXED="yes"
- HOPELESS="no"
-
- for MODULE in $MODULES ; do
- # ENV separation required here!
- (
- run_details $MODULE &&
+ for MODULE in $MODULES ; do
+ # ENV separation required here!
+ (
+ run_details $MODULE &&
fix_depends $MODULE &&
# if we were called with --fixdepends then we may skip the rest
@@ -320,46 +115,25 @@
continue
fi
- if module_installed $MODULE &&
- [ "$MODULE" != "lunar" ] &&
- [ "$MODULE" != "j2sdk" ] &&
- ! module_held $MODULE &&
- ! echo $PASSED | grep -qw "$MODULE"; then
-
- if run_checks $MODULE || [ -n "$NOFIX" ] ; then
- PASSED="$PASSED $MODULE"
- else
- FIXED="no"
- satisfy_depends &&
- unset FIX &&
- satisfy_depends &&
+ if module_installed $MODULE && ! module_held $MODULE ; then
- if [ "$LDD_CHECK" == "on" ] ; then
- export LD_LIBRARY_PATH="$LD_LIBRARY_PATH_OLD"
- export_ld $EXPORT_LD_PATH
+ if ! run_checks $MODULE ; then
+ if [ -n "$NOFIX" ] ; then
+ continue
fi
+ satisfy_depends &&
+ FIX= satisfy_depends &&
- if run_checks $MODULE || [ -n "$NOFIX" ] ; then
-
- PASSED="$PASSED $MODULE"
- if [ "$LDD_CHECK" == "on" ] ; then
- export LD_LIBRARY_PATH="$LD_LIBRARY_PATH_OLD"
- export_ld $EXPORT_LD_PATH
- fi
-
- else
- unset FIX
- if ! lin --compile $MODULE ; then
- HOPELESS="yes"
+ if ! run_checks $MODULE ; then
+ if ! FIX= lin --compile $MODULE ; then
+ continue
elif ! run_checks $MODULE ; then
- HOPELESS="yes"
+ continue
fi
- export FIX="--fix"
fi
fi
fi
- )
- done
+ )
done
}
Index: plugins.lunar
===================================================================
RCS file: /var/cvs/lunar/theedge/var/lib/lunar/functions/plugins.lunar,v
retrieving revision 1.3
retrieving revision 1.4
diff -u -d -r1.3 -r1.4
--- plugins.lunar 25 Mar 2005 10:47:06 -0000 1.3
+++ plugins.lunar 25 Mar 2005 17:56:14 -0000 1.4
@@ -14,9 +14,9 @@
#
# when a handler is called, it should use the following return codes
#
-# 0 - executed OK, do not process other plugins
-# 1 - failed to run, stop executing plugins and report an error
-# 2 - failed to run but try other plugins
+# 0 - OK AND HALT, do not process other plugins
+# 1 - FAIL, stop executing plugins and report an error
+# 2 - OK AND CONTINUE or CONTINUE, run other plugins
#
plugin_register() {
@@ -27,6 +27,7 @@
# 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
LUNAR_PLUGINS=(${LUNAR_PLUGINS[@]} "$1:$2")
((LUNAR_PLUGIN_COUNT++))
}
@@ -51,7 +52,7 @@
fi
fi
done
- debug_msg "Could not find a suitable plugin for type \"$1\""
+ debug_msg "Finished running all plugins for type \"$1\""
return 2
}
- Previous message: [Lunar-commits] CVS: moonbase/gnome-platform/libxslt BUILD, 1.1,
NONE
- Next message: [Lunar-commits] CVS: theedge/var/lib/lunar/plugins
check-find.plugin, NONE, 1.1 check-ldd.plugin, NONE,
1.1 check-md5sum.plugin, NONE, 1.1 check-symlinks.plugin, NONE, 1.1
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Lunar-commits
mailing list