From: Zac Medico Date: Fri, 12 Oct 2007 06:09:14 +0000 (-0000) Subject: add --debug option and display a message about skipping X-Git-Tag: v2.1.3.16~51 X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=52a103999047f6fdc24028cff976123bbcacb516;p=portage.git add --debug option and display a message about skipping non-files so we dont get confusing loops where portage claims there are things to update but etc-update claims there are not (trunk r7994) svn path=/main/branches/2.1.2/; revision=8064 --- diff --git a/bin/etc-update b/bin/etc-update index 73dfb6bf0..16fb1fae4 100755 --- a/bin/etc-update +++ b/bin/etc-update @@ -40,7 +40,6 @@ diff_command() { } scan() { - echo "Scanning Configuration files..." rm -rf ${TMP}/files > /dev/null 2>&1 mkdir ${TMP}/files || die "Failed mkdir command!" 1 @@ -64,6 +63,7 @@ scan() { for file in $(set -f; find ${path}/ ${find_opts} ! -iname '.*~' ! -iname '.*.bak' | 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 @@ -74,8 +74,10 @@ scan() { break fi done - [ ! -f ${file} ] && continue - + if [[ ! -f ${file} ]] ; then + echo "Skipping non-file ${file} ..." + continue + fi if [[ "${ofile:10}" != "${rfile:10}" ]] || [[ ${opath} != ${rpath} ]]; then @@ -452,6 +454,7 @@ usage() { Usage: etc-update [options] Options: + -d, --debug Enable shell debugging -h, --help Show help and run away -V, --version Show version and trundle away EOF @@ -465,14 +468,17 @@ usage() { # Run the script # +SET_X=false while [[ -n $1 ]] ; do case $1 in + -d|--debug) SET_X=true;; -h|--help) usage;; -V|--version) echo '$Id$'; exit 0;; *) usage 1 "Invalid option '$1'";; esac shift done +${SET_X} && set -x type portageq > /dev/null || exit $? eval $(portageq envvar -v CONFIG_PROTECT \