summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrew Gregory <andrew.gregory.8@gmail.com>2012-10-11 14:34:20 -0400
committerWilliam Hubbs <w.d.hubbs@gmail.com>2012-10-22 00:12:27 -0500
commitaa34435cc8c17618facb6e68c8380f0026d79b8e (patch)
tree2015bd6776474880a71a5d30573a8c244cfe4cd1
parent68f8e8aac289448a31881b81357ea9fb0e8ddde4 (diff)
downloadopenrc-aa34435cc8c17618facb6e68c8380f0026d79b8e.tar.gz
openrc-aa34435cc8c17618facb6e68c8380f0026d79b8e.tar.bz2
openrc-aa34435cc8c17618facb6e68c8380f0026d79b8e.tar.xz
tmpfilesd: parse arguments with spaces
systemd allows the final arg in tmpfiles to contain spaces. Using the read() call to set the variables includes all trailing components in $arg so it doesn't get cut off. Signed-off-by: Andrew Gregory <andrew.gregory.8@gmail.com>
-rwxr-xr-xsh/tmpfiles.sh.in32
1 files changed, 10 insertions, 22 deletions
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in
index 57cedbe..ae7b7ca 100755
--- a/sh/tmpfiles.sh.in
+++ b/sh/tmpfiles.sh.in
@@ -253,46 +253,34 @@ for FILE in $tmpfiles_d ; do
# XXX: Upstream says whitespace is NOT permitted in the Path argument.
# But IS allowed when globs are expanded for the x/r/R/z/Z types.
- while read line; do
+ while read cmd path mode uid gid age arg; do
LINENUM=$(( LINENUM+1 ))
- # This will skip over comments and empty lines
- set -- $line
-
# Unless we have both command and path, skip this line.
- if [ -z "$1" -o -z "$2" ]; then
+ if [ -z "$cmd" -o -z "$path" ]; then
continue
fi
# whine about invalid entries
- case $1 in
+ case $cmd in
f|F|w|d|D|p|L|c|b|x|r|R|z|Z) ;;
\#) continue ;;
*) warninvalid ; continue ;;
esac
- cmd=$1
- path=$2
-
# fall back on defaults when parameters are passed as '-'
- if [ "$3" = '-' -o "$3" = '' ]; then
- case ${1} in
+ if [ "$mode" = '-' -o "$mode" = '' ]; then
+ case "$cmd" in
p|f|F) mode=0644 ;;
d|D) mode=0755 ;;
z|Z|x|r|R|L) ;;
esac
- else
- mode=$3
fi
- uid=$4
- gid=$5
- age=$6
- arg=$7
-
- [ "${4}" = '-' -o "${4}" = '' ] && uid=0
- [ "${5}" = '-' -o "${5}" = '' ] && gid=0
- [ "${6}" = '-' -o "${6}" = '' ] && age=0
- [ "${7}" = '-' -o "${7}" = '' ] && arg=''
+
+ [ "$uid" = '-' -o "$uid" = '' ] && uid=0
+ [ "$gid" = '-' -o "$gid" = '' ] && gid=0
+ [ "$age" = '-' -o "$age" = '' ] && age=0
+ [ "$arg" = '-' -o "$arg" = '' ] && arg=''
set -- "$path" "$mode" "$uid" "$gid" "$age" "$arg"
[ "$VERBOSE" -eq "1" ] && echo _$cmd "$@"