Compare commits

..

1 Commits

Author SHA1 Message Date
causefx
49588191b6 Merge 7e4d16d018 into 4d8fa8058c 2023-09-28 11:56:53 -07:00

View File

@@ -1450,13 +1450,6 @@ GetLatestRelease() {
DownloadAndUpdate() { DownloadAndUpdate() {
url="$1" url="$1"
filename="$2" filename="$2"
# Check if script path is writable
if [ ! -w "$ScriptWorkingDirectory" ]; then
Output "Script path is not writable."
exit 2
fi
# Download the file and check if the download was successful # Download the file and check if the download was successful
if curl -s "$url" --output "$filename"; then if curl -s "$url" --output "$filename"; then
Output "Update downloaded successfully" Output "Update downloaded successfully"
@@ -1611,7 +1604,7 @@ do
echo " 11 - 'status' - Report status of PMS (run-state and databases)" echo " 11 - 'status' - Report status of PMS (run-state and databases)"
echo " 12 - 'undo' - Undo last successful command" echo " 12 - 'undo' - Undo last successful command"
echo "" echo ""
echo " 98 - 'update' - Check for script update" echo " 00 - 'update' - Check for script update"
echo " 99 - 'quit' - Quit immediately. Keep all temporary files." echo " 99 - 'quit' - Quit immediately. Keep all temporary files."
echo " 'exit' - Exit with cleanup options." echo " 'exit' - Exit with cleanup options."
fi fi
@@ -1913,27 +1906,22 @@ do
DoUndo DoUndo
;; ;;
98|upda*) 00|update)
DoUpdate=0 Output "Checking for script update"
Output "Checking for script update" GetLatestRelease
GetLatestRelease if [ $LatestVersion != $Version ]; then
if [ $LatestVersion != $Version ] && ([ $Scripted -eq 1 ] || ConfirmYesNo "Download and update script?"); then Output "Version update available"
DoUpdate=1 if ConfirmYesNo "Download and update script?"; then
Output "Version update available"
else
Output "No update available"
fi
if [ $DoUpdate -eq 1 ]; then
Output "Performing update"
DownloadAndUpdate "https://raw.githubusercontent.com/ChuckPa/PlexDBRepair/master/DBRepair.sh" "$ScriptWorkingDirectory/$ScriptName" DownloadAndUpdate "https://raw.githubusercontent.com/ChuckPa/PlexDBRepair/master/DBRepair.sh" "$ScriptWorkingDirectory/$ScriptName"
exit 0 exit 0
else
Output "Download aborted"
fi fi
if [ $Scripted -eq 1 ]; then else
exit 0 Output "No update available"
fi fi
;; ;;
# Quit # Quit