feat(configz): move the dotfiles script to only use configz

Soon we will probably be able to remove all the puppet stuff. I don't even have
it installed on new machines anymore.

You can now list and apply single configz to target updates or install separate
parts on different machines.
This commit is contained in:
Ade Attwood 2024-11-28 17:49:30 +00:00
parent fb1d4a8e03
commit d23aa40709

View file

@ -1,7 +1,8 @@
#!/usr/bin/env bash #!/usr/bin/env bash
# #
# Cli app for managing files with puppet # Cli app for managing files with configz
# see https://github.com/adeattwood/dotfiles # see https://github.com/adeattwood/dotfiles
# see https://github.com/adeattwood/configz
# #
# Author: Ade Attwood <code@adeattwood.co.uk> # Author: Ade Attwood <code@adeattwood.co.uk>
# Version: 0.0.2 # Version: 0.0.2
@ -11,26 +12,22 @@
SCRIPT="$(realpath "$(readlink -f "$0")")"; SCRIPT="$(realpath "$(readlink -f "$0")")";
DOTFILES_DIR=${SCRIPT%%site-modules/core/files/bin/dotfiles*} DOTFILES_DIR=${SCRIPT%%site-modules/core/files/bin/dotfiles*}
MODULES="$(ls -1 "$DOTFILES_DIR"/modules)"
MODULES="${MODULES//.lua/}"
case $1 in case $1 in
apply) apply)
shift
cd "$DOTFILES_DIR" cd "$DOTFILES_DIR"
bolt module install for module in $@; do
bolt apply manifests/root.pp --targets localhost --run-as root --sudo-password-prompt RUST_LOG=info configz --module "modules.$module";
bolt apply manifests/workstation.pp --targets localhost done
RUST_LOG=info configz --module manifests/configz-user
exit 0;
;;
apply-root)
cd "$DOTFILES_DIR"
bolt apply manifests/root.pp --targets localhost --run-as root --sudo-password-prompt
exit 0;
;;
apply-user)
cd "$DOTFILES_DIR"
bolt apply manifests/workstation.pp --targets localhost
RUST_LOG=info configz --module manifests/configz-user
exit 0; exit 0;
;; ;;
list)
echo "$MODULES" | column
exit 0;
;;
esac esac
cat << HELP cat << HELP
@ -45,13 +42,12 @@ Usage: dotfiles <command>
Author: Ade Attwood <code@adeattwood.co.uk> Author: Ade Attwood <code@adeattwood.co.uk>
Commands: Commands:
apply Applies a puppet configuration with the dotfiles config and facts list List all of the available configz modules
apply-root Applies the root puppet manifestes apply Apply a configz module
apply-user Applies the user puppet manifestes
Examples: Examples:
Apply all of the puppet config Apply the zsh configz module
$ dotfiles apply $ dotfiles apply zsh
HELP HELP