Skip to content
Snippets Groups Projects
Commit 7c8663dd authored by Daniel Müller's avatar Daniel Müller :speech_balloon:
Browse files

Enhance update script

The update script now pauses when the update is finished.
Using "--update devel" uses the devel branch for the update.
parent fa5f4e95
Branches
Tags
No related merge requests found
......@@ -20,6 +20,7 @@ GIT_REPO="https://code.fbi.h-da.de/vm/sv.git"
case $1 in
help|--help|-h)
echo "usage: $(basename $0) [-y] [-m mount_name] [--ssh] [--setup-pubkey] [--vpn]"
echo " [--update (devel)]"
echo "params:"
echo " -y Accept suggested username"
echo " --mount | -m Mount userv share mount_name"
......@@ -30,7 +31,8 @@ help|--help|-h)
echo " supplied to the ssh command"
echo " --vpn Start sshuttle as replacement for a full VPN"
echo " This will route all trafic through the SSH"
echo " --update Update the VM config using ansible"
echo " --update (devel) Update the VM config using ansible. If devel is "
echo " added, the non-stable devel branch is used for update"
exit 0
;;
esac
......@@ -186,9 +188,22 @@ module_setup_passwordless_auth() {
# This function runs the latest version of the ansible playbook to
# update the VM configuration.
module_ansible_update() {
if [ "$1" = "devel" ]; then
extra_args="-C devel"
shift
fi
echo "Starting update via ansible..."
[ -n "$extra_args" ] && echo "Following development branch instead of main..."
echo ""
if sudo ansible-pull -U $GIT_REPO $extra_args; then
echo ""
sudo ansible-pull -U $GIT_REPO
read -p "Update completed"
else
echo ""
read -p "Update failed"
fi
}
......@@ -229,7 +244,7 @@ while [ -n "$1" ]; do
--update)
shift
module_ansible_update
module_ansible_update $1
exit 0
;;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment