diff options
Diffstat (limited to 'lib/subcommands')
-rw-r--r-- | lib/subcommands/pull.bash | 15 | ||||
-rw-r--r-- | lib/subcommands/sync.bash | 13 |
2 files changed, 18 insertions, 10 deletions
diff --git a/lib/subcommands/pull.bash b/lib/subcommands/pull.bash new file mode 100644 index 0000000..4061f1b --- /dev/null +++ b/lib/subcommands/pull.bash @@ -0,0 +1,15 @@ +#!/usr/bin/env bash + +# SPDX-FileCopyrightText: 2023 Patrick Spek <p.spek@tyil.nl> +# +# SPDX-License-Identifier: AGPL-3.0-or-later + +subcommand() +{ + notice "bashtard/pull" "Pulling latest changes in $BASHTARD_ETCDIR" + + git -C "$BASHTARD_ETCDIR" stash + git -C "$BASHTARD_ETCDIR" pull origin master || return 4 + git -C "$BASHTARD_ETCDIR" submodule update --recursive --remote || return 4 + git -C "$BASHTARD_ETCDIR" stash pop +} diff --git a/lib/subcommands/sync.bash b/lib/subcommands/sync.bash index ed03faa..1ae2aae 100644 --- a/lib/subcommands/sync.bash +++ b/lib/subcommands/sync.bash @@ -1,6 +1,6 @@ #!/usr/bin/env bash -# SPDX-FileCopyrightText: 2022 Patrick Spek <p.spek@tyil.nl> +# SPDX-FileCopyrightText: 2023 Patrick Spek <p.spek@tyil.nl> # # SPDX-License-Identifier: AGPL-3.0-or-later @@ -15,15 +15,8 @@ subcommand() return fi - notice "bashtard/sync" "Syncing $BASHTARD_ETCDIR" - pushd -- "$BASHTARD_ETCDIR" > /dev/null || return 4 - - git stash - git pull origin master || return 4 - git submodule update --recursive --remote || return 4 - git stash pop - - popd > /dev/null || return 4 + # Pull latest changes + "$BASHTARD_BIN" pull # Run a sync for each registered playbook for this host while read -r playbook |