From d16d725a2c03698ba6644822b4197c5b9fc81ccc Mon Sep 17 00:00:00 2001 From: Brian Zalewski Date: Sat, 19 Nov 2022 10:54:53 +0000 Subject: [PATCH] Update dotfiles/.local/bin/update-local-betelgeuse, dotfiles/.local/bin/provision, dotfiles/.local/Taskfile-localhost.yml --- dotfiles/.local/Taskfile-localhost.yml | 43 +++++++++++++++++++++ dotfiles/.local/bin/provision | 9 ++++- dotfiles/.local/bin/update-local-betelgeuse | 19 +++++++++ 3 files changed, 69 insertions(+), 2 deletions(-) create mode 100644 dotfiles/.local/bin/update-local-betelgeuse diff --git a/dotfiles/.local/Taskfile-localhost.yml b/dotfiles/.local/Taskfile-localhost.yml index 5ee8149f..cd87919a 100644 --- a/dotfiles/.local/Taskfile-localhost.yml +++ b/dotfiles/.local/Taskfile-localhost.yml @@ -2,18 +2,61 @@ version: '3' tasks: + provision: + desc: Provision the environment + summary: | + # Provision the Environment + + This task will provision the current environment using a variety of tools. + It will prompt you for details like what type of environment you are provisioning. + Optionally, you can skip the prompt by passing a CLI argument like so: + + **Example:** + `run localhost:provision -- terminal` + + The above example will run the `localhost:provision:terminal` task. + cmds: + - | + if [ "{{.CLI_ARGS}}" != "" ]; then + run localhost:provision:{{.CLI_ARGS}} + else + run localhost:provision:prompt + fi + + provision:prompt: + deps: + - :install:software:gum + cmds: + - logg prompt 'Select the type of environment you would like to provision' + - logg prompt '`Terminal` - Installs standard CLI tools that augment the terminal experience' + - logg prompt '`Development` - Provisions Terminal and also installs useful tools for development' + - logg prompt '`Full` - Provisions with both Terminal and Development and then it installs all the Brewfile-supported software from the Gas Station project (e.g. https://gitlab.com/megabyte-labs/gas-station).' + - | + CHOICE="$(logg choose "Terminal" "Development" "Full")" + if [ "$CHOICE" = 'Development' ]; then + run localhost:provision:dev + elif [ "$CHOICE" = 'Terminal' ]; then + run localhost:provision:terminal + elif [ "$CHOICE" = 'Full' ]; then + run localhost:provision:full + fi + provision:dev: deps: + - :install:software:bundle - provision:terminal cmds: - brew bundle --file "$HOME/.local/Brewfile.dev" provision:full: deps: + - :install:software:bundle - provision:dev cmds: - brew bundle --file "$HOME/.local/Brewfile.full" provision:terminal: + deps: + - :install:software:bundle cmds: - brew bundle --file "$HOME/.local/Brewfile.terminal" diff --git a/dotfiles/.local/bin/provision b/dotfiles/.local/bin/provision index 6f418159..b6e78a83 100644 --- a/dotfiles/.local/bin/provision +++ b/dotfiles/.local/bin/provision @@ -10,8 +10,13 @@ if ! type brew &> /dev/null; then fi # Install Homebrew bundle and go-task -brew tap Homebrew/bundle brew install go-task/tap/go-task # Use run alias to invoke the `$HOME/.local/Taskfile.yml` -run localhost:provision:terminal +chmod +x $HOME/.local/bin/* +install-dotfiles & +install-terminal-theme & +update-local-betelgeuse & +update-taskfiles & +wait +run localhost:provision diff --git a/dotfiles/.local/bin/update-local-betelgeuse b/dotfiles/.local/bin/update-local-betelgeuse new file mode 100644 index 00000000..2d01f876 --- /dev/null +++ b/dotfiles/.local/bin/update-local-betelgeuse @@ -0,0 +1,19 @@ +#!/usr/bin/env bash + +if [ -f '/etc/qubes-release' ]; then + # Qubes dom0 + qvm-create --label red --template debian-11 provision &> /dev/null || EXIT_CODE=$? + qvm-run --pass-io provision 'rm -f ~/Downloads/betelgeuse-master.tar.gz && curl -sSL https://gitlab.com/megabyte-labs/misc/betelgeuse/-/archive/master/betelgeuse-master.tar.gz > /tmp/betelgeuse-master.tar.gz' + qvm-run --pass-io provision "cat /tmp/betelgeuse-master.tar.gz" > "/tmp/betelgeuse-master.tar.gz" + cd /tmp + tar -xvf betelgeuse-master.tar.gz > /dev/null + rm betelgeuse-master.tar.gz + cp -rf betelgeuse-master/share/ "$HOME/.local/share" + rm -rf betelgeuse-master +else + curl -sSL https://gitlab.com/megabyte-labs/misc/betelgeuse/-/archive/master/betelgeuse-master.tar.gz > betelgeuse-master.tar.gz + tar -xzf betelgeuse-master.tar.gz > /dev/null + rm betelgeuse-master.tar.gz + cp -rf betelgeuse-master/share/ "$HOME/.local/share" + rm -rf betelgeuse-master +fi