From cd20934a3dbabf2972d8685a608e4ade6b11b776 Mon Sep 17 00:00:00 2001 From: th33xitus Date: Thu, 19 May 2022 11:01:01 +0200 Subject: [PATCH] refactor(pretty_gcode.sh): exit if cloning fails Signed-off-by: Dominik Willner th33xitus@gmail.com --- scripts/pretty_gcode.sh | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/scripts/pretty_gcode.sh b/scripts/pretty_gcode.sh index 8767da7..eb514af 100644 --- a/scripts/pretty_gcode.sh +++ b/scripts/pretty_gcode.sh @@ -30,7 +30,11 @@ function install_pgc_for_klipper() { dependency_check "${dep[@]}" [[ -d ${PGC_DIR} ]] && rm -rf "${PGC_DIR}" - cd "${HOME}" && git clone "${PGC_REPO}" + if ! git clone "${PGC_REPO}" "${PGC_DIR}"; then + print_error "Cloning PrettyGCode for Klipper from\n ${PGC_REPO}\n failed!" + exit 1 + fi + sudo cp "${pgconfsrc}" "${pgconf}" sudo sed -i "s|/home/pi/pgcode;|/home/${USER}/pgcode;|" "${pgconf}"