aboutsummaryrefslogtreecommitdiff
path: root/lib/subcommands
diff options
context:
space:
mode:
authorPatrick Spek <p.spek@tyil.nl>2023-03-08 08:27:05 +0100
committerPatrick Spek <p.spek@tyil.nl>2023-03-08 08:27:05 +0100
commite777cbc1cb10da93cb257305b05a6bba54307813 (patch)
treefd22f06abbcd5ec920c6ef30b56261c62fd00456 /lib/subcommands
parent0ba83d1c8aa8e7806c381916af4628305fcc64f2 (diff)
Change remotes to simply be git submodules
Diffstat (limited to 'lib/subcommands')
-rw-r--r--lib/subcommands/init.bash11
-rw-r--r--lib/subcommands/sync.bash13
2 files changed, 2 insertions, 22 deletions
diff --git a/lib/subcommands/init.bash b/lib/subcommands/init.bash
index 46497f5..6f0719e 100644
--- a/lib/subcommands/init.bash
+++ b/lib/subcommands/init.bash
@@ -35,7 +35,6 @@ init_local()
"$BASHTARD_ETCDIR/secrets"
"$BASHTARD_ETCDIR/hosts.d/${BASHTARD_PLATFORM[fqdn]}"
"$BASHTARD_ETCDIR/os.d/${BASHTARD_PLATFORM[key]}"
- "$BASHTARD_ETCDIR/playbooks.d/remotes"
)
for dir in "${dirs[@]}"
@@ -62,7 +61,7 @@ init_remote()
local remote="$1" ; shift
notice "init" "Cloning $remote to $BASHTARD_ETCDIR"
- git clone "$remote" "$BASHTARD_ETCDIR"
+ git clone --recurse-submodules "$remote" "$BASHTARD_ETCDIR"
local files=(
"$BASHTARD_ETCDIR/hosts.d/${BASHTARD_PLATFORM[fqdn]}"
@@ -77,12 +76,4 @@ init_remote()
notice "bashtard/init" "Creating $file"
touch -- "$file"
done
-
- while read -r playbook url _
- do
- notice "bashtard/init" "Cloning $playbook from $url"
- git clone "$url" "$BASHTARD_ETCDIR/playbooks.d/$playbook"
-
- # TODO: Clone appropriate branch
- done < "$BASHTARD_ETCDIR/playbooks.d/remotes"
}
diff --git a/lib/subcommands/sync.bash b/lib/subcommands/sync.bash
index e2eac77..0413ce4 100644
--- a/lib/subcommands/sync.bash
+++ b/lib/subcommands/sync.bash
@@ -18,20 +18,9 @@ subcommand()
notice "bashtard/sync" "Syncing $BASHTARD_ETCDIR"
pushd -- "$BASHTARD_ETCDIR" > /dev/null || return 4
git pull origin master || return 4
+ git submodule update --recursive --remote || return 4
popd > /dev/null || return 4
- # Otherwise, do a full sync
- notice "bashtard/sync" "Syncing remote playbooks"
-
- # Update all playbook sources
- while read -r playbook _ branch
- do
- pushd -- "$BASHTARD_ETCDIR/playbooks.d/$playbook" > /dev/null \
- || return 2
- git pull origin "$branch"
- popd > /dev/null || return 2
- done < "$BASHTARD_ETCDIR/playbooks.d/remotes"
-
# Run a sync for each registered playbook for this host
while read -r playbook
do