Go to:
Gentoo Home
Documentation
Forums
Lists
Bugs
Planet
Store
Wiki
Get Gentoo!
Gentoo's Bugzilla – Attachment 516054 Details for
Bug 617580
sys-apps/opentmpfiles-0.1.3: keywording for non-Linux systems
Home
|
New
–
[Ex]
|
Browse
|
Search
|
Privacy Policy
|
[?]
|
Reports
|
Requests
|
Help
|
New Account
|
Log In
[x]
|
Forgot Password
Login:
[x]
[patch]
patch for opentmpfiles-9999 to support Prefix
0001-Support-installing-into-EPREFIX.patch (text/plain), 11.81 KB, created by
Michael Haubenwallner (RETIRED)
on 2018-01-23 15:45:55 UTC
(
hide
)
Description:
patch for opentmpfiles-9999 to support Prefix
Filename:
MIME Type:
Creator:
Michael Haubenwallner (RETIRED)
Created:
2018-01-23 15:45:55 UTC
Size:
11.81 KB
patch
obsolete
>From 6bdde971266fa7911066556af811e0be1fe8dfd7 Mon Sep 17 00:00:00 2001 >From: Michael Haubenwallner <haubi@fril0049.wamas.com> >Date: Tue, 23 Jan 2018 16:27:41 +0100 >Subject: [PATCH] Support installing into EPREFIX. > >--- > Makefile | 27 +++++++-- > tmpfiles => tmpfiles.in | 142 ++++++++++++++++++++++++++---------------------- > 2 files changed, 98 insertions(+), 71 deletions(-) > rename tmpfiles => tmpfiles.in (76%) > >diff --git a/Makefile b/Makefile >index 778cbc2..7ea9cd3 100644 >--- a/Makefile >+++ b/Makefile >@@ -1,12 +1,27 @@ >+EPREFIX ?= > binprogs = tmpfiles >-bindir = /bin >+bindir = $(EPREFIX)/bin > binmode = 0755 > install = install > >-all: >+SOURCES = $(binprogs) > >-install: >- $(install) -d $(DESTDIR)$(bindir) >- $(install) -m $(binmode) $(binprogs) $(DESTDIR)$(bindir) >+all: $(SOURCES) > >-.PHONY: all install >+install: $(SOURCES) >+ $(install) -d "$(DESTDIR)$(bindir)" >+ $(install) -m $(binmode) $(binprogs) "$(DESTDIR)$(bindir)" >+ >+clean: >+ >+distclean: >+ rm -f $(SOURCES) >+ >+.PHONY: all install clean distclean >+ >+$(SOURCES): Makefile >+ >+%: %.in >+ sed -e \ >+ 's^@EPREFIX@^$(EPREFIX)^g' \ >+ > $@ < $< >diff --git a/tmpfiles b/tmpfiles.in >similarity index 76% >rename from tmpfiles >rename to tmpfiles.in >index 66b50f4..d4b405b 100755 >--- a/tmpfiles >+++ b/tmpfiles.in >@@ -16,6 +16,7 @@ > # as of 2012/03/12 and also implements some more recent features > # > >+EPREFIX="@EPREFIX@" > DRYRUN=0 > > checkprefix() { >@@ -55,7 +56,7 @@ _chattr() { > *) attr="+$attr" ;; > esac > local IFS= >- dryrun_or_real chattr $1 "$attr" -- $3 >+ dryrun_or_real chattr $1 "$attr" -- "$EPREFIX$3" > } > > relabel() { >@@ -65,30 +66,30 @@ relabel() { > > status=0 > for path in ${paths}; do >- if [ -e "$path" ]; then >- if [ -x /sbin/restorecon ]; then >- dryrun_or_real restorecon $CHOPTS "$path" >+ if [ -e "$EPREFIX$path" ]; then >+ if [ -x "$EPREFIX"/sbin/restorecon ]; then >+ dryrun_or_real "$EPREFIX"/sbin/restorecon $CHOPTS "$EPREFIX$path" > x=$? > if [ $x -ne 0 ]; then > status=$x > fi > fi > if [ $uid != '-' ]; then >- dryrun_or_real chown $CHOPTS "$uid" "$path" >+ dryrun_or_real chown $CHOPTS "$uid" "$EPREFIX$path" > x=$? > if [ $x -ne 0 ]; then > status=$x > fi > fi > if [ $gid != '-' ]; then >- dryrun_or_real chgrp $CHOPTS "$gid" "$path" >+ dryrun_or_real chgrp $CHOPTS "$gid" "$EPREFIX$path" > x=$? > if [ $x -ne 0 ]; then > status=$x > fi > fi > if [ $mode != '-' ]; then >- dryrun_or_real chmod $CHOPTS "$mode" "$path" >+ dryrun_or_real chmod $CHOPTS "$mode" "$EPREFIX$path" > x=$? > if [ $x -ne 0 ]; then > status=$x >@@ -99,24 +100,24 @@ relabel() { > return $status > } > >-splitpath() { >- local path=$1 >+splitpath_quoted() { >+ local path=$1 EPREFIX=$2 > while [ -n "$path" ]; do >- echo $path >+ echo "\'$EPREFIX$path\'" > path=${path%/*} > done > } > > _restorecon() { >- local path=$1 >- if [ -x /sbin/restorecon ]; then >- dryrun_or_real restorecon -F $(splitpath "$path") >+ local path=$1 p >+ if [ -x "$EPREFIX"/sbin/restorecon ]; then >+ eval "dryrun_or_real '$EPREFIX/sbin/restorecon' -F $(splitpath_quoted "$path" "$EPREFIX")" > fi > } > > createdirectory() { > local mode="$1" uid="$2" gid="$3" path="$4" >- dryrun_or_real mkdir -p "$path" >+ dryrun_or_real mkdir -p "$EPREFIX$path" > if [ "$uid" = - ]; then > uid=root > fi >@@ -126,14 +127,14 @@ createdirectory() { > if [ "$mode" = - ]; then > mode=0755 > fi >- dryrun_or_real chown $uid "$path" >- dryrun_or_real chgrp $gid "$path" >- dryrun_or_real chmod $mode "$path" >+ dryrun_or_real chown $uid "$EPREFIX$path" >+ dryrun_or_real chgrp $gid "$EPREFIX$path" >+ dryrun_or_real chmod $mode "$EPREFIX$path" > } > > createfile() { > local mode="$1" uid="$2" gid="$3" path="$4" >- dryrun_or_real touch "$path" >+ dryrun_or_real touch "$EPREFIX$path" > if [ "$uid" = - ]; then > uid=root > fi >@@ -143,14 +144,14 @@ createfile() { > if [ "$mode" = - ]; then > mode=0644 > fi >- dryrun_or_real chown $uid "$path" >- dryrun_or_real chgrp $gid "$path" >- dryrun_or_real chmod $mode "$path" >+ dryrun_or_real chown $uid "$EPREFIX$path" >+ dryrun_or_real chgrp $gid "$EPREFIX$path" >+ dryrun_or_real chmod $mode "$EPREFIX$path" > } > > createpipe() { > local mode="$1" uid="$2" gid="$3" path="$4" >- dryrun_or_real mkfifo "$path" >+ dryrun_or_real mkfifo "$EPREFIX$path" > if [ "$uid" = - ]; then > uid=root > fi >@@ -160,9 +161,9 @@ createpipe() { > if [ "$mode" = - ]; then > mode=0644 > fi >- dryrun_or_real chown $uid "$path" >- dryrun_or_real chgrp $gid "$path" >- dryrun_or_real chmod $mode "$path" >+ dryrun_or_real chown $uid "$EPREFIX$path" >+ dryrun_or_real chgrp $gid "$EPREFIX$path" >+ dryrun_or_real chmod $mode "$EPREFIX$path" > } > > _b() { >@@ -177,11 +178,11 @@ _b() { > if [ "$mode" = - ]; then > mode=0644 > fi >- if [ ! -e "$path" ]; then >- dryrun_or_real mknod -m $mode $path b ${arg%:*} ${arg#*:} >+ if [ ! -e "$EPREFIX$path" ]; then >+ dryrun_or_real mknod -m $mode "$EPREFIX$path" b ${arg%:*} ${arg#*:} > _restorecon "$path" >- dryrun_or_real chown $uid "$path" >- dryrun_or_real chgrp $gid "$path" >+ dryrun_or_real chown $uid "$EPREFIX$path" >+ dryrun_or_real chgrp $gid "$EPREFIX$path" > fi > } > >@@ -197,28 +198,28 @@ _c() { > if [ "$mode" = - ]; then > mode=0644 > fi >- if [ ! -e "$path" ]; then >- dryrun_or_real mknod -m $mode $path c ${arg%:*} ${arg#*:} >+ if [ ! -e "$EPREFIX$path" ]; then >+ dryrun_or_real mknod -m $mode "$EPREFIX$path" c ${arg%:*} ${arg#*:} > _restorecon "$path" >- dryrun_or_real chown $uid "$path" >- dryrun_or_real chgrp $gid "$path" >+ dryrun_or_real chown $uid "$EPREFIX$path" >+ dryrun_or_real chgrp $gid "$EPREFIX$path" > fi > } > > _C() { > # recursively copy a file or directory > local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6 >- if [ ! -e "$path" ]; then >- dryrun_or_real cp -r "$arg" "$path" >+ if [ ! -e "$EPREFIX$path" ]; then >+ dryrun_or_real cp -r "$arg" "$EPREFIX$path" > _restorecon "$path" > if [ $uid != '-' ]; then >- dryrun_or_real chown "$uid" "$path" >+ dryrun_or_real chown "$uid" "$EPREFIX$path" > fi > if [ $gid != '-' ]; then >- dryrun_or_real chgrp "$gid" "$path" >+ dryrun_or_real chgrp "$gid" "$EPREFIX$path" > fi > if [ $mode != '-']; then >- dryrun_or_real chmod "$mode" "$path" >+ dryrun_or_real chmod "$mode" "$EPREFIX$path" > fi > fi > } >@@ -229,7 +230,7 @@ _f() { > > [ $CREATE -gt 0 ] || return 0 > >- if [ ! -e "$path" ]; then >+ if [ ! -e "$EPREFIX$path" ]; then > createfile "$mode" "$uid" "$gid" "$path" > if [ -n "$arg" ]; then > _w "$@" >@@ -243,7 +244,7 @@ _F() { > > [ $CREATE -gt 0 ] || return 0 > >- dryrun_or_real rm -f "$path" >+ dryrun_or_real rm -f "$EPREFIX$path" > createfile "$mode" "$uid" "$gid" "$path" > if [ -n "$arg" ]; then > _w "$@" >@@ -256,7 +257,7 @@ _d() { > > [ $CREATE -gt 0 ] || return 0 > >- if [ ! -d "$path" ]; then >+ if [ ! -d "$EPREFIX$path" ]; then > createdirectory "$mode" "$uid" "$gid" "$path" > _restorecon "$path" > fi >@@ -266,8 +267,8 @@ _D() { > # Create or empty a directory > local path=$1 mode=$2 uid=$3 gid=$4 > >- if [ -d "$path" ] && [ $REMOVE -gt 0 ]; then >- dryrun_or_real find "$path" -mindepth 1 -maxdepth 1 -xdev -exec rm -rf {} + >+ if [ -d "$EPREFIX$path" ] && [ $REMOVE -gt 0 ]; then >+ dryrun_or_real find "$EPREFIX$path" -mindepth 1 -maxdepth 1 -xdev -exec rm -rf {} + > _restorecon "$path" > fi > >@@ -318,8 +319,8 @@ _H() { > _L() { > # Create a symlink if it doesn't exist yet > local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6 >- if [ ! -e "$path" ]; then >- dryrun_or_real ln -s "$arg" "$path" >+ if [ ! -e "$EPREFIX$path" ]; then >+ dryrun_or_real ln -s "$arg" "$EPREFIX$path" > fi > _restorecon "$path" > } >@@ -330,7 +331,7 @@ _p() { > > [ $CREATE -gt 0 ] || return 0 > >- if [ ! -p "$path" ]; then >+ if [ ! -p "$EPREFIX$path" ]; then > createpipe "$mode" "$uid" "$gid" "$path" > fi > } >@@ -366,10 +367,10 @@ _r() { > > status=0 > for path in ${paths}; do >- if [ -f "$path" ]; then >- dryrun_or_real rm -f "$path" >- elif [ -d "$path" ]; then >- dryrun_or_real rmdir "$path" >+ if [ -f "$EPREFIX$path" ]; then >+ dryrun_or_real rm -f "$EPREFIX$path" >+ elif [ -d "$EPREFIX$path" ]; then >+ dryrun_or_real rmdir "$EPREFIX$path" > fi > x=$? > if [ $x -ne 0 ]; then >@@ -390,8 +391,8 @@ _R() { > > status=0 > for path in ${paths}; do >- if [ -d "$path" ]; then >- dryrun_or_real rm -rf --one-file-system "$path" >+ if [ -d "$EPREFIX$path" ]; then >+ dryrun_or_real rm -rf --one-file-system "$EPREFIX$path" > x=$? > if [ $x -ne 0 ]; then > status=$x >@@ -404,11 +405,11 @@ _R() { > _w() { > # Write the argument parameter to a file, if it exists. > local path=$1 mode=$2 uid=$3 gid=$4 age=$5 arg=$6 >- if [ -f "$path" ]; then >+ if [ -f "$EPREFIX$path" ]; then > if [ $DRYRUN -eq 1 ]; then >- echo "echo \"$arg\" >>\"$path\"" >+ echo "echo \"$arg\" >>\"$EPREFIX$path\"" > else >- echo "$arg" >>"$path" >+ echo "$arg" >>"$EPREFIX$path" > fi > fi > } >@@ -437,6 +438,8 @@ PREFIX= > FILES= > > while [ $# -gt 0 ]; do >+ # File system (*-prefix=) arguments do not need to contain the EPREFIX, >+ # we will stick them to within the EPREFIX anyway. > case $1 in > --boot) BOOT=1 ;; > --create) CREATE=1 ;; >@@ -444,10 +447,10 @@ while [ $# -gt 0 ]; do > --clean) CLEAN=1 ;; # TODO: Not implemented > --verbose) VERBOSE=1 ;; > --dryrun|--dry-run) DRYRUN=1 ;; >- --exclude-prefix=*) EXCLUDE="${EXCLUDE}${1##--exclude-prefix=} " ;; >- --prefix=*) PREFIX="${PREFIX}${1##--prefix=} " ;; >+ --exclude-prefix=*) arg=${1##--exclude-prefix=}; EXCLUDE="${EXCLUDE}${arg#$EPREFIX} " ;; >+ --prefix=*) arg=${1##--prefix=}; PREFIX="${PREFIX}${arg#$EPREFIX} " ;; > -*) invalid_option "$1" ;; >- *) FILES="${FILES} $1" >+ *) FILES="${FILES} ${1#$EPREFIX}" > esac > shift > done >@@ -473,11 +476,11 @@ if [ -z "${FILES}" ]; then > # `/etc/tmpfiles.d/foo.conf' supersedes `/usr/lib/tmpfiles.d/foo.conf'. > # `/run/tmpfiles/foo.conf' will always be read after `/etc/tmpfiles.d/bar.conf' > for d in ${tmpfiles_dirs} ; do >- [ -d $d ] && for f in ${d}/*.conf ; do >+ [ -d "$EPREFIX"$d ] && for f in "$EPREFIX"${d}/*.conf ; do > case "${f##*/}" in > systemd.conf|systemd-*.conf) continue;; > esac >- [ -f $f ] && tmpfiles_basenames="${tmpfiles_basenames}\n${f##*/}" >+ [ -f "$f" ] && tmpfiles_basenames="${tmpfiles_basenames}\n${f##*/}" > done # for f in ${d} > done # for d in ${tmpfiles_dirs} > FILES="$(printf "${tmpfiles_basenames}\n" | sort -u )" >@@ -488,15 +491,16 @@ tmpfiles_d='' > for b in ${FILES} ; do > if [ "${b##*/}" != "${b}" ]; then > # The user specified a path on the command line >- # Just pass it through unaltered >- tmpfiles_d="${tmpfiles_d} ${b}" >+ # Just pass it through unaltered (without the optional EPREFIX) >+ tmpfiles_d="${tmpfiles_d} ${b#$EPREFIX}" > else > real_f='' > for d in $tmpfiles_dirs ; do >+ d=$d > f=${d}/${b} >- [ -f "${f}" ] && real_f=$f >+ [ -f "$EPREFIX${f}" ] && real_f=$f > done >- [ -f "${real_f}" ] && tmpfiles_d="${tmpfiles_d} ${real_f}" >+ [ -f "$EPREFIX${real_f}" ] && tmpfiles_d="${tmpfiles_d} ${real_f}" > fi > done > >@@ -515,6 +519,8 @@ for FILE in $tmpfiles_d ; do > # d /run/user 0755 root root 10d - > # Mode, UID, GID, Age, Argument may be omitted! > # If Cmd ends with !, the line is only processed if --boot is passed >+ # Path must not contain the EPREFIX, it is prepended within EPREFIX. >+ # However, Argument must contain the EPREFIX if appropriate. > > # 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. >@@ -531,6 +537,12 @@ for FILE in $tmpfiles_d ; do > \#*) continue ;; > esac > >+ # Reject Path with EPREFIX, we fail to parse blanks anyway. >+ # For Argument, as the last one parsed, blanks should work. >+ if [ "${path#$EPREFIX}" != $path ]; then >+ warninvalid ; continue >+ fi >+ > while [ ${#cmd} -gt 1 ]; do > case $cmd in > *!) cmd=${cmd%!}; [ "$BOOT" -eq "1" ] || continue 2 ;; >@@ -575,7 +587,7 @@ for FILE in $tmpfiles_d ; do > if [ "${DRYRUN}" -eq "0" ]; then > [ $rc -ne 0 ] && error=$((error + 1)) > fi >- done <$FILE >+ done <"$EPREFIX"$FILE > done > > exit $error >-- >2.16.1 >
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Actions:
View
|
Diff
Attachments on
bug 617580
: 516054