Reload the script after --redownload

This commit is contained in:
Jiří Štefka 2023-02-27 00:57:15 +01:00
parent 9e2d15238b
commit b017c00a6c

@ -238,8 +238,11 @@ function self_update {
# Make the file executable # Make the file executable
chmod +x msman_new.sh chmod +x msman_new.sh
# Remove the old script # Remove the old script
if [[ -f msman.sh ]]; then
echo "Removing old script..."
rm msman.sh rm msman.sh
echo "Removed old script" echo "Removed old script"
fi
# Rename the new script # Rename the new script
mv msman_new.sh msman.sh mv msman_new.sh msman.sh
echo "Renamed new script" echo "Renamed new script"
@ -460,6 +463,9 @@ function main {
if [[ "$1" == "--redownload" ]] || [[ "$1" == "-r" ]]; then if [[ "$1" == "--redownload" ]] || [[ "$1" == "-r" ]]; then
get_latest_script_release get_latest_script_release
self_update self_update
# Reload the script
exec "$0"
exit 0
# TODO: Add `--edit-config` option # TODO: Add `--edit-config` option
elif [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]]; then elif [[ "$1" == "--help" ]] || [[ "$1" == "-h" ]]; then
echo "Usage: ./script.sh [OPTION]" echo "Usage: ./script.sh [OPTION]"