Last active
December 16, 2016 17:42
-
-
Save brianoflan/9a42a997942d0920dd3eaeb95750e250 to your computer and use it in GitHub Desktop.
Replace Jenkins Plugins (root, chown, chmod, hpi, jpi)
This file contains hidden or 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 | |
# As root: | |
date=`date -u +'%Y%m%dT%H%M%Sz'` ; | |
new=/jenkins/new_plugins ; | |
old="/jenkins/old_plugins_$date" ; | |
j=/var/lib/jenkins ; | |
main() { | |
for d in /jenkins $old $new ; do | |
[[ -e $d ]] || mkdir -p $d ; | |
chown jenkins:centos $d ; | |
chmod g+rwx $d ; | |
done ; | |
set -e ; | |
cd $new ; | |
ls | sed -e 's/[.][jh]pi$//g' | while read p ; do | |
echo $p ; | |
pre=$j/plugins/$p ; | |
for e in $pre $pre.hpi $pre.jpi $pre.bak ; do | |
[[ ! -e $e ]] || mv $e $old/ ; | |
done ; | |
mv $p.* $j/plugins/ ; | |
chown jenkins:centos $j/plugins/$p.* ; | |
done ; | |
set +e ; | |
} | |
main ; | |
# |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment