diff options
author | Jason Zaman <jason@perfinion.com> | 2014-08-06 02:12:35 +0400 |
---|---|---|
committer | William Hubbs <w.d.hubbs@gmail.com> | 2014-08-07 12:54:04 -0500 |
commit | 647e08eb9166d23d0c64f0c8767d93a06bd21a40 (patch) | |
tree | 1a563cec522dd897b633acea0417676c8e9ebf24 /sh/tmpfiles.sh.in | |
parent | 2624a8c8a7030180f9548a6e2fba5b0a82c5f046 (diff) |
tmpfiles.sh: do not use install
install is in /usr which causes problems if /usr is not mounted.
Instead, checkpath and "mkdir -p" can do everything required and are
both available before /usr is mounted.
Since checkpath also handles selinux labels correctly,
_restorecon after is not required.
X-Gentoo-Bug: 503408
X-Gentoo-Bug-URL: https://bugs.gentoo.org/show_bug.cgi?id=503408
Diffstat (limited to 'sh/tmpfiles.sh.in')
-rwxr-xr-x | sh/tmpfiles.sh.in | 19 |
1 files changed, 8 insertions, 11 deletions
diff --git a/sh/tmpfiles.sh.in b/sh/tmpfiles.sh.in index da64011e..63c5d142 100755 --- a/sh/tmpfiles.sh.in +++ b/sh/tmpfiles.sh.in @@ -15,6 +15,7 @@ # DRYRUN=0 +CHECKPATH="@LIBEXECDIR@/bin/checkpath" checkprefix() { n=$1 @@ -87,9 +88,8 @@ _f() { [ $CREATE -gt 0 ] || return 0 if [ ! -e "$path" ]; then - dryrun_or_real install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path" + dryrun_or_real $CHECKPATH -fq -m "$mode" -o "$uid:$gid" "$path" [ -z "$arg" ] || _w "$@" - _restorecon "$path" fi } @@ -99,9 +99,8 @@ _F() { [ $CREATE -gt 0 ] || return 0 - dryrun_or_real install -m"$mode" -o"$uid" -g"$gid" /dev/null "$path" + dryrun_or_real $CHECKPATH -Fq -m "$mode" -o "$uid:$gid" "$path" [ -z "$arg" ] || _w "$@" - _restorecon "$path" } _d() { @@ -111,8 +110,8 @@ _d() { [ $CREATE -gt 0 ] || return 0 if [ ! -d "$path" ]; then - dryrun_or_real install -d -m"$mode" -o"$uid" -g"$gid" "$path" - _restorecon "$path" + dryrun_or_real mkdir -p "$path" 2>/dev/null + dryrun_or_real $CHECKPATH -dq -m "$mode" -o "$uid:$gid" "$path" fi } @@ -126,8 +125,8 @@ _D() { fi if [ $CREATE -gt 0 ]; then - dryrun_or_real install -d -m"$mode" -o"$uid" -g"$gid" "$path" - _restorecon "$path" + dryrun_or_real mkdir -p "$path" 2>/dev/null + dryrun_or_real $CHECKPATH -Dq -m "$mode" -o "$uid:$gid" "$path" fi } @@ -145,9 +144,7 @@ _p() { [ $CREATE -gt 0 ] || return 0 if [ ! -p "$path" ]; then - dryrun_or_real mkfifo -m$mode "$path" - dryrun_or_real chown "$uid:$gid" "$path" - _restorecon "$path" + dryrun_or_real $CHECKPATH -pq -m $mode -o "$uid:$gid" "$path" fi } |