From 54e010d1e334539ae23b03c676085020655eef84 Mon Sep 17 00:00:00 2001 From: Roshan Kumar Date: Sat, 14 Dec 2024 14:57:27 +0530 Subject: [PATCH 1/2] [fix] Fixed bug in auto-install #407 --- deploy/auto-install.sh | 18 +++++++++++------- 1 file changed, 11 insertions(+), 7 deletions(-) diff --git a/deploy/auto-install.sh b/deploy/auto-install.sh index bb4d6ff5..94736b0f 100755 --- a/deploy/auto-install.sh +++ b/deploy/auto-install.sh @@ -54,10 +54,18 @@ error_msg_with_continue() { apt_dependenices_setup() { start_step "Setting up dependencies..." - apt --yes install python3 python3-pip git python3-dev gawk libffi-dev libssl-dev gcc make &>>$LOG_FILE + apt --yes install python3 python3-pip git python3-dev gawk libffi-dev libssl-dev gcc make curl &>>$LOG_FILE check_status $? "Python dependencies installation failed." } +get_version_from_user() { + echo -ne ${GRN}"OpenWISP Version (leave blank for latest): "${NON} + read openwisp_version + if [[ -z "$openwisp_version" ]]; then + openwisp_version=$(curl -L --silent https://api.github.com/repos/openwisp/docker-openwisp/releases/latest | jq .tag_name | tr -d '"') + fi +} + setup_docker() { start_step "Setting up docker..." docker info &>/dev/null @@ -91,9 +99,7 @@ download_docker_openwisp() { setup_docker_openwisp() { echo -e ${GRN}"\nOpenWISP Configuration:"${NON} - echo -ne ${GRN}"OpenWISP Version (leave blank for latest): "${NON} - read openwisp_version - if [[ -z "$openwisp_version" ]]; then openwisp_version=latest; fi + get_version_from_user echo -ne ${GRN}"Do you have .env file? Enter filepath (leave blank for ad-hoc configuration): "${NON} read env_path if [[ ! -f "$env_path" ]]; then @@ -177,9 +183,7 @@ setup_docker_openwisp() { upgrade_docker_openwisp() { echo -e ${GRN}"\nOpenWISP Configuration:"${NON} - echo -ne ${GRN}"OpenWISP Version (leave blank for latest): "${NON} - read openwisp_version - if [[ -z "$openwisp_version" ]]; then openwisp_version=latest; fi + get_version_from_user echo "" download_docker_openwisp "$openwisp_version" From 4ffe916bfbe0f5a40d66248cbc4be6fc78d12b91 Mon Sep 17 00:00:00 2001 From: Roshan Kumar Date: Mon, 16 Dec 2024 20:30:11 +0530 Subject: [PATCH 2/2] added jq to apt dependencies --- deploy/auto-install.sh | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/deploy/auto-install.sh b/deploy/auto-install.sh index 94736b0f..6e828477 100755 --- a/deploy/auto-install.sh +++ b/deploy/auto-install.sh @@ -54,7 +54,7 @@ error_msg_with_continue() { apt_dependenices_setup() { start_step "Setting up dependencies..." - apt --yes install python3 python3-pip git python3-dev gawk libffi-dev libssl-dev gcc make curl &>>$LOG_FILE + apt --yes install python3 python3-pip git python3-dev gawk libffi-dev libssl-dev gcc make curl jq &>>$LOG_FILE check_status $? "Python dependencies installation failed." } @@ -62,7 +62,7 @@ get_version_from_user() { echo -ne ${GRN}"OpenWISP Version (leave blank for latest): "${NON} read openwisp_version if [[ -z "$openwisp_version" ]]; then - openwisp_version=$(curl -L --silent https://api.github.com/repos/openwisp/docker-openwisp/releases/latest | jq .tag_name | tr -d '"') + openwisp_version=$(curl -L --silent https://api.github.com/repos/openwisp/docker-openwisp/releases/latest | jq -r .tag_name) fi }