Last active
January 11, 2017 09:02
-
-
Save mAster-rAdio/0e9a4f482cfd6ad2b6913bf091088c5e to your computer and use it in GitHub Desktop.
fork from patones/XenServer-Patcher-bash, exclude download list & sort list
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/sh | |
base_dir=`dirname $0` | |
patch_list="${base_dir}/patch_list.txt" | |
cd ${base_dir} | |
cat ${patch_list} | while read name url time uuid; do | |
# Save some typing | |
export short_url=`basename ${url}` | |
# Check to see if the patch has been installed already | |
if [ -n "`xe patch-list name-label=${name} 2> /dev/null`" ]; then | |
echo "${name} has aleady been installed" | |
else | |
# Check to see if the file already exists | |
if [ -f "${short_url}" ]; then | |
# Skips the file | |
echo "${short_url} already exists skipping download" | |
/bin/rm -f ${name}-src-pkgs.tar.* ${name}.xsupdate | |
xe patch-pool-clean uuid=${uuid} | |
xe patch-clean uuid=${uuid} | |
else | |
# Downloads the file and unzip it | |
echo "Downloading ${short_url}" | |
curl -#kLR "${url}" -o "${short_url}" | |
echo "Download Completed" | |
fi | |
# Unzip | |
echo "Unziping ${short_url}" | |
unzip -oq ${short_url} | |
# Upload to Xen Server | |
echo "Uploading to Xen Server" | |
xe patch-upload file-name=${name}.xsupdate | |
echo "Applying Patch" | |
xe patch-pool-apply uuid=${uuid} | |
echo "Verifying Installation" | |
if [ -n "`xe patch-list name-label=${name} 2> /dev/null`" ]; then | |
# Removing src xsupdate and cleaning with patch clean | |
echo "${name} has been installed successfully" | |
echo "Removing installation files" | |
/bin/rm -f ${name}-src-pkgs.tar.* ${name}.xsupdate | |
xe patch-pool-clean uuid=${uuid} | |
xe patch-clean uuid=${uuid} | |
else | |
echo "${name} Failed to Install please check it manually. Please fix the issue and run this program again" | |
# Remove patch for you to fix the issue and try again | |
/bin/rm -fr "/opt/xensource/patch-backup/${time}" | |
exit 0 | |
fi | |
fi | |
done |
[TODO]
- Checking md5sum
- get ctx* page by curl and grep
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Patching order