teknoraver / rpms / rpm

Forked from rpms/rpm 3 months ago
Clone

Blame SOURCES/rpm-4.11.x-setcaps.patch

dac7c0
--- rpm-4.11.3/rpmpopt.in.old	2019-01-02 13:14:10.222068485 +0100
dac7c0
+++ rpm-4.11.3/rpmpopt.in	2019-01-02 13:36:46.212326391 +0100
dac7c0
@@ -52,6 +52,25 @@
dac7c0
         --pipe "(echo 'ch() { chown -h -- \"$1\" \"$3\";chgrp -h -- \"$2\" \"$3\"; }';grep '^ch '|grep -v \(none\))|sh" \
dac7c0
 	--POPTdesc=$"set user/group ownership of files in a package"
dac7c0
 
dac7c0
+
dac7c0
+rpm	alias --setcaps -q --qf \
dac7c0
+        "[if \[ -f %{FILENAMES:shescape} -a ! -L %{FILENAMES:shescape} \]; then\n\
dac7c0
+%|FILECAPS?{  if \[ -n %{FILECAPS:shescape} \]; then\n\
dac7c0
+    setcap %{FILECAPS:shescape} %{FILENAMES:shescape}\n\
dac7c0
+  el}:{  }|if \[ -n \"\$(getcap %{FILENAMES:shescape})\" \]; then\n\
dac7c0
+    setcap -r %{FILENAMES:shescape}\n\
dac7c0
+  fi\n\
dac7c0
+fi\n]" \
dac7c0
+    --pipe "sh" \
dac7c0
+    --POPTdesc=$"set capabilities of files in a package"
dac7c0
+
dac7c0
+rpm	alias --restore -q --qf \
dac7c0
+    '[  rpm --setugids %{NAME:shescape}; \
dac7c0
+        rpm --setperms %{NAME:shescape}; \
dac7c0
+        rpm --setcaps  %{NAME:shescape}; \n]' --pipe "sh" \
dac7c0
+    --POPTdesc=$"restore file/directory permissions"
dac7c0
+
dac7c0
+
dac7c0
 rpm	alias --conflicts	--qf \
dac7c0
   "[%|VERBOSE?{%{CONFLICTFLAGS:deptype}: }:{}|%{CONFLICTNEVRS}\n]" \
dac7c0
 	--POPTdesc=$"list capabilities this package conflicts with"