teknoraver / rpms / rpm

Forked from rpms/rpm 3 months ago
Clone

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

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