From edc3e9c74e1c39c9ba16292f615cac3f66c7edef Mon Sep 17 00:00:00 2001 From: Michael Housh Date: Sun, 28 Sep 2025 19:42:59 -0400 Subject: [PATCH] feat: Adds bootstrap script that will run all the commands for packages, config, and webapps. --- bootstrap | 28 ++++++++++++++++++++++++++++ gen | 6 ++---- run | 4 +--- 3 files changed, 31 insertions(+), 7 deletions(-) create mode 100755 bootstrap diff --git a/bootstrap b/bootstrap new file mode 100755 index 0000000..76574b5 --- /dev/null +++ b/bootstrap @@ -0,0 +1,28 @@ +#!/usr/bin/env bash + +# Bootstraps a new machine, installing configuration, packages, and webapps. +# + +if [ -z "$DEV_ENV" ]; then + echo "env var DEV_ENV needs to be present" + exit 1 +fi + +# if i just did DEV_ENV=$(pwd) ./run then this is needed for the rest of the +# scripts +export DEV_ENV="$DEV_ENV" + +args="" + +while [[ $# -gt 0 ]]; do + if [[ "$1" =~ dry ]]; then + args="--dry-run" + fi +done + +echo "Args to bootstrap scripts: $args" +echo "Installing packages may require your password multiple times." + +echo "Running packages" && $DEV_ENV/run "$args" +echo "Installing configuration" && $DEV_ENV/dev-env "$args" +echo "Installing webapps" && $DEV_ENV/webapp "$args" diff --git a/gen b/gen index 694fa2a..a9b4e8f 100755 --- a/gen +++ b/gen @@ -2,8 +2,6 @@ # Generates a new run file or webapp file. -script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" - if [ -z "$DEV_ENV" ]; then echo "env var DEV_ENV needs to be present" exit 1 @@ -29,7 +27,7 @@ done log() { echo "$1"; } generate-new-run() { - local dest="$script_dir/runs/$file" + local dest="$DEV_ENV/runs/$file" if [ -f "$dest" ]; then log "file exists: $dest" exit 1 @@ -45,7 +43,7 @@ generate-new-run() { generate-new-webapp() { - local dest="$script_dir/webapps/$file" + local dest="$DEV_ENV/env/webapps/$file" if [[ ! $dest =~ \.json$ ]]; then dest="$dest.json" diff --git a/run b/run index 0b8b376..9e9d50d 100755 --- a/run +++ b/run @@ -7,8 +7,6 @@ # or all scripts in the runs directory. # -script_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" &>/dev/null && pwd)" - if [ -z "$DEV_ENV" ]; then echo "env var DEV_ENV needs to be present" exit 1 @@ -68,7 +66,7 @@ run() { log "RUN: env: $env -- grep: $grep" -runs_dir=$(find $script_dir/runs -mindepth 1 -maxdepth 1 -executable) +runs_dir=$(find $DEV_ENV/runs -mindepth 1 -maxdepth 1 -executable) for s in $runs_dir; do if basename $s | grep -vq "$grep"; then