--- trunk/mage/usr/lib/mage/etc-update 2005/02/15 22:59:14 60 +++ trunk/mage/usr/lib/mage/etc-update 2005/10/26 08:11:30 283 @@ -1,6 +1,8 @@ #!/bin/bash -# Copyright 2002 Gentoo Technologies, Inc. -# Distributed under the terms of the GNU Public License v2 +# Copyright 1999-2004 Gentoo Foundation +# Distributed under the terms of the GNU General Public License v2 +# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/etc-update,v 1.7 2005-10-26 08:11:30 niro Exp $ + # Author Brandon Low # # Previous version (from which I've borrowed a few bits) by: @@ -8,10 +10,10 @@ # Leo Lipelis # Karl Trygve Kalleberg # -# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/etc-update,v 1.6 2005-02-15 22:59:09 niro Exp $ +# $Header: /home/cvsd/magellan-cvs/magellan-src/mage/usr/lib/mage/etc-update,v 1.7 2005-10-26 08:11:30 niro Exp $ -# Modified by Niels Rogalla to use this with Magellan-Linux -# version: 0.3.6-r13 +# Modified by Niels Rogalla to use this with Magellan-Linux +# version: 0.4.0-r8 export PORTAGE_CALLER="etc-update" @@ -22,7 +24,7 @@ # item. If there's more than one of the same configuration item, # then allow the last setting to take precedence. cut -d'#' -f1-1 /etc/etc-update.conf | \ - sed -ne "s/^\ *$item\ *=\ *\"\(.*\)\"/\1/p" |sed -e '$p;d' + sed -ne "s/^ *$item *= *\([\"']\{0,1\}\)\(.*\)\1/\2/p" |sed -e '$p;d' } function scan() { @@ -35,11 +37,11 @@ for path in ${CONFIG_PROTECT}; do if [ -d ${path} ]; then ofile="" - for file in `find ${path} -iname "._cfg????_*" | - sed -e "s:\(^.*/\)\(._cfg*_\)\(/.*$\):\1\2\3\%\2\%\3:" | - sort -t'%' -k3 -k2 | cut -f1 -d'%'`; do - rpath=`echo "${file}" | sed -e "s:/[^/]*$::"` - rfile=`echo "${file}" | sed -e "s:^.*/::"` + for file in `find ${path}/ -iname "._cfg????_*" | + sed -e "s:\(^.*/\)\(\._cfg[0-9]*_\)\(.*$\):\1\2\3\%\2\%\3:" | + sort -t'%' -k3 -k2 | LANG=POSIX LC_ALL=POSIX cut -f1 -d'%'`; do + rpath=`echo "${file/\/\///}" | sed -e "s:/[^/]*$::"` + rfile=`echo "${file/\/\///}" | sed -e "s:^.*/::"` for mpath in ${CONFIG_PROTECT_MASK}; do if [[ "${rpath}" == "${mpath}"* ]]; then mv ${rpath}/${rfile} ${rpath}/${rfile:10} @@ -121,6 +123,7 @@ if (( ${mode} == 0 )); then cat ${TMP}/menuitems echo "Please select a file to edit by entering the corresponding number." + echo " (don't use -3 or -5 if you're unsure what to do)" echo " (-1 to exit) (-3 to auto merge all remaining files)" echo -n " (-5 to auto-merge AND not use 'mv -i'): " read input @@ -189,6 +192,7 @@ if (( ${my_input} == 0 )); then my_input=1 elif (( ${my_input} == -1 )); then + input=0 return elif (( ${my_input} == ${fcount} )); then break @@ -259,6 +263,7 @@ case ${my_input} in 1) echo "Replacing ${ofile} with ${file}" mv ${mv_opts} ${file} ${ofile} + my_input=-1 continue ;; 2) echo "Deleting ${file}" @@ -350,14 +355,13 @@ trap die term -TMP=/tmp/$$ +TMP="/tmp/$$" rm -rf ${TMP} 2> /dev/null mkdir ${TMP} || die "failed mkdir command!" 1 # I need the CONFIG_PROTECT value #CONFIG_PROTECT=$(/usr/lib/portage/bin/portageq config_protect) #CONFIG_PROTECT_MASK=$(/usr/lib/portage/bin/portageq config_protect_mask) -#source /etc/CONFIG_PROTECT source /etc/profile # load etc-config's configuration @@ -380,10 +384,6 @@ PAR=")" else PAR="" - rm_opts="" - mv_opts="" - cp_opts="" - pager=""P fi declare -i count=0