tmpfiles: Process command line before gathering config files

This is part of #83.
This commit is contained in:
Mike Gilbert 2016-03-12 13:13:56 -05:00 committed by William Hubbs
parent 7d68839e9e
commit 671911762d

View File

@ -264,6 +264,32 @@ _Z() {
BOOT=0 CREATE=0 REMOVE=0 CLEAN=0 VERBOSE=0 DRYRUN=0 error=0 LINENO=0
EXCLUDE=
PREFIX=
while [ $# -gt 0 ]; do
case $1 in
--boot) BOOT=1 ;;
--create) CREATE=1 ;;
--remove) REMOVE=1 ;;
--clean) CLEAN=1 ;; # TODO: Not implemented
--verbose) VERBOSE=1 ;;
--dryrun|--dry-run) DRYRUN=1 ;;
--exclude-prefix=*) EXCLUDE="${EXCLUDE}${1##--exclude-prefix=} " ;;
--prefix=*) PREFIX="${PREFIX}${1##--prefix=} " ;;
-*) invalid_option "$1" ;;
esac
shift
done
if [ $(( CLEAN )) -eq 1 ] ; then
printf '%s clean mode is not implemented\n' "${0##*/}"
exit 1
fi
if [ "$CREATE$REMOVE" = '00' ]; then
printf 'usage: %s [--exclude-prefix=path] [--prefix=path] [--boot] [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}"
exit 1
fi
FILE=
fragments=
# XXX: The harcoding of /usr/lib/ is an explicit choice by upstream
@ -294,31 +320,6 @@ for b in $tmpfiles_basenames ; do
[ -f "${real_f}" ] && tmpfiles_d="${tmpfiles_d} ${real_f}"
done
while [ $# -gt 0 ]; do
case $1 in
--boot) BOOT=1 ;;
--create) CREATE=1 ;;
--remove) REMOVE=1 ;;
--clean) CLEAN=1 ;; # TODO: Not implemented
--verbose) VERBOSE=1 ;;
--dryrun|--dry-run) DRYRUN=1 ;;
--exclude-prefix=*) EXCLUDE="${EXCLUDE}${1##--exclude-prefix=} " ;;
--prefix=*) PREFIX="${PREFIX}${1##--prefix=} " ;;
-*) invalid_option "$1" ;;
esac
shift
done
if [ $(( CLEAN )) -eq 1 ] ; then
printf '%s clean mode is not implemented\n' "${0##*/}"
exit 1
fi
if [ "$CREATE$REMOVE" = '00' ]; then
printf 'usage: %s [--exclude-prefix=path] [--prefix=path] [--boot] [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}"
exit 1
fi
error=0
# loop through the gathered fragments, sorted globally by filename.