aboutsummaryrefslogtreecommitdiff
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
parent0ba83d1c8aa8e7806c381916af4628305fcc64f2 (diff)
Change remotes to simply be git submodules
-rw-r--r--README.md13
-rw-r--r--lib/subcommands/init.bash11
-rw-r--r--lib/subcommands/sync.bash13
-rw-r--r--share/doc/bashtard.7.scd14
-rw-r--r--share/doc/playbooks.d.7.scd4
5 files changed, 5 insertions, 50 deletions
diff --git a/README.md b/README.md
index ea1f3f7..1c3779e 100644
--- a/README.md
+++ b/README.md
@@ -65,19 +65,6 @@ called for the `add`, `sync`, end `del` subactions respectively. Using these
functions, one can automate the setup, synchronization, or disabling of certain
components of a system.
-#### Local
-
-A local playbook is simply a directory made in `/etc/bashtard/playbooks.d` with
-the two files specified earlier.
-
-#### Remote
-
-A remote playbook is recorded in `/etc/bashtard/playbooks.d/remotes`. This is a
-space-seperated file, containing 3 columns per line, `name`, `url`, and
-`branch`. When the `sync` subcommand is called, the latest commits on the
-specified `branch` are pulled before calling `playbook_sync()` on them. The
-structure of the actual playbook is the same as a local one.
-
### SSH
Bashtard comes with an `ssh` subcommand to allow the user to run any command on
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
diff --git a/share/doc/bashtard.7.scd b/share/doc/bashtard.7.scd
index fc9333e..f982f78 100644
--- a/share/doc/bashtard.7.scd
+++ b/share/doc/bashtard.7.scd
@@ -29,18 +29,8 @@ certain GNU+Linux distributions.
# playbooks.d
-The *playbooks.d* directory contains a single plain-text file, *remotes*,
-describing all the remote playbooks tracked by *bashtard*. The layout of
-playbooks themselves can be found in _playbooks.d(7)_.
-
-## remotes
-
-The *remotes* file is a space-seperated file, specifying a _name_, _url_, and
-_branch_ per line, to use for keeping remote playbooks synchronized.
-
-```
-webserver https://git.tyil.nl/bashtard-webserver.git master
-```
+The *playbooks.d* directory contains all the playbook directories. For more
+information, check _playbooks.d(7)_.
# registry.d
diff --git a/share/doc/playbooks.d.7.scd b/share/doc/playbooks.d.7.scd
index b4624a2..876e547 100644
--- a/share/doc/playbooks.d.7.scd
+++ b/share/doc/playbooks.d.7.scd
@@ -10,9 +10,7 @@ bashtard - A Bash-based configuration management utility
# INTRODUCTION
*bashtard* playbooks are, in essence, no more than directories with a small
-number of required files. Even remote playbooks just get cloned into regular
-directories inside _playbooks.d_. The files you must include in any playbook
-are:
+number of required files. The files you must include in any playbook are:
- description.txt
- playbook.bash