aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMike Gilbert <floppym@gentoo.org>2016-03-12 13:13:56 -0500
committerWilliam Hubbs <w.d.hubbs@gmail.com>2016-07-25 15:37:02 -0500
commit671911762d1bcd90c10d8ac0eb30fe10be4a65f6 (patch)
tree9edcfb9294ebb4b77249b8787562e80727842e18
parent7d68839e9ea89b0a92aef69a9b4fd298554bb9b1 (diff)
tmpfiles: Process command line before gathering config files
This is part of #83.
-rw-r--r--sh/tmpfiles.sh.in51
1 files changed, 26 insertions, 25 deletions
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index f711b1da..95b8b932 100644
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -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.