diff --git a/rpmpopt.in b/rpmpopt.in index e4270fd8e2..eabda881d1 100644 --- a/rpmpopt.in +++ b/rpmpopt.in @@ -43,13 +43,17 @@ rpm alias --scripts --qf '\ ' \ --POPTdesc=$"list install/erase scriptlets from package(s)" -rpm alias --setperms -q --qf '[\[ -L %{FILENAMES:shescape} \] || chmod %7{FILEMODES:octal} %{FILENAMES:shescape}\n]' \ +rpm alias --setperms -q --qf '[\[ -L %{FILENAMES:shescape} \] || \ + \[ $((%{FILEFLAGS} & 2#1001000)) != 0 \] && \[ ! -e %{FILENAMES:shescape} \] || \ + chmod %7{FILEMODES:octal} %{FILENAMES:shescape}\n]' \ --pipe "grep -v \(none\) | grep '^. -L ' | sed 's/chmod .../chmod /' | sh" \ --POPTdesc=$"set permissions of files in a package" rpm alias --setugids -q --qf \ - '[ch %{FILEUSERNAME:shescape} %{FILEGROUPNAME:shescape} %{FILENAMES:shescape}\n]' \ - --pipe "(echo 'ch() { chown -h -- \"$1\" \"$3\";chgrp -h -- \"$2\" \"$3\"; }';grep '^ch '|grep -v \(none\))|sh" \ + '[ch %{FILEUSERNAME:shescape} %{FILEGROUPNAME:shescape} %{FILENAMES:shescape} %{FILEFLAGS}\n]' \ + --pipe "(echo 'ch() { \[ $(($4 & 2#1001000)) != 0 \] && \[ ! -e \"$3\" \] || \ + (chown -h -- \"$1\" \"$3\";chgrp -h -- \"$2\" \"$3\";) }'; \ + grep '^ch '|grep -v \(none\))|sh" \ --POPTdesc=$"set user/group ownership of files in a package" rpm alias --setcaps -q --qf \