From d407c683c0d05488e830acf982ff9908cca8ef6a Mon Sep 17 00:00:00 2001 From: Stephan Wendel <me@stephanwe.de> Date: Thu, 10 Nov 2022 20:52:43 +0100 Subject: [PATCH] chore: changes install routine This should fix https://github.com/mainsail-crew/crowsnest/issues/52 make config is now optional. Now it uses $HOME/printer_data/ as default. Signed-off-by: Stephan Wendel <me@stephanwe.de> --- tools/dev-helper.sh | 2 +- tools/install.sh | 18 ++++++++++++------ 2 files changed, 13 insertions(+), 7 deletions(-) diff --git a/tools/dev-helper.sh b/tools/dev-helper.sh index a97d10d..2be5945 100755 --- a/tools/dev-helper.sh +++ b/tools/dev-helper.sh @@ -20,7 +20,7 @@ set -Ee # Global Vars TITLE="\e[31mcrowsnest\e[0m - $(basename "${0}")" DH_VERSION="v0.0.0" -[[ -n "${BASE_USER}" ]] || BASE_USER="$(whoami)" +[[ -n "${BASE_USER}" ]] || BASE_USER="$(logname)" # Set fallback lang export LC_ALL=C diff --git a/tools/install.sh b/tools/install.sh index cf5e8b0..c9e1122 100755 --- a/tools/install.sh +++ b/tools/install.sh @@ -19,7 +19,7 @@ set -Ee # Global Vars TITLE="\e[31mcrowsnest\e[0m - A webcam daemon for multiple Cams and stream services." -[[ -n "${BASE_USER}" ]] || BASE_USER="$(whoami)" +[[ -n "${BASE_USER}" ]] || BASE_USER="$(logname)" [[ -n "${CROWSNEST_UNATTENDED}" ]] || CROWSNEST_UNATTENDED="0" [[ -n "${CROWSNEST_DEFAULT_CONF}" ]] || CROWSNEST_DEFAULT_CONF="resources/crowsnest.conf" @@ -55,8 +55,8 @@ welcome_msg() { ### Config Message config_msg() { - echo -e "\nConfig file not found!\n\tYOU NEED TO CREATE A CONFIGURATION!" - echo -e "\tPlease use 'make config' first!\nExiting..." + echo -e "\nConfig file not found!\n\tUsing defaults ..." + echo -e "\tThis uses paths located in 'printer_data' of your Home Folder." exit 1 } @@ -112,9 +112,15 @@ import_config() { # shellcheck disable=SC1091 source tools/.config return 0 - else - config_msg - return 0 + fi + if [[ ! -f tools/.config ]] && + [[ "${CROWSNEST_UNATTENDED}" != "1" ]]; then + CROWSNEST_CONFIG_PATH="/home/${BASE_USER}/printer_data/config" + CROWSNEST_LOG_PATH="/home/${BASE_USER}/printer_data/logs" + CROWSNEST_ENV_PATH="/home/${BASE_USER}/printer_data/systemd" + CROWSNEST_USTREAMER_REPO_SHIP="https://github.com/pikvm/ustreamer.git" + CROWSNEST_USTREAMER_REPO_BRANCH="master" + fi }