mirror of
https://github.com/starr-dusT/dotfiles.git
synced 2025-02-19 19:27:31 -08:00
67 lines
1.3 KiB
Bash
67 lines
1.3 KiB
Bash
#!/usr/bin/env bash
|
|
|
|
help ()
|
|
{
|
|
echo "
|
|
Update void linux with ansible
|
|
|
|
Usage: update <tags> <flags>
|
|
|
|
EXAMPLE TAGS:
|
|
packages,configs
|
|
|
|
FLAGS:
|
|
-f, --fedora perform update for fedora
|
|
-v, --void perform update for void
|
|
-s, --src compile (or recompile) source based packages"
|
|
exit 0
|
|
}
|
|
|
|
POSITIONAL_ARGS=()
|
|
SRC=false
|
|
|
|
while [[ $# -gt 0 ]]; do
|
|
case $1 in
|
|
-v|--void)
|
|
distro="void"
|
|
shift
|
|
;;
|
|
-f|--fedora)
|
|
distro="fedora"
|
|
shift
|
|
;;
|
|
-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/$distro/ansible"
|
|
|
|
# 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 - > /dev/null
|