Skip to content

Commit 57cbe55

Browse files
author
Kristan Kenney
committed
Minor fixes to v-update-sys-hestia-git
Reworked install confirmation switch and clarified warning message. Ensure temporary build files are removed if installation is aborted.
1 parent 92fda42 commit 57cbe55

File tree

1 file changed

+35
-18
lines changed

1 file changed

+35
-18
lines changed

bin/v-update-sys-hestia-git

Lines changed: 35 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -90,19 +90,13 @@ if [ ! -z "$1" ]; then
9090
exit 1
9191
else
9292
/usr/local/hestia/bin/v-change-sys-config-value 'RELEASE_BRANCH' "$branch"
93-
echo "Changed update release branch to $branch from GitHub repository."
93+
echo "Changed release branch to $branch."
9494
fi
9595
else
9696
source /usr/local/hestia/conf/hestia.conf
9797
branch=$RELEASE_BRANCH
9898
fi
9999

100-
if [ ! -z "$2" ]; then
101-
install=$2
102-
else
103-
install="y"
104-
fi
105-
106100
if [ -z "$branch" ]; then
107101
echo "No branch detected, please provide one using: v-update-sys-hestia-git branch"
108102
exit
@@ -373,19 +367,42 @@ fi
373367
#
374368
#################################################################################
375369

376-
if [ "$install" = 'yes' ] || [ "$install" = 'y' ]; then
377-
echo "!!! Development builds should not be installed on systems with live production data without understanding the potential risks involved. !!!"
378-
read -p 'Do you want to proceed the package installation? [y/n] ' answer
370+
# Define package installation functions
371+
warning_message() {
372+
echo ""
373+
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
374+
echo "WARNING - Development builds should not be installed on"
375+
echo "systems with live production data without understanding"
376+
echo "the potential risks that are involved!"
377+
echo "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!"
378+
echo ""
379+
}
380+
381+
install_build() {
382+
echo "Installing packages..."
383+
for i in $DEB_DIR/*.deb; do
384+
# Install all available packages
385+
dpkg -i $i
386+
done
387+
# Remove temporary files
388+
rm -rf $BUILD_DIR
389+
}
390+
391+
# Define installation routine
392+
393+
if [ "$install" = "yes" ]; then
394+
install_build
395+
else
396+
warning_message
397+
read -p "Do you wish to proceed with the installation? [y/n] " answer
379398
if [ "$answer" = 'y' ] || [ "$answer" = 'Y' ]; then
380-
echo "Installing packages..."
381-
for i in $DEB_DIR/*.deb; do
382-
# Install all available packages
383-
dpkg -i $i
384-
done
399+
install_build
385400
unset $answer
386-
# Remove temporary files
387-
rm -rf $BUILD_DIR
388401
else
389-
check_result 1 "Package installation cancelled..."
402+
echo "Installation of development build aborted."
403+
echo "Removing temporary files..."
404+
rm -rf $BUILD_DIR
405+
unset $answer
406+
echo ""
390407
fi
391408
fi

0 commit comments

Comments
 (0)