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.
This commit is contained in:
Martin Väth 2016-05-25 11:03:12 +02:00 committed by William Hubbs
parent 3092e310ac
commit 0c229faf7e

View File

@ -10,8 +10,10 @@
# http://projects.archlinux.org/initscripts.git/tree/arch-tmpfiles # http://projects.archlinux.org/initscripts.git/tree/arch-tmpfiles
# #
# See the tmpfiles.d manpage as well: # 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 # 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 DRYRUN=0
@ -44,6 +46,17 @@ dryrun_or_real() {
$dryrun "$@" $dryrun "$@"
} }
_chattr() {
local attr="$2"
case $attr in
[+-=]*) : ;;
'') return ;;
*) attr="+$attr" ;;
esac
local IFS=
dryrun_or_real chattr $1 "$attr" -- $3
}
relabel() { relabel() {
local path local path
local paths=$1 mode=$2 uid=$3 gid=$4 local paths=$1 mode=$2 uid=$3 gid=$4
@ -163,6 +176,37 @@ _v() {
_d "$@" _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() { _L() {
# Create a symlink if it doesn't exist yet # Create a symlink if it doesn't exist yet
local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6 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 # whine about invalid entries
case $cmd in 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 ;; *) warninvalid ; continue ;;
esac esac