From 647e08eb9166d23d0c64f0c8767d93a06bd21a40 Mon Sep 17 00:00:00 2001 From: Jason Zaman Date: Wed, 6 Aug 2014 02:12:35 +0400 Subject: [PATCH] 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 --- sh/tmpfiles.sh.in | 19 ++++++++----------- 1 file 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 }