From b349c7b06c12a972004afd79b6f5271a2e290c3a Mon Sep 17 00:00:00 2001 From: chris Date: Sun, 11 Oct 2020 17:12:16 -0400 Subject: [PATCH] add in setting custom repo and branch by env variables removing branch name removing branch_name from arg install --- cyberpanel.sh | 35 +++++++++++++++++++++++++++++++---- 1 file changed, 31 insertions(+), 4 deletions(-) diff --git a/cyberpanel.sh b/cyberpanel.sh index 37294e78e..7f718f8ec 100644 --- a/cyberpanel.sh +++ b/cyberpanel.sh @@ -36,10 +36,37 @@ TOTAL_RAM=$(free -m | awk '/Mem:/ { print $2 }') CENTOS_8="False" UBUNTU_20="False" WATCHDOG="OFF" -BRANCH_NAME="v${TEMP:12:3}.${TEMP:25:1}" VIRT_TYPE="" -GIT_URL="github.com/usmannasir/cyberpanel" -GIT_CONTENT_URL="raw.githubusercontent.com/usmannasir/cyberpanel" +MASTER_GIT_URL="github.com/usmannasir/cyberpanel" + +set_git_repos_and_branch() { + local GIT_DIR + local GIT_USER + local GIT_REPO + + if [ -z ${GIT_URL+x} ]; then + GIT_URL=$MASTER_GIT_URL + else + printf "Found custom provided GIT URL...\n" + fi + + if [ -z ${BRANCH_NAME+x} ]; then + BRANCH_NAME="v${TEMP:12:3}.${TEMP:25:1}" + else + printf "Found custom provided branch...\n" + fi + + GIT_DIR=$(dirname "$GIT_URL") + GIT_USER=$(basename "$GIT_DIR") + GIT_REPO=$(basename "$GIT_URL") + GIT_CONTENT_URL="raw.githubusercontent.com/$GIT_USER/$GIT_REPO" + + printf "\n~~~~~~~~~~\n" + printf "Github URL: %s\n" "$GIT_URL" + printf "Github Content URL: %s\n" "$GIT_CONTENT_URL" + printf "Github Branch: %s\n" "$BRANCH_NAME" + printf "~~~~~~~~~~\n" +} disable_repos() { @@ -1509,7 +1536,6 @@ options edns0" /etc/resolv.conf argument_mode() { DEV="ON" - BRANCH_NAME="stable" #default to python3 branch. KEY_SIZE=${#VERSION} TMP=$(echo $VERSION | cut -c5) @@ -1654,6 +1680,7 @@ initialize() { } begin_install() { + set_git_repos_and_branch initialize "$@" check_OS check_virtualization