Created
April 27, 2015 06:48
-
-
Save mirekfranc/572100d91b11a70d7cdd to your computer and use it in GitHub Desktop.
How to restore file based capabilities and file permissions from rpm
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# capabilities | |
rpm2cpio ../iputils-20121221-5.fc20.x86_64.rpm | cpio -ivd | |
rpm -qp --filecaps ../iputils-20121221-5.fc20.x86_64.rpm | grep '=' | awk '{ print "[ -L " $1 " ] || " "setcap " $3 " " "." $1; }' | bash | |
# permissions | |
rpm2cpio ../sudo-1.8.8-1.fc20.x86_64.rpm | cpio -ivd | |
rpm -qp --qf '[\[ -L %{FILENAMES:shescape} \] || chmod %7{FILEMODES:octal} %{FILENAMES:shescape}\n]' ../sudo-1.8.8-1.fc20.x86_64.rpm | sed -e "s|chmod ...|chmod |" -e "s|'/|'./|g" | bash |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment