commit:     671911762d1bcd90c10d8ac0eb30fe10be4a65f6
Author:     Mike Gilbert <floppym <AT> gentoo <DOT> org>
AuthorDate: Sat Mar 12 18:13:56 2016 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Mon Jul 25 20:37:02 2016 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=67191176

tmpfiles: Process command line before gathering config files

This is part of #83.

 sh/tmpfiles.sh.in | 51 ++++++++++++++++++++++++++-------------------------
 1 file changed, 26 insertions(+), 25 deletions(-)

diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index f711b1d..95b8b93 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.

Reply via email to