From 2ef979399896a5f6986cd031a09202868aad7325 Mon Sep 17 00:00:00 2001 From: Brian Zalewski <59970525+ProfessorManhattan@users.noreply.github.com> Date: Tue, 30 May 2023 02:46:47 +0000 Subject: [PATCH] Updated start script environment variables --- scripts/provision.sh | 4 ++-- scripts/src/provision.sh.tmpl | 37 ++++++++++++++++++++--------------- 2 files changed, 23 insertions(+), 18 deletions(-) diff --git a/scripts/provision.sh b/scripts/provision.sh index a14b7f78..d7543a9a 100644 --- a/scripts/provision.sh +++ b/scripts/provision.sh @@ -39,7 +39,7 @@ # # | Variable | Description | # |------------------------|-----------------------------------------------------------------------------------| -# | `START_REPO` | Variable to specify the Git fork to use when provisioning | +# | `START_REPO` (or `REPO`) | Variable to specify the Git fork to use when provisioning | # | `ANSIBLE_PROVISION_VM` | **For Qubes**, determines the name of the VM used to provision the system | # | `DEBUG_MODE` | Set to true to enable verbose logging | # @@ -56,7 +56,7 @@ export DEBIAN_FRONTEND=noninteractive # @description Detect `START_REPO` format and determine appropriate git address, otherwise use the master Install Doctor branch if [ -z "$START_REPO" ]; then - START_REPO="https://gitlab.com/megabyte-labs/install.doctor.git" + START_REPO="https://github.com/megabyte-labs/install.doctor.git" else if [[ "$START_REPO == *"/"* ]]; then # Either full git address or GitHubUser/RepoName diff --git a/scripts/src/provision.sh.tmpl b/scripts/src/provision.sh.tmpl index 8b13488b..3620d516 100644 --- a/scripts/src/provision.sh.tmpl +++ b/scripts/src/provision.sh.tmpl @@ -37,11 +37,11 @@ # environment variables, this script can be run completely headlessly. This allows us to do things like test our # provisioning script on a wide variety of operating systems. # -# | Variable | Description | -# |------------------------|-----------------------------------------------------------------------------------| -# | `START_REPO` | Variable to specify the Git fork to use when provisioning | -# | `ANSIBLE_PROVISION_VM` | **For Qubes**, determines the name of the VM used to provision the system | -# | `DEBUG_MODE` | Set to true to enable verbose logging | +# | Variable | Description | +# |---------------------------|-----------------------------------------------------------------------------------| +# | `START_REPO` (or `REPO`) | Variable to specify the Git fork to use when provisioning | +# | `ANSIBLE_PROVISION_VM` | **For Qubes**, determines the name of the VM used to provision the system | +# | `DEBUG_MODE` (or `DEBUG`) | Set to true to enable verbose logging | # # For a full list of variables you can use to customize Install Doctor, check out our [Customization](https://install.doctor/docs/customization) # and [Secrets](https://install.doctor/docs/customization/secrets) documentation. @@ -55,19 +55,22 @@ export DEBIAN_FRONTEND=noninteractive # @description Detect `START_REPO` format and determine appropriate git address, otherwise use the master Install Doctor branch -if [ -z "$START_REPO" ]; then - START_REPO="https://gitlab.com/megabyte-labs/install.doctor.git" +if [ -z "$START_REPO" ] && [ -z "$REPO" ]; then + START_REPO="https://gitlab.com/megabyte-labs/install.doctor.git" else - if [[ "$START_REPO == *"/"* ]]; then - # Either full git address or GitHubUser/RepoName - if [[ "$START_REPO" == *":"* ]] || [[ "$START_REPO" == *"//"* ]]; then - START_REPO="$START_REPO" - else - START_REPO="https://github.com/${START_REPO}.git" - fi + if [ -n "$REPO" ] && [ -z "$START_REPO" ]; then + START_REPO="$REPO" + fi + if [[ "$START_REPO == *"/"* ]]; then + # Either full git address or GitHubUser/RepoName + if [[ "$START_REPO" == *":"* ]] || [[ "$START_REPO" == *"//"* ]]; then + START_REPO="$START_REPO" else - START_REPO="https://github.com/$START_REPO/install.doctor.git" + START_REPO="https://github.com/${START_REPO}.git" fi + else + START_REPO="https://github.com/$START_REPO/install.doctor.git" + fi fi {{ include "partials" "logg" }} @@ -232,10 +235,12 @@ if [ ! -f "${XDG_CONFIG_HOME:-$HOME/.config}/chezmoi/chezmoi.yaml" ]; then chezmoi init fi -# @description Run `chezmoi apply` and enable verbose mode if the `DEBUG_MODE` environment variable is set to true +# @description Run `chezmoi apply` and enable verbose mode if the `DEBUG_MODE` or `DEBUG` environment variable is set to true logg info 'Running `chezmoi apply`' if [ "$DEBUG_MODE" = 'true' ]; then DEBUG_MODIFIER="-vvvvv" +elif [ "$DEBUG" = 'true' ]; then + DEBUG_MODIFIER="-vvvvv" fi # @description Save the log of the provision process to `${XDG_DATA_HOME:-$HOME/.local/share}/install.doctor.$(date +%s).log` and add the Chezmoi