Update update_ombi.sh

This commit is contained in:
metalcated 2019-08-15 17:18:22 -04:00 committed by GitHub
parent 93600f0086
commit e2d25a1a2b
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -3,6 +3,7 @@
#################################### ####################################
## update_ombi systemd script ## ## update_ombi systemd script ##
## GitHub: Unimatrix0/update_ombi ## ## GitHub: Unimatrix0/update_ombi ##
## updated by: metalcated ##
#################################### ####################################
#################################### ####################################
@ -195,22 +196,34 @@ declare -i i=1
declare -i j=5 declare -i j=5
while [ $i -le $j ] while [ $i -le $j ]
do do
.log 6 "Checking for latest version" .log 6 "Checking locally installed version"
json=$(curl -sL http://$ip:$port/api/v1/Update/develop) json=$(curl -sL http://$ip:$port/api/v1/Update/develop)
.log 8 "json: $json" .log 8 "json: $json"
latestversion=$(grep -Po '(?<="updateVersionString":")([^"]+)' <<< "$json") localversion=$(grep -Po '(?<="updateVersionString":")([^"]+)' <<< "$json")
.log 7 "latestversion: $latestversion" .log 7 "localversion: $localversion"
if [ -n "$force" ]; then if [ -n "$force" ]; then
latestversion=$force localversion=$force
.log 7 "forcing version: $latestversion" .log 7 "forcing version: $localversion"
fi fi
json=$(curl -sL https://ci.appveyor.com/api/projects/tidusjar/requestplex/build/$latestversion) .log 6 "Checking for latest available version"
json=$(curl -sL https://ci.appveyor.com/api/projects/tidusjar/requestplex)
.log 8 "json: $json"
jobId=$(grep -Po '(?<="jobId":")([^"]+)' <<< "$json")
.log 7 "jobId: $jobId"
latestversion=$(grep -Po '(?<="version":")([^"]+)' <<< "$json")
.log 7 "version: $version"
if [ $latestversion = $localversion ]; then
.log 2 "Latest Available Version: $latestversion and $localversion match, no update needed"
echo "Latest Available Version: $latestversion and $localversion match, no update needed"
exit 1
fi
json=$(curl -sL https://ci.appveyor.com/api/projects/tidusjar/requestplex/build/$localversion)
.log 8 "json: $json" .log 8 "json: $json"
jobId=$(grep -Po '(?<="jobId":")([^"]+)' <<< "$json") jobId=$(grep -Po '(?<="jobId":")([^"]+)' <<< "$json")
.log 7 "jobId: $jobId" .log 7 "jobId: $jobId"
version=$(grep -Po '(?<="version":")([^"]+)' <<< "$json") version=$(grep -Po '(?<="version":")([^"]+)' <<< "$json")
.log 7 "version: $version" .log 7 "version: $version"
if [ $latestversion != $version ]; then if [ $localversion != $version ]; then
.log 2 "Build version does not match expected version" .log 2 "Build version does not match expected version"
exit 1 exit 1
fi fi
@ -280,9 +293,10 @@ else
fi fi
declare -i timestamp=$(date +%s) declare -i timestamp=$(date +%s)
.log 6 "Backing up Ombi.db to Ombi.db.$timestamp" for db in $(ls /etc/Ombi/*.db); do
cp ${installdir}Ombi.db ${installdir}Ombi.db.$timestamp .log 6 "Backing up ${db} ${db}.${timestamp}"
cp -vp {${db},${db}.${timestamp}}
done
unzip-strip $file $installdir unzip-strip $file $installdir
.log 6 "Update installed...setting ownership..." .log 6 "Update installed...setting ownership..."
chown -R $user:$group $installdir chown -R $user:$group $installdir