[Lunar-commits] r23722 - in lunar/branches/stable: bin etc/lunar sbin var/lib/lunar/functions var/lib/lunar/menu var/lib/lunar/plugins
Auke Kok
sofar at lunar-linux.org
Sun Mar 18 21:39:46 CET 2007
Author: sofar
Date: 2007-03-18 21:39:46 +0100 (Sun, 18 Mar 2007)
New Revision: 23722
Added:
lunar/branches/stable/var/lib/lunar/menu/alias.menu
Modified:
lunar/branches/stable/bin/lvu
lunar/branches/stable/etc/lunar/config
lunar/branches/stable/sbin/lrm
lunar/branches/stable/sbin/lunar
lunar/branches/stable/sbin/lvis
lunar/branches/stable/var/lib/lunar/functions/config.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/modules.lunar
lunar/branches/stable/var/lib/lunar/plugins/download-generic.plugin
Log:
Sync with theedge - mostly cleanups/indentation. alias menu.
Modified: lunar/branches/stable/bin/lvu
===================================================================
--- lunar/branches/stable/bin/lvu 2007-03-18 20:32:59 UTC (rev 23721)
+++ lunar/branches/stable/bin/lvu 2007-03-18 20:39:46 UTC (rev 23722)
@@ -743,26 +743,26 @@
diff_module() {
if [ "$ZLOCAL_OVERRIDES" != "on" ]; then
message "can't diff modules without ZLOCAL_OVERRIDES=on"
- exit 1
+ exit 1
fi
if [ -z "$1" ]; then
message "diff requires a single module name"
- exit 1
+ exit 1
fi
if ! run_details "$1" ; then
message "diff requires an existing module"
exit 1
else
if echo $SECTION | grep -q '^zlocal' ; then
- ZLOCAL_OVERRIDES=off NZSECTION=$(find_section $1)
- if echo $NZSECTION | grep -q '^zlocal' ; then
- unset SECTION
- fi
- else
- message "no local copy of \"$MODULE\" exists"
- exit 1
+ ZLOCAL_OVERRIDES=off NZSECTION=$(find_section $1)
+ if echo $NZSECTION | grep -q '^zlocal' ; then
+ unset SECTION
+ fi
+ else
+ message "no local copy of \"$MODULE\" exists"
+ exit 1
fi
- ZSECTION=$(echo "$SECTION/" | sed 's/^zlocal\///g;s/\/$//')
+ ZSECTION=$(echo "$SECTION/" | sed 's/^zlocal\///g;s/\/$//')
echo diff a/$NZSECTION/$MODULE b/$NZSECTION/$MODULE
diff -Nur $MOONBASE/$NZSECTION/$MODULE $MOONBASE/zlocal/$ZSECTION/$MODULE --exclude ".svn" --exclude "CVS" | \
grep -v ^diff | sed "s:$MOONBASE/$NZSECTION/:a/$NZSECTION/:g;s:$MOONBASE/zlocal/$ZSECTION/:b/$NZSECTION/:g"
Modified: lunar/branches/stable/etc/lunar/config
===================================================================
--- lunar/branches/stable/etc/lunar/config 2007-03-18 20:32:59 UTC (rev 23721)
+++ lunar/branches/stable/etc/lunar/config 2007-03-18 20:39:46 UTC (rev 23722)
@@ -80,9 +80,10 @@
MOONBASE_URL[0]=http://lunar-linux.org/lunar/
MOONBASE_URL[1]=http://download.lunar-linux.org/lunar/
-
+
PATCH_URL=http://download.lunar-linux.org/lunar/patches/
-
+ MIRROR_URL=http://download.lunar-linux.org/lunar/mirrors/
+
TRACKED="/bin /boot /etc /lib /sbin /usr /var /opt/lunar"
TMPDIR=${TMPDIR:-/tmp}
@@ -111,14 +112,10 @@
MESSAGE_COLOR="${CYAN}"
DEFAULT_COLOR="${DEFAULT}"
- TAB_ENTER_IFS="
-"
- ENTER_IFS="
-"
- STANDARD_IFS="
-"
+ TAB_ENTER_IFS=$'\t\n'
+ ENTER_IFS=$'\n'
+ STANDARD_IFS=$' \t\n'
-
for FUNCTION in $FUNCTIONS/*.lunar ; do
. $FUNCTION
done
Modified: lunar/branches/stable/sbin/lrm
===================================================================
--- lunar/branches/stable/sbin/lrm 2007-03-18 20:32:59 UTC (rev 23721)
+++ lunar/branches/stable/sbin/lrm 2007-03-18 20:39:46 UTC (rev 23722)
@@ -195,6 +195,13 @@
else
verbose_msg "removing module from dependency listing and configs"
remove_depends $MODULE
+ # remove alias if required
+ for ALIAS in `cut -d: -f1 $MOONBASE/aliases`; do
+ if [ "$(get_local_config `echo LUNAR_ALIAS_${ALIAS:1}`)" == "$MODULE" ]; then
+ verbose_msg "removing alias mapping from \"$ALIAS\" to \"$MODULE\""
+ unset_local_config `echo LUNAR_ALIAS_${ALIAS:1}`
+ fi
+ done
# restart xinetd after xinetd.confs have been removed by lrm...
if [ -n "$SERVICES" -a -n "$XINETD" ] ; then
verbose_msg "restarting xinetd"
Modified: lunar/branches/stable/sbin/lunar
===================================================================
--- lunar/branches/stable/sbin/lunar 2007-03-18 20:32:59 UTC (rev 23721)
+++ lunar/branches/stable/sbin/lunar 2007-03-18 20:39:46 UTC (rev 23722)
@@ -431,7 +431,8 @@
N_HELP="Check all modules but do not fix the internal state"
D_HELP="Check and fix the dependency database of lunar"
P_HELP="Prune old sources and install/compile logs"
-
+ A_HELP="Change selected or select new alias mappings"
+
COMMAND=`$DIALOG --title "Maintenance Menu" \
--ok-label "Select" \
--cancel-label "Exit" \
@@ -443,16 +444,20 @@
"F" "Fix everything" "$F_HELP" \
"N" "Check everything but don't fix" "$N_HELP" \
"D" "Fix dependencies" "$D_HELP" \
- "P" "Prune old sources and logs" "$P_HELP"`
+ "P" "Prune old sources and logs" "$P_HELP" \
+ "A" "Select or Change Aliases" "$A_HELP"`
do
case $COMMAND in
F) lunar fix ;;
N) lunar nofix ;;
D) lunar fixdepends ;;
P) lunar prune ;;
+ A) select_aliases ;;
esac
- message "${MESSAGE_COLOR}Press enter to return...${DEFAULT_COLOR}"
- read
+ if [ $COMMAND != "A" ] ; then
+ message "${MESSAGE_COLOR}Press enter to return...${DEFAULT_COLOR}"
+ read
+ fi
done
}
Modified: lunar/branches/stable/sbin/lvis
===================================================================
--- lunar/branches/stable/sbin/lvis 2007-03-18 20:32:59 UTC (rev 23721)
+++ lunar/branches/stable/sbin/lvis 2007-03-18 20:39:46 UTC (rev 23722)
@@ -1,4 +1,4 @@
-#!/bin/sh
+#!/bin/bash
############################################################
# Copyright 2001 by Kyle Sallee #
############################################################
Modified: lunar/branches/stable/var/lib/lunar/functions/config.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/config.lunar 2007-03-18 20:32:59 UTC (rev 23721)
+++ lunar/branches/stable/var/lib/lunar/functions/config.lunar 2007-03-18 20:39:46 UTC (rev 23722)
@@ -20,49 +20,49 @@
set_config()
{
- local LINE NEW
- debug_msg "set_config ($@)"
+ local LINE NEW
+ debug_msg "set_config ($@)"
LINE=$(grep -w "$2=.*" $1)
- if [ "$1" == "$LOCAL_CONFIG" ] ; then
- NEW=$(printf "%16s=%s" "$2" "$3")
- else
- NEW="$2=\"$3\""
- fi
+ if [ "$1" == "$LOCAL_CONFIG" ] ; then
+ NEW=$(printf "%16s=%s" "$2" "$3")
+ else
+ NEW="$2=\"$3\""
+ fi
- # on-demand creation
- if [ ! -f $1 ] ; then
- touch $1
- fi
+ # on-demand creation
+ if [ ! -f $1 ] ; then
+ touch $1
+ fi
- lock_file $1 &&
- if [ -n "$LINE" ] ; then
- # make sure we escape those ':' characters:
- LINE=$(echo $LINE | sed 's/:/\\:/g')
- NEW=$(echo $NEW | sed 's/:/\\:/g')
- sedit "s:$LINE:$NEW:" $1
- else
- echo "$NEW" >> $1
- fi
- unlock_file $1
+ lock_file $1 &&
+ if [ -n "$LINE" ] ; then
+ # make sure we escape those ':' characters:
+ LINE=$(echo $LINE | sed 's/:/\\:/g')
+ NEW=$(echo $NEW | sed 's/:/\\:/g')
+ sedit "s:$LINE:$NEW:" $1
+ else
+ echo "$NEW" >> $1
+ fi
+ unlock_file $1
}
unset_config()
{
- debug_msg "unset_config ($@)"
-
- # on-demand creation
- if [ ! -f $1 ] ; then
- touch $1
- fi
+ debug_msg "unset_config ($@)"
- lock_file $1 &&
- if [ -n "$2" ] ; then
- # make sure we escape those ':' characters:
- sedit "/^[ ]*$2=/d" $1
- fi
- unlock_file $1
+ # on-demand creation
+ if [ ! -f $1 ] ; then
+ touch $1
+ fi
+
+ lock_file $1 &&
+ if [ -n "$2" ] ; then
+ # make sure we escape those ':' characters:
+ sedit "/^[ ]*$2=/d" $1
+ fi
+ unlock_file $1
}
@@ -70,62 +70,62 @@
{
if [[ -f $1 ]] ; then
grep -w "$2=.*" $1 | cut -d= -f2- | sed -e 's/^"//' -e 's/"$//'
- fi
+ fi
}
set_local_config()
{
- debug_msg "set_local_config ($@)"
- set_config "$LOCAL_CONFIG" "$1" "$2"
+ debug_msg "set_local_config ($@)"
+ set_config "$LOCAL_CONFIG" "$1" "$2"
}
unset_local_config()
{
- debug_msg "unset_local_config ($@)"
- unset_config "$LOCAL_CONFIG" "$1"
+ debug_msg "unset_local_config ($@)"
+ unset_config "$LOCAL_CONFIG" "$1"
}
get_local_config() {
- get_config "$LOCAL_CONFIG" "$1"
+ get_config "$LOCAL_CONFIG" "$1"
}
set_module_config()
{
- debug_msg "set_module_config ($@)"
- if [ -n "$MODULE" ] ; then
- set_config "$DEPENDS_CONFIG/$MODULE" "$1" "$2"
- fi
+ debug_msg "set_module_config ($@)"
+ if [ -n "$MODULE" ] ; then
+ set_config "$DEPENDS_CONFIG/$MODULE" "$1" "$2"
+ fi
}
unset_module_config()
{
- debug_msg "unset_module_config ($@)"
- if [ -n "$MODULE" ] ; then
- unset_config "$DEPENDS_CONFIG/$MODULE" "$1"
- fi
+ debug_msg "unset_module_config ($@)"
+ if [ -n "$MODULE" ] ; then
+ unset_config "$DEPENDS_CONFIG/$MODULE" "$1"
+ fi
}
get_module_config()
{
- debug_msg "get_module_config ($@)"
- if [ -n "$MODULE" ] ; then
- get_config "$DEPENDS_CONFIG/$MODULE" "$1"
- fi
+ debug_msg "get_module_config ($@)"
+ if [ -n "$MODULE" ] ; then
+ get_config "$DEPENDS_CONFIG/$MODULE" "$1"
+ fi
}
get_other_module_config()
{
- debug_msg "get_other_module_config ($@)"
- if [ -n "$1" ] ; then
- get_config "$DEPENDS_CONFIG/$1" "$2"
- fi
+ debug_msg "get_other_module_config ($@)"
+ if [ -n "$1" ] ; then
+ get_config "$DEPENDS_CONFIG/$1" "$2"
+ fi
}
Modified: lunar/branches/stable/var/lib/lunar/functions/depends.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/depends.lunar 2007-03-18 20:32:59 UTC (rev 23721)
+++ lunar/branches/stable/var/lib/lunar/functions/depends.lunar 2007-03-18 20:39:46 UTC (rev 23722)
@@ -21,7 +21,7 @@
############################################################
-# function : find_depends
+# function : find_depends
# usage : find_depends "module name"
# purpose : recursive dependency finder, no need to be installed
function find_depends() {
Modified: lunar/branches/stable/var/lib/lunar/functions/download.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/download.lunar 2007-03-18 20:32:59 UTC (rev 23721)
+++ lunar/branches/stable/var/lib/lunar/functions/download.lunar 2007-03-18 20:39:46 UTC (rev 23722)
@@ -84,13 +84,13 @@
break
fi
fi
-
+
# silly that this exists:
if [ "$CLEAR_CACHE" == "on" ] ; then
verbose_msg "clearing source cache copy of \"$SRC\""
rm -f $SOURCE_CACHE/$SRC 2>/dev/null
fi
-
+
add_url() {
if [ -n "$1" ]; then
if ! echo " $ALL_URLS " | grep -q " $1 "; then
@@ -98,54 +98,63 @@
fi
fi
}
-
- if plugin_call SOURCE_NEEDREFRESH ${URLS[0]} $SRC $SOURCE_CACHE || [ ! -f $SOURCE_CACHE/$SRC ] ; then
- # check for cache?
- message "${MESSAGE_COLOR}Downloading source file" \
- "${FILE_COLOR}$SRC${DEFAULT_COLOR}" \
- "${MESSAGE_COLOR}for module" \
- "${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
- if [ -n "$BASE_URL" ] ; then
- # in case -u was passed:
- ALL_URLS=$BASE_URL
- else
- # compose a list of URLS
- ALL_URLS=
- add_url $FRESORT_URL
- for URL in $URLS ; do
- add_url $URL
- if [ "$EXHAUSTIVE" == "on" ]; then
- # scan for hits against known clusters of mirrors
- for MLIST in $MIRRORS/*; do
- for ALT in $(sed 's/.*\t\([^\t]*\)$/\1/g' $MLIST | grep -v "^Custom$"); do
- if [ "${URL:0:${#ALT}}" == "$ALT" ] ; then
- # compose the list of valid mirrors
- REST=${URL:${#ALT}}
- for HIT in $(sed 's/.*\t\([^\t]*\)$/\1/g' $MLIST); do
- add_url ${HIT}${REST}
- done
- fi
+ if ! plugin_call SOURCE_NEEDREFRESH ${URLS[0]} $SRC $SOURCE_CACHE && [ -f $SOURCE_CACHE/$SRC ] ; then
+ # break out of the loop if the cache has it:
+ verbose_msg "Skipping download of \"$SRC\" (in cache)"
+ continue
+ fi
+
+ # check for cache?
+ message "${MESSAGE_COLOR}Downloading source file" \
+ "${FILE_COLOR}$SRC${DEFAULT_COLOR}" \
+ "${MESSAGE_COLOR}for module" \
+ "${MODULE_COLOR}${MODULE}${DEFAULT_COLOR}"
+
+ if [ -n "$BASE_URL" ] ; then
+ # in case -u was passed:
+ ALL_URLS=$BASE_URL
+ else
+ # compose a list of URLS
+ ALL_URLS=
+ add_url $FRESORT_URL
+ for URL in $URLS ; do
+ add_url $URL
+ if [ "$EXHAUSTIVE" != "on" ]; then
+ continue
+ fi
+
+ # scan for hits against known clusters of mirrors
+ for MLIST in $MIRRORS/*; do
+ for ALT in $(sed 's/.*\t\([^\t]*\)$/\1/g' $MLIST | grep -v "^Custom$"); do
+ if [ "${URL:0:${#ALT}}" == "$ALT" ] ; then
+ # compose the list of valid mirrors
+ REST=${URL:${#ALT}}
+ for HIT in $(sed 's/.*\t\([^\t]*\)$/\1/g' $MLIST); do
+ add_url ${HIT}${REST}
done
- done
- fi
+ fi
+ done
done
- add_url $LRESORT_URL
+ done
+ add_url $LRESORT_URL
+ fi
+
+ for URL in $ALL_URLS; do
+ # and download
+ if download_url $URL $SRC $SOURCE_CACHE ; then
+ # done for this file!
+ FAILED=1
+ break
fi
+ done
+ if [ ${FAILED:-0} == 0 ] ; then
+ FAILALL=1
+ fi
- for URL in $ALL_URLS; do
- # and download
- if download_url $URL $SRC $SOURCE_CACHE ; then
- break
- fi
- done
- else
- # break out of the loop if the cache has it:
- verbose_msg "Skipping download of \"$SRC\" (in cache)"
- continue
- fi
done
-)
+ return ${FAILALL:-0}
+)
}
Modified: lunar/branches/stable/var/lib/lunar/functions/modules.lunar
===================================================================
--- lunar/branches/stable/var/lib/lunar/functions/modules.lunar 2007-03-18 20:32:59 UTC (rev 23721)
+++ lunar/branches/stable/var/lib/lunar/functions/modules.lunar 2007-03-18 20:39:46 UTC (rev 23722)
@@ -280,7 +280,7 @@
. $SCRIPT_DIRECTORY/$2.$PLATFORM
elif [[ -e "$SCRIPT_DIRECTORY/$2" ]]; then
. $SCRIPT_DIRECTORY/$2
- fi
+ fi
}
@@ -297,7 +297,7 @@
# usage : module_held $MODULE
# purpose : check if $MODULE is held
module_held() {
- debug_msg "module_held ($@)"
+ debug_msg "module_held ($@)"
grep -q "^$1:[[:digit:]]*:held:" $MODULE_STATUS
}
Added: lunar/branches/stable/var/lib/lunar/menu/alias.menu
===================================================================
--- lunar/branches/stable/var/lib/lunar/menu/alias.menu (rev 0)
+++ lunar/branches/stable/var/lib/lunar/menu/alias.menu 2007-03-18 20:39:46 UTC (rev 23722)
@@ -0,0 +1,85 @@
+############################################################
+# #
+# This code is written for Lunar Linux, see #
+# http://lunar-linux.org #
+# #
+############################################################
+# #
+# Copyright 2007 (c) GPLv2 - Auke Kok #
+# #
+############################################################
+
+
+alias_menu_list_aliases()
+{
+ for A in `cut -d: -f1 $MOONBASE/aliases`; do
+ echo ${A:1}
+ CHOICE=$(get_local_config `echo LUNAR_ALIAS_${A:1}`)
+ if [ -n "$CHOICE" ] ; then
+ echo "$CHOICE"
+ else
+ echo "[unset]"
+ fi
+ done
+}
+
+
+alias_menu_list_alias_choices()
+{
+ echo "None"
+ echo "None"
+ if [ -z "$(get_local_config `echo LUNAR_ALIAS_$1`)" ] ; then
+ echo "on"
+ else
+ echo "off"
+ fi
+ IFS=$STANDARD_IFS
+ for C in `grep "^%$1:" $MOONBASE/aliases | cut -d: -f2`; do
+ echo "$C"
+ echo "$C"
+ if [ $(get_local_config `echo LUNAR_ALIAS_$1`) == "$C" ] ; then
+ echo "on"
+ else
+ echo "off"
+ fi
+ done
+}
+
+
+select_aliases()
+{
+ export IFS=$ENTER_IFS
+
+ while true ; do
+ DEFAULT=${CHOICE}
+ CHOICE=`$DIALOG --title "Select Lunar Aliases" \
+ --ok-label "Select" \
+ --cancel-label "Close" \
+ --default-item "$DEFAULT" \
+ --menu "" 0 0 0 \
+ $(alias_menu_list_aliases)`
+ if [ $? != 0 ]; then
+ return
+ fi
+
+ # modify an alias
+ DEFAULT=$(get_local_config `echo LUNAR_ALIAS_$CHOICE`)
+ if [ -z "$DEFAULT" ] ; then
+ DEFAULT="None"
+ fi
+ ACHOICE=`$DIALOG --title "Select Lunar Aliases" \
+ --ok-label "Select" \
+ --cancel-label "Close" \
+ --default-item "$DEFAULT" \
+ --radiolist "" 0 0 0 \
+ $(alias_menu_list_alias_choices $CHOICE)`
+ if [ $? == 0 ]; then
+ # modify it
+ if [ "$ACHOICE" != "None" ] ; then
+ set_local_config `echo LUNAR_ALIAS_$CHOICE` "$ACHOICE"
+ else
+ unset_local_config `echo LUNAR_ALIAS_$CHOICE`
+ fi
+ fi
+ done
+}
Modified: lunar/branches/stable/var/lib/lunar/plugins/download-generic.plugin
===================================================================
--- lunar/branches/stable/var/lib/lunar/plugins/download-generic.plugin 2007-03-18 20:32:59 UTC (rev 23721)
+++ lunar/branches/stable/var/lib/lunar/plugins/download-generic.plugin 2007-03-18 20:39:46 UTC (rev 23722)
@@ -67,12 +67,12 @@
verbose_msg "download of \"$2\" successful"
else
rm -f $TMP_FILE
- return 1
+ return 1
fi
else
# don't report errors against cache misses
if [ "$URL" != "$LRESORT_URL/" ]; then
- activity_log "lget" "$MODULE" "$VERSION" "failed" "broken URL: \"$URL$2\""
+ activity_log "lget" "$MODULE" "$VERSION" "failed" "broken URL: \"$URL$2\""
fi
return 1
fi
More information about the Lunar-commits
mailing list