From 4e0d582101cee041df6d381e5df74d219eb6ce41 Mon Sep 17 00:00:00 2001 From: Oskar Manhart <52569953+oskardotglobal@users.noreply.github.com> Date: Fri, 30 Aug 2024 13:01:05 +0200 Subject: [PATCH] fix: load inquirer even if repo isn't cloned yet --- setup.sh | 21 ++++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/setup.sh b/setup.sh index 5c6fe81..59f7bb8 100755 --- a/setup.sh +++ b/setup.sh @@ -182,6 +182,18 @@ function waGetSourceCode() { fi } +# Name: 'waGetInquirer' +# Role: Loads the inquirer script, even if the source isn't cloned yet +function waGetInquirer() { + if [[ ! -d "$SYS_SOURCE_PATH" || ! -d "$USER_SOURCE_PATH" ]]; then + INQUIRER_PATH="/tmp/waInquirer.sh" + curl "https://raw.githubusercontent.com/winapps-org/winapps/main/install/inquirer.sh" -O "$INQUIRER_PATH" + fi + + # shellcheck source=/dev/null # Exclude this file from being checked by ShellCheck. + source "$INQUIRER_PATH" +} + # Name: 'waCheckInput' # Role: Sanitises input and guides users through selecting appropriate options if no arguments are provided. function waCheckInput() { @@ -1731,12 +1743,8 @@ ${CLEAR_TEXT}" # Check dependencies for the script. waCheckScriptDependencies -# Get the source code -waGetSourceCode - # Source the contents of 'inquirer.sh'. -# shellcheck source=/dev/null # Exclude this file from being checked by ShellCheck. -source "$INQUIRER_PATH" +waGetInquirer # Sanitise and parse the user input. waCheckInput "$@" @@ -1744,6 +1752,9 @@ waCheckInput "$@" # Configure paths and permissions. waConfigurePathsAndPermissions +# Get the source code +waGetSourceCode + # Install or uninstall WinApps. if [ "$OPT_UNINSTALL" -eq 1 ]; then waUninstall