From b6bcaa20756f0cd9d65bdc182c113e5220685cbd Mon Sep 17 00:00:00 2001 From: th33xitus Date: Sat, 11 Mar 2023 09:05:32 +0100 Subject: [PATCH] fix: implement clone function Signed-off-by: Dominik Willner --- scripts/octoeverywhere.sh | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/scripts/octoeverywhere.sh b/scripts/octoeverywhere.sh index fa04ef9..6946b57 100644 --- a/scripts/octoeverywhere.sh +++ b/scripts/octoeverywhere.sh @@ -276,7 +276,7 @@ function update_octoeverywhere() { do_action_service "stop" "octoeverywhere" if [[ ! -d ${OCTOEVERYWHERE_DIR} ]]; then - clone_moonraker "${OCTOEVERYWHERE_DIR}" + clone_octoeverywhere "${OCTOEVERYWHERE_REPO}" else backup_before_update "octoeverywhere" status_msg "Updating OctoEverywhere for Klipper ..." @@ -291,6 +291,21 @@ function update_octoeverywhere() { do_action_service "restart" "octoeverywhere" } +function clone_octoeverywhere() { + local repo=${1} + + status_msg "Cloning OctoEverywhere from ${repo} ..." + + ### force remove existing octoeverywhere dir and clone into fresh octoeverywhere dir + [[ -d ${OCTOEVERYWHERE_DIR} ]] && rm -rf "${OCTOEVERYWHERE_DIR}" + + cd "${HOME}" || exit 1 + if ! git clone "${OCTOEVERYWHERE_REPO}" "${OCTOEVERYWHERE_DIR}"; then + print_error "Cloning OctoEverywhere from\n ${repo}\n failed!" + exit 1 + fi +} + function install_octoeverywhere_dependencies() { local packages local install_script="${OCTOEVERYWHERE_DIR}/install.sh"