From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80]) by finch.gentoo.org (Postfix) with ESMTP id EFCD11381F3 for ; Thu, 25 Jul 2013 06:01:34 +0000 (UTC) Received: from pigeon.gentoo.org (localhost [127.0.0.1]) by pigeon.gentoo.org (Postfix) with SMTP id BE78EE0A41; Thu, 25 Jul 2013 06:01:29 +0000 (UTC) Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by pigeon.gentoo.org (Postfix) with ESMTPS id 52EC1E0A41 for ; Thu, 25 Jul 2013 06:01:29 +0000 (UTC) Received: from hornbill.gentoo.org (hornbill.gentoo.org [94.100.119.163]) (using TLSv1 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by smtp.gentoo.org (Postfix) with ESMTPS id 3264433E9B5 for ; Thu, 25 Jul 2013 06:01:28 +0000 (UTC) Received: from localhost.localdomain (localhost [127.0.0.1]) by hornbill.gentoo.org (Postfix) with ESMTP id ABC9EE5458 for ; Thu, 25 Jul 2013 06:01:26 +0000 (UTC) From: "William Hubbs" To: gentoo-commits@lists.gentoo.org Content-Transfer-Encoding: 8bit Content-type: text/plain; charset=UTF-8 Reply-To: gentoo-dev@lists.gentoo.org, "William Hubbs" Message-ID: <1374731918.e9189cd8a24b5614f3e82aec4a779e4d90656b1e.WilliamH@OpenRC> Subject: [gentoo-commits] proj/openrc:master commit in: sh/ X-VCS-Repository: proj/openrc X-VCS-Files: sh/tmpfiles.sh.in X-VCS-Directories: sh/ X-VCS-Committer: WilliamH X-VCS-Committer-Name: William Hubbs X-VCS-Revision: e9189cd8a24b5614f3e82aec4a779e4d90656b1e X-VCS-Branch: master Date: Thu, 25 Jul 2013 06:01:26 +0000 (UTC) Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: List-Id: Gentoo Linux mail X-BeenThere: gentoo-commits@lists.gentoo.org X-Archives-Salt: 3ecc7aac-53da-4c0f-af58-ce303fb20bc0 X-Archives-Hash: 03b600e2c1866d31e548f82fb1b79c62 commit: e9189cd8a24b5614f3e82aec4a779e4d90656b1e Author: William Hubbs gmail com> AuthorDate: Thu Jul 25 05:58:38 2013 +0000 Commit: William Hubbs gentoo org> CommitDate: Thu Jul 25 05:58:38 2013 +0000 URL: http://git.overlays.gentoo.org/gitweb/?p=proj/openrc.git;a=commit;h=e9189cd8 tmpfiles: add --prefix and --exclude-prefix options --- sh/tmpfiles.sh.in | 19 ++++++++++++++++++- 1 file changed, 18 insertions(+), 1 deletion(-) diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in index 59fdcd7..22d5f1f 100755 --- a/sh/tmpfiles.sh.in +++ b/sh/tmpfiles.sh.in @@ -15,6 +15,17 @@ DRYRUN=0 +checkprefix() { + n=$1 + shift + for x in $@; do + case $n in + ${x}*) return 0 ;; + esac + done + return 1 +} + warninvalid() { printf "tmpfiles: ignoring invalid entry on line %d of \`%s'\n" "$LINENUM" "$FILE" error=$(( error+1 )) @@ -202,6 +213,8 @@ _Z() { } CREATE=0 REMOVE=0 CLEAN=0 VERBOSE=0 DRYRUN=0 error=0 LINENO=0 +EXCLUDE= +PREFIX= FILE= fragments= # XXX: The harcoding of /usr/lib/ is an explicit choice by upstream @@ -237,6 +250,8 @@ while [ $# -gt 0 ]; do --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=} " ;; esac shift done @@ -247,7 +262,7 @@ if [ $(( CLEAN )) -eq 1 ] ; then fi if [ "$CREATE$REMOVE" = '00' ]; then - printf 'usage: %s [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}" + printf 'usage: %s [--exclude-prefix=path] [--prefix=path] [--create] [--remove] [--clean] [--verbose] [--dry-run]\n' "${0##*/}" exit 1 fi @@ -297,6 +312,8 @@ for FILE in $tmpfiles_d ; do [ "$arg" = '-' -o "$arg" = '' ] && arg='' set -- "$path" "$mode" "$uid" "$gid" "$age" "$arg" + [ -n "$EXCLUDE" ] && checkprefix $path $EXCLUDE && continue + [ -n "$PREFIX" ] && ! checkprefix $path $PREFIX && continue [ "$VERBOSE" -eq "1" ] && echo _$cmd "$@" _$cmd "$@" rc=$?