Last active
December 13, 2015 02:46
-
-
Save oglops/24f28d92ad2fce6c1662 to your computer and use it in GitHub Desktop.
rpmrebuild script by gcomes https://www.centos.org/forums/viewtopic.php?f=48&t=49542 remove --target i686 if it's not for 32 bit rpm build
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 | |
EDIT=0 | |
while (($#)) ; do | |
[[ ${1:0:1} != - ]] && break | |
case ${1:1} in | |
e) EDIT=1 ; shift ;; | |
*) echo "Unknown option $1, ignoring" ; shift ;; | |
esac | |
done | |
[[ ! -f $1 ]] && exec echo "file '$1' not found" | |
[[ ${1:0:1} != / ]] && set -- "$PWD/$1" | |
rm -rf $HOME/.rpmmacros rpmbuild | |
mkdir -p rpmbuild/{BUILD,RPMS,SOURCES,SPECS,SRPMS} | |
echo "%_topdir %(echo $PWD)/rpmbuild" > $HOME/.rpmmacros | |
export RPM_BUILD_NCPUS=$(grep -c ^processor /proc/cpuinfo) | |
if ((EDIT)); then | |
cd rpmbuild/SOURCES | |
rpm2cpio "$1" | cpio -i | |
mv *.spec ../SPECS | |
cd ../SPECS | |
vi *.spec | |
rpmbuild -bs *.spec --target i686 | |
rpmbuild -bb *.spec --target i686 | |
else | |
rpmbuild --rebuild "$1" | |
fi | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment