diff options
author | Patrick Spek <p.spek@tyil.nl> | 2022-04-25 13:23:44 +0200 |
---|---|---|
committer | Patrick Spek <p.spek@tyil.nl> | 2022-04-25 13:23:44 +0200 |
commit | aeff0194ccb415904b1e37039e86a19f038dc708 (patch) | |
tree | 693eb4bfc55d845e4a978c4cdf4a253f310e646d /lib/subcommands/bootstrap.bash | |
parent | fff6fb24c624d0e434481d641313c196b8254a82 (diff) |
Rename bootstrap to init
Diffstat (limited to 'lib/subcommands/bootstrap.bash')
-rw-r--r-- | lib/subcommands/bootstrap.bash | 81 |
1 files changed, 0 insertions, 81 deletions
diff --git a/lib/subcommands/bootstrap.bash b/lib/subcommands/bootstrap.bash deleted file mode 100644 index 5a0f4ae..0000000 --- a/lib/subcommands/bootstrap.bash +++ /dev/null @@ -1,81 +0,0 @@ -#!/usr/bin/env bash - -# SPDX-FileCopyrightText: 2022 Patrick Spek <p.spek@tyil.nl> -# -# SPDX-License-Identifier: AGPL-3.0-or-later - -subcommand() -{ - remote="$1" ; shift - - if [[ -z "$remote" ]] - then - info "bootstrap" "No remote given, bootstrapping from scratch" - bootstrap_local - return - fi - - bootstrap_remote "$remote" -} - -bootstrap_local() -{ - local dirs=( - "$BASHTARD_ETCDIR" - "$BASHTARD_ETCDIR/conf.d" - "$BASHTARD_ETCDIR/hosts.d" - "$BASHTARD_ETCDIR/os.d" - "$BASHTARD_ETCDIR/playbooks.d" - "$BASHTARD_ETCDIR/registry.d" - "$BASHTARD_ETCDIR/registry.d/${BASHTARD_PLATFORM[fqdn]}" - ) - - local files=( - "$BASHTARD_ETCDIR/defaults" - "$BASHTARD_ETCDIR/hosts.d/${BASHTARD_PLATFORM[fqdn]}" - "$BASHTARD_ETCDIR/os.d/${BASHTARD_PLATFORM[key]}" - "$BASHTARD_ETCDIR/playbooks.d/remotes" - ) - - for dir in "${dirs[@]}" - do - notice "bashtard/bootstrap" "Creating $dir" - mkdir -p -- "$dir" - done - - for file in "${files[@]}" - do - notice "bashtard/bootstrap" "Creating $file" - touch -- "$file" - done -} - -bootstrap_remote() -{ - local remote="$1" ; shift - - notice "bootstrap" "Cloning $remote to $BASHTARD_ETCDIR" - git clone "$remote" "$BASHTARD_ETCDIR" - - local files=( - "$BASHTARD_ETCDIR/hosts.d/${BASHTARD_PLATFORM[fqdn]}" - "$BASHTARD_ETCDIR/os.d/${BASHTARD_PLATFORM[key]}" - "$BASHTARD_ETCDIR/registry.d/${BASHTARD_PLATFORM[fqdn]}" - ) - - for file in "${files[@]}" - do - [[ -f "$file" ]] && continue - - notice "bashtard/bootstrap" "Creating $file" - touch -- "$file" - done - - while read -r playbook url _ - do - notice "bashtard/bootstrap" "Cloning $playbook from $url" - git clone "$url" "$BASHTARD_ETCDIR/playbooks.d/$playbook" - - # TODO: Clone appropriate branch - done < "$BASHTARD_ETCDIR/playbooks.d/remotes" -} |