From mboxrd@z Thu Jan  1 00:00:00 1970
Return-Path: <gentoo-commits+bounces-893747-garchives=archives.gentoo.org@lists.gentoo.org>
Received: from lists.gentoo.org (pigeon.gentoo.org [208.92.234.80])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by finch.gentoo.org (Postfix) with ESMTPS id 99CE513832E
	for <garchives@archives.gentoo.org>; Tue, 26 Jul 2016 15:54:56 +0000 (UTC)
Received: from pigeon.gentoo.org (localhost [127.0.0.1])
	by pigeon.gentoo.org (Postfix) with SMTP id EA75EE0AF5;
	Tue, 26 Jul 2016 15:54:53 +0000 (UTC)
Received: from smtp.gentoo.org (smtp.gentoo.org [140.211.166.183])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by pigeon.gentoo.org (Postfix) with ESMTPS id 6F177E0AF5
	for <gentoo-commits@lists.gentoo.org>; Tue, 26 Jul 2016 15:54:53 +0000 (UTC)
Received: from oystercatcher.gentoo.org (oystercatcher.gentoo.org [148.251.78.52])
	(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))
	(No client certificate requested)
	by smtp.gentoo.org (Postfix) with ESMTPS id 1D867340831
	for <gentoo-commits@lists.gentoo.org>; Tue, 26 Jul 2016 15:54:52 +0000 (UTC)
Received: from localhost.localdomain (localhost [127.0.0.1])
	by oystercatcher.gentoo.org (Postfix) with ESMTP id B1A7D78D
	for <gentoo-commits@lists.gentoo.org>; Tue, 26 Jul 2016 15:54:49 +0000 (UTC)
From: "William Hubbs" <williamh@gentoo.org>
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" <williamh@gentoo.org>
Message-ID: <1469548434.0c229faf7e6a57bcff70f2143b83cb69a34c89f4.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: 0c229faf7e6a57bcff70f2143b83cb69a34c89f4
X-VCS-Branch: master
Date: Tue, 26 Jul 2016 15:54:49 +0000 (UTC)
Precedence: bulk
List-Post: <mailto:gentoo-commits@lists.gentoo.org>
List-Help: <mailto:gentoo-commits+help@lists.gentoo.org>
List-Unsubscribe: <mailto:gentoo-commits+unsubscribe@lists.gentoo.org>
List-Subscribe: <mailto:gentoo-commits+subscribe@lists.gentoo.org>
List-Id: Gentoo Linux mail <gentoo-commits.gentoo.org>
X-BeenThere: gentoo-commits@lists.gentoo.org
X-Archives-Salt: 80624583-99fe-494c-b484-19b257f9a5fa
X-Archives-Hash: 5f6da8f507b84836027f2bebb74862ed

commit:     0c229faf7e6a57bcff70f2143b83cb69a34c89f4
Author:     Martin Väth <martin <AT> mvath <DOT> de>
AuthorDate: Wed May 25 09:03:12 2016 +0000
Commit:     William Hubbs <williamh <AT> gentoo <DOT> org>
CommitDate: Tue Jul 26 15:53:54 2016 +0000
URL:        https://gitweb.gentoo.org/proj/openrc.git/commit/?id=0c229faf

tmpfiles.sh: Support lines with q Q h H

btrfs support is not implemented yet (for q Q v), but at least tmpfiles.sh
no longer chokes about tmpfiles.d lines of recent systemd versions

This fixes #87.

 sh/tmpfiles.sh.in | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
 1 file changed, 46 insertions(+), 2 deletions(-)

diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index f7ee11b..87545ed 100644
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -10,8 +10,10 @@
 # http://projects.archlinux.org/initscripts.git/tree/arch-tmpfiles
 #
 # See the tmpfiles.d manpage as well:
+# https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
+# This script should match the old manpage
 # http://0pointer.de/public/systemd-man/tmpfiles.d.html
-# This script should match the manpage as of 2012/03/12
+# as of 2012/03/12 and also implements some more recent features
 #
 
 DRYRUN=0
@@ -44,6 +46,17 @@ dryrun_or_real() {
 	$dryrun "$@"
 }
 
+_chattr() {
+	local attr="$2"
+	case $attr in
+		[+-=]*) : ;;
+		'') return ;;
+		*) attr="+$attr" ;;
+	esac
+	local IFS=
+	dryrun_or_real chattr $1 "$attr" -- $3
+}
+
 relabel() {
 	local path
 	local paths=$1 mode=$2 uid=$3 gid=$4
@@ -163,6 +176,37 @@ _v() {
 	_d "$@"
 }
 
+_q() {
+	# Similar to _v. However, make sure that the subvolume will be assigned
+	# to the same higher-level quota groups as the subvolume it has
+	# been created in.
+	# TODO: Implement btrfs subvol creation.
+	_d "$@"
+}
+
+_Q() {
+	# Similar to q. However, instead of copying the higher-level quota
+	# group assignments from the parent as-is, the lowest quota group
+	# of the parent subvolume is determined that is not the
+	# leaf quota group.
+	# TODO: Implement btrfs subvol creation.
+	_d "$@"
+}
+
+_h() {
+	# Set file/directory attributes. Lines of this type accept
+	# shell-style globs in place of normal path names.
+	# The format of the argument field matches chattr
+	_chattr '' "$6" "$1"
+}
+
+_H() {
+	# Recursively set file/directory attributes. Lines of this type accept
+	# shell-syle globs in place of normal path names.
+	# Does not follow symlinks
+	_chattr -R "$6" "$1"
+}
+
 _L() {
 	# Create a symlink if it doesn't exist yet
 	local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
@@ -371,7 +415,7 @@ for FILE in $tmpfiles_d ; do
 
 		# whine about invalid entries
 		case $cmd in
-			f|F|w|d|D|v|p|L|c|C|b|x|X|r|R|z|Z) ;;
+			f|F|w|d|D|v|p|L|c|C|b|x|X|r|R|z|Z|q|Q|h|H) ;;
 			*) warninvalid ; continue ;;
 		esac