Last active
November 17, 2015 21:16
-
-
Save brandonweeks/86bfcc092cc93f650c92 to your computer and use it in GitHub Desktop.
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 | |
# | |
# generate patches with the following command (zsh): | |
# git checkout 1.10-square | |
# git format-patch upstream/1.10-stable ^test | |
# then copy .patch files to this folder | |
# set FOREMAN_VERSION the exact version the patches were based from | |
# | |
FOREMAN_VERSION='1.10.0-0.1.RC3' | |
#### | |
set -e | |
el_version=$(lsb_release -rs | cut -f1 -d.) | |
FOREMAN_VERSION="${FOREMAN_VERSION}.el${el_version}" | |
installed_version=$(yum -q list installed foreman | awk '(NR >=2) {print $2;}') | |
latest_version=$(yum -q list available foreman | awk '(NR >=2) {print $2;}') | |
if [ "$FOREMAN_VERSION" == "$installed_version" ]; then | |
echo "Reinstalling foreman-${FOREMAN_VERSION}" | |
yum reinstall -y foreman-"${FOREMAN_VERSION}" | |
elif [ "$FOREMAN_VERSION" == "$latest_version" ]; then | |
echo "Upgrading to foreman-${latest_version}" | |
yum update -y foreman-"${latest_version}" | |
else | |
echo "Version ${FOREMAN_VERSION} doesn't match installed (${installed_version}) or latest (${latest_version})" | |
echo "Exiting..." | |
exit 1 | |
fi | |
for p in *.patch; do | |
git apply -v --directory=/usr/share/foreman "$p" | |
done | |
service httpd restart |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment