Last active
January 11, 2022 08:38
-
-
Save IMelker/d1d5781ff9599d14a4515f53e7db68fc to your computer and use it in GitHub Desktop.
Download rpm of exact version from yum and unpack it
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
#!/bin/bash | |
BINARY=$1 | |
VER=$2 | |
echo "Find ${BINARY} package with version ${VER}" | |
RPM_VER=`yum -v list ${BINARY} --show-duplicates | grep ${VER} | grep -oP "${VER}-\w{40}"` | |
echo "Founded: ${RPM_VER}" | |
echo "Downloading rpm ${BINARY} with version ${VER}" | |
yum install -y yum-utils | |
yumdownloader -v --downloadonly --downloaddir=./ ${BINARY}-${RPM_VER} | |
echo "Unpacking rpm to ./${BINARY}_${VER}/unpacked" | |
mkdir -p ${BINARY}_${VER}/unpacked | |
mv ./${BINARY}-${VER}* ./${BINARY}_${VER}/ | |
cd ${BINARY}_${VER}/unpacked | |
rpm2cpio ../${BINARY}-${VER}*.rpm | cpio -idmv |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment