dotfiles/home/bin/executable_void-update.tmpl

57 lines
1.0 KiB
Bash

#!/usr/bin/env bash
help ()
{
echo "
Update void linux with ansible
Usage: update <tags> <flags>
EXAMPLE TAGS:
packages,configs
FLAGS:
-s, --src compile (or recompile) source based packages"
exit 0
}
POSITIONAL_ARGS=()
SRC=false
while [[ $# -gt 0 ]]; do
case $1 in
-s|--src)
SRC=true
shift
;;
-h|--help)
help
;;
-*|--*)
echo "Unknown option $1"
exit 1
;;
*)
POSITIONAL_ARGS+=("$1")
shift
;;
esac
done
set -- "${POSITIONAL_ARGS[@]}" # restore positional parameters
# Goto playbook and run it
cd {{ .chezmoi.workingTree }}/provision
# Install ansible and run playbook
if [ "$SRC" = true ] ; then
echo "Starting update with source packages - be prepated to wait..."
ansible-playbook setup.yml -i hosts --ask-become-pass --tags "$1" --skip-tags "once"
else
echo "Starting update without source packages..."
ansible-playbook setup.yml -i hosts --ask-become-pass --tags "$1" --skip-tags "once,src"
fi
# Return to where you were
cd -