CLI: Update

This commit is contained in:
Christer Waren committed 2026-10-17 08:27:20 +03:00
1 parent 9b8eefd6df
commit a842e423e5
1 file changed
+20 -24
+20 -24
View File
@@ -848,6 +848,15 @@ wx-install(){
ln -s "$PWD/cli.sh" "$HOME/bin/wx" ln -s "$PWD/cli.sh" "$HOME/bin/wx"
fi fi
if [[ -f "$HOME/bin/wx" ]]
then
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
fi
if [[ $(systemd-detect-virt) == "wsl" ]] if [[ $(systemd-detect-virt) == "wsl" ]]
then then
if [[ ! -L "/bin/wx" ]] if [[ ! -L "/bin/wx" ]]
@@ -865,35 +874,22 @@ wx-install(){
fi fi
fi fi
cd "$OLDPWD" cd "$OLDPWD"
wxi-header "Cron" h3
CRONJOB_NAME="#Warén CLI: Auto"
CRONJOB_TASK="*/5 * * * * $HOME/bin/wx auto"
if [[ -z $(crontab -l | grep -F "$CRONJOB_NAME") || -z $(crontab -l | grep -F "$CRONJOB_TASK") ]]
then
(crontab -l ; echo "$CRONJOB_NAME" ; echo "$CRONJOB_TASK") | grep -Fv "no crontab" | crontab -
wxi-content text "Ready ✔"
else
wxi-content text "Ready ✔"
fi
else else
wxi-content text "You have already installed!" wxi-content text "You have already installed!"
fi fi
} }
wx-install2(){
wxi-header "Install"
wxi-restricted --user
if [[ -f "./wx" && -f "./maintainer.sh" && -d "./src" ]]
then
./maintainer.sh
fi
mkdir -p $HOME/bin
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"
if [[ -z $(crontab -l | grep -F "$CRONJOB_NAME") || -z $(crontab -l | grep -F "$CRONJOB_TASK") ]]
then
(crontab -l ; echo "$CRONJOB_NAME" ; echo "$CRONJOB_TASK") | grep -Fv "no crontab" | crontab -
fi
}
wx-upgrade(){ wx-upgrade(){
wxi-header "Upgrade" h2 wxi-header "Upgrade" h2
wx-install wx-install