Skip to content

Commit

Permalink
wshandler 0.7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
asherikov committed Dec 19, 2024
1 parent 99fb325 commit e2b9e8b
Showing 1 changed file with 28 additions and 5 deletions.
33 changes: 28 additions & 5 deletions ccws/scripts/wshandler
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,8 @@ help()
echo "wshandler installation commands:"
echo " install_test_deps"
echo " [-p|--policy {skip_yq}|snap|download] install <BIN_PATH {~/bin}>"
echo " upgrade <BIN_PATH {~/bin}>"
echo " upgrade_appimage <BIN_PATH {~/bin}>"

exit "${EXIT_CODE}"
}
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"
;;
Expand All @@ -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
Expand Down

0 comments on commit e2b9e8b

Please sign in to comment.