From e2b9e8b4aa14e3a5748ce4a26f3b8ec4dc02be0b Mon Sep 17 00:00:00 2001 From: Alexander Sherikov Date: Thu, 19 Dec 2024 21:29:51 +0400 Subject: [PATCH] wshandler 0.7.0 --- ccws/scripts/wshandler | 33 ++++++++++++++++++++++++++++----- 1 file changed, 28 insertions(+), 5 deletions(-) diff --git a/ccws/scripts/wshandler b/ccws/scripts/wshandler index d5ee2da..a1c0bc5 100755 --- a/ccws/scripts/wshandler +++ b/ccws/scripts/wshandler @@ -67,6 +67,8 @@ help() echo "wshandler installation commands:" echo " install_test_deps" echo " [-p|--policy {skip_yq}|snap|download] install " + echo " upgrade " + echo " upgrade_appimage " exit "${EXIT_CODE}" } @@ -715,6 +717,15 @@ snap_install() sudo snap install "$@" } +wsh_download() +{ + if ! command -v "wget" > /dev/null + then + apt_install wget + fi + wget -O - "$@" +} + WSH_SOURCE_TYPES="git" WSH_COMMAND_POLICY=default @@ -846,11 +857,7 @@ do snap_install yq ;; download) - if ! command -v "wget" > /dev/null - then - apt_install wget - fi - wget -O - "https://github.com/mikefarah/yq/releases/latest/download/yq_linux_$(dpkg --print-architecture).tar.gz" \ + wsh_download "https://github.com/mikefarah/yq/releases/latest/download/yq_linux_$(dpkg --print-architecture).tar.gz" \ | tar -zxO > "${BIN_PATH}/yq" chmod +x "${BIN_PATH}/yq" ;; @@ -861,6 +868,22 @@ do fi exit;; + upgrade) + BIN_PATH=${2:-"${HOME}/bin"} + mkdir -p "${BIN_PATH}" + + wsh_download "https://github.com/asherikov/wshandler/releases/latest/download/wshandler" > "${BIN_PATH}/wshandler" + chmod +x "${BIN_PATH}/wshandler" + exit;; + + upgrade_appimage) + BIN_PATH=${2:-"${HOME}/bin"} + mkdir -p "${BIN_PATH}" + + wsh_download "https://github.com/asherikov/wshandler/releases/latest/download/wshandler-$(uname -m).AppImage" > "${BIN_PATH}/wshandler" + chmod +x "${BIN_PATH}/wshandler" + exit;; + *) help 1;; esac