From 592cd95f425ab540aa19471c95affa82e1b5e583 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Christer=20War=C3=A9n?= Date: Sat, 27 Sep 2025 00:02:35 +0300 Subject: [PATCH] Replace bin only on successful connection --- src/commands/maintenance/install.sh | 7 +++++-- wx | 7 +++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/src/commands/maintenance/install.sh b/src/commands/maintenance/install.sh index 583b6b3..a92fcd8 100644 --- a/src/commands/maintenance/install.sh +++ b/src/commands/maintenance/install.sh @@ -14,8 +14,11 @@ wx-install(){ fi mkdir $HOME/bin &> /dev/null - curl https://git.waren.io/warengroup/wx/raw/branch/master/wx -o $HOME/bin/wx &> /dev/null - chmod +x $HOME/bin/wx &> /dev/null + if [[ $(curl -s -o /dev/null -w "%{http_code}" https://git.waren.io/warengroup/wx/raw/branch/master/wx) -eq 200 ]] + then + curl https://git.waren.io/warengroup/wx/raw/branch/master/wx -o $HOME/bin/wx &> /dev/null + chmod +x $HOME/bin/wx &> /dev/null + fi CRONJOB_NAME="#Warén CLI: Auto" CRONJOB_TASK="*/5 * * * * $HOME/bin/wx auto" diff --git a/wx b/wx index 6f83811..397d631 100755 --- a/wx +++ b/wx @@ -425,8 +425,11 @@ wx-install(){ fi mkdir $HOME/bin &> /dev/null - curl https://git.waren.io/warengroup/wx/raw/branch/master/wx -o $HOME/bin/wx &> /dev/null - chmod +x $HOME/bin/wx &> /dev/null + if [[ $(curl -s -o /dev/null -w "%{http_code}" https://git.waren.io/warengroup/wx/raw/branch/master/wx) -eq 200 ]] + then + curl https://git.waren.io/warengroup/wx/raw/branch/master/wx -o $HOME/bin/wx &> /dev/null + chmod +x $HOME/bin/wx &> /dev/null + fi CRONJOB_NAME="#Warén CLI: Auto" CRONJOB_TASK="*/5 * * * * $HOME/bin/wx auto"