From 7ee603374ef65a7458fcc4ae7f9f7da899df5abe Mon Sep 17 00:00:00 2001 From: deajan Date: Sat, 25 Jan 2025 14:15:33 +0100 Subject: [PATCH] upgrade_client: Add missing variable substitution --- examples/upgrade_server/upgrade_script.cmd | 11 ++++++----- examples/upgrade_server/upgrade_script.sh | 16 +++++++++------- npbackup/upgrade_client/upgrader.py | 1 + 3 files changed, 16 insertions(+), 12 deletions(-) diff --git a/examples/upgrade_server/upgrade_script.cmd b/examples/upgrade_server/upgrade_script.cmd index 158add2..6f1c874 100644 --- a/examples/upgrade_server/upgrade_script.cmd +++ b/examples/upgrade_server/upgrade_script.cmd @@ -1,11 +1,12 @@ :: Example upgrade script for NPBackup that will be pushed server side :: The following variables will be overwritten by the upgrade process -:: {CURRENT_DIR} - The current directory of the distribution -:: {backup_dist} - A directory where we try to move / copy the current distribution -:: {upgrade_dist} - The directory where the new distribution is extracted to after download -:: {log_file} - The log file where the output of this script will be written -:: {original_args} - The arguments that were passed to the upgrade script +:: {CURRENT_DIR} - The current directory of the distribution +:: {backup_dist} - A directory where we try to move / copy the current distribution +:: {upgrade_dist} - The directory where the new distribution is extracted to after download +:: {downloaded_archive} - The path to the downloaded archive +:: {log_file} - The log file where the output of this script will be written +:: {original_args} - The arguments that were passed to the upgrade script :: Also, I really HATE batch files, from the bottom of my programmer heart :: Every try to write a one-liner batch with some variables and perhaps if statements ? diff --git a/examples/upgrade_server/upgrade_script.sh b/examples/upgrade_server/upgrade_script.sh index ef5a98e..ca0e825 100644 --- a/examples/upgrade_server/upgrade_script.sh +++ b/examples/upgrade_server/upgrade_script.sh @@ -1,11 +1,13 @@ -:: Example upgrade script for NPBackup that will be pushed server side +#/usr/bin/env bash +# Example upgrade script for NPBackup that will be pushed server side -:: The following variables will be overwritten by the upgrade process -:: {CURRENT_DIR} - The current directory of the distribution -:: {backup_dist} - A directory where we try to move / copy the current distribution -:: {upgrade_dist} - The directory where the new distribution is extracted to after download -:: {log_file} - The log file where the output of this script will be written -:: {original_args} - The arguments that were passed to the upgrade script +# The following variables will be overwritten by the upgrade process +# {CURRENT_DIR} - The current directory of the distribution +# {backup_dist} - A directory where we try to move / copy the current distribution +# {upgrade_dist} - The directory where the new distribution is extracted to after download +# {downloaded_archive} - The path to the downloaded archive +# {log_file} - The log file where the output of this script will be written +# {original_args} - The arguments that were passed to the upgrade script echo "Launching upgrade" >> "{log_file}" 2>&1 diff --git a/npbackup/upgrade_client/upgrader.py b/npbackup/upgrade_client/upgrader.py index a08dab1..2c43c09 100644 --- a/npbackup/upgrade_client/upgrader.py +++ b/npbackup/upgrade_client/upgrader.py @@ -333,6 +333,7 @@ def auto_upgrader( .replace("{CURRENT_DIR}", CURRENT_DIR) .replace("{CURRENT_EXECUTABLE}", CURRENT_EXECUTABLE) .replace("{upgrade_dist}", upgrade_dist) + .replace("{downloaded_archive}", downloaded_archive) .replace("{backup_dist}", backup_dist) .replace("{log_file}", log_file) .replace("{original_args}", original_args)