Skip to content

Instantly share code, notes, and snippets.

@liyang85
Created December 3, 2017 13:44
Show Gist options
  • Save liyang85/6ca6d7ab88ad61a14bca79fd7dbcab14 to your computer and use it in GitHub Desktop.
Save liyang85/6ca6d7ab88ad61a14bca79fd7dbcab14 to your computer and use it in GitHub Desktop.
must use rpm2cpio and cpio, or no other way can do this.
# find the target file in the package
rpm2cpio httpd-2.2.15-59.el6.centos.x86_64.rpm | cpio -tv | grep "init.d/httpd"
# view content of the target file then redirect it
rpm2cpio httpd-2.2.15-59.el6.centos.x86_64.rpm | cpio -i --to-stdout ./etc/rc.d/init.d/httpd > /etc/rc.d/init.d/httpd
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment