Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] proj/openrc:master commit in: sh/
Date: Tue, 26 Jul 2016 15:54:56
Message-Id: 1469548434.0c229faf7e6a57bcff70f2143b83cb69a34c89f4.williamh@OpenRC
1 commit: 0c229faf7e6a57bcff70f2143b83cb69a34c89f4
2 Author: Martin Väth <martin <AT> mvath <DOT> de>
3 AuthorDate: Wed May 25 09:03:12 2016 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Tue Jul 26 15:53:54 2016 +0000
6 URL: https://gitweb.gentoo.org/proj/openrc.git/commit/?id=0c229faf
7
8 tmpfiles.sh: Support lines with q Q h H
9
10 btrfs support is not implemented yet (for q Q v), but at least tmpfiles.sh
11 no longer chokes about tmpfiles.d lines of recent systemd versions
12
13 This fixes #87.
14
15 sh/tmpfiles.sh.in | 48 ++++++++++++++++++++++++++++++++++++++++++++++--
16 1 file changed, 46 insertions(+), 2 deletions(-)
17
18 diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
19 index f7ee11b..87545ed 100644
20 --- a/sh/tmpfiles.sh.in
21 +++ b/sh/tmpfiles.sh.in
22 @@ -10,8 +10,10 @@
23 # http://projects.archlinux.org/initscripts.git/tree/arch-tmpfiles
24 #
25 # See the tmpfiles.d manpage as well:
26 +# https://www.freedesktop.org/software/systemd/man/tmpfiles.d.html
27 +# This script should match the old manpage
28 # http://0pointer.de/public/systemd-man/tmpfiles.d.html
29 -# This script should match the manpage as of 2012/03/12
30 +# as of 2012/03/12 and also implements some more recent features
31 #
32
33 DRYRUN=0
34 @@ -44,6 +46,17 @@ dryrun_or_real() {
35 $dryrun "$@"
36 }
37
38 +_chattr() {
39 + local attr="$2"
40 + case $attr in
41 + [+-=]*) : ;;
42 + '') return ;;
43 + *) attr="+$attr" ;;
44 + esac
45 + local IFS=
46 + dryrun_or_real chattr $1 "$attr" -- $3
47 +}
48 +
49 relabel() {
50 local path
51 local paths=$1 mode=$2 uid=$3 gid=$4
52 @@ -163,6 +176,37 @@ _v() {
53 _d "$@"
54 }
55
56 +_q() {
57 + # Similar to _v. However, make sure that the subvolume will be assigned
58 + # to the same higher-level quota groups as the subvolume it has
59 + # been created in.
60 + # TODO: Implement btrfs subvol creation.
61 + _d "$@"
62 +}
63 +
64 +_Q() {
65 + # Similar to q. However, instead of copying the higher-level quota
66 + # group assignments from the parent as-is, the lowest quota group
67 + # of the parent subvolume is determined that is not the
68 + # leaf quota group.
69 + # TODO: Implement btrfs subvol creation.
70 + _d "$@"
71 +}
72 +
73 +_h() {
74 + # Set file/directory attributes. Lines of this type accept
75 + # shell-style globs in place of normal path names.
76 + # The format of the argument field matches chattr
77 + _chattr '' "$6" "$1"
78 +}
79 +
80 +_H() {
81 + # Recursively set file/directory attributes. Lines of this type accept
82 + # shell-syle globs in place of normal path names.
83 + # Does not follow symlinks
84 + _chattr -R "$6" "$1"
85 +}
86 +
87 _L() {
88 # Create a symlink if it doesn't exist yet
89 local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6
90 @@ -371,7 +415,7 @@ for FILE in $tmpfiles_d ; do
91
92 # whine about invalid entries
93 case $cmd in
94 - f|F|w|d|D|v|p|L|c|C|b|x|X|r|R|z|Z) ;;
95 + f|F|w|d|D|v|p|L|c|C|b|x|X|r|R|z|Z|q|Q|h|H) ;;
96 *) warninvalid ; continue ;;
97 esac