2022-09-21 17:48:01 -04:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -e
|
|
|
|
RD=`echo "\033[01;31m"`
|
|
|
|
BL=`echo "\033[36m"`
|
|
|
|
CM='\xE2\x9C\x94\033'
|
|
|
|
GN=`echo "\033[1;92m"`
|
|
|
|
CL=`echo "\033[m"`
|
|
|
|
set -o errexit
|
|
|
|
set -o errtrace
|
|
|
|
set -o nounset
|
|
|
|
set -o pipefail
|
|
|
|
shopt -s expand_aliases
|
|
|
|
alias die='EXIT=$? LINE=$LINENO error_exit'
|
|
|
|
trap die ERR
|
|
|
|
|
|
|
|
function error_exit() {
|
|
|
|
trap - ERR
|
|
|
|
local reason="Unknown failure occured."
|
|
|
|
local msg="${1:-$reason}"
|
|
|
|
local flag="${RD}‼ ERROR ${CL}$EXIT@$LINE"
|
|
|
|
echo -e "$flag $msg" 1>&2
|
|
|
|
exit $EXIT
|
|
|
|
}
|
|
|
|
|
|
|
|
echo -en "${GN} Updating Z-wave JS UI... "
|
|
|
|
systemctl stop zwave-js-ui.service
|
2022-09-27 11:46:53 -04:00
|
|
|
cd /opt/zwave-js-ui
|
2022-09-21 17:48:01 -04:00
|
|
|
curl -s https://api.github.com/repos/zwave-js/zwave-js-ui/releases/latest | grep "browser_download_url.*zip" | cut -d : -f 2,3 | tr -d \" | wget -i - &>/dev/null
|
|
|
|
unzip zwave-js-ui-v*.zip zwave-js-ui &>/dev/null
|
|
|
|
echo -e "${CM}${CL} \r"
|
|
|
|
|
|
|
|
echo -en "${GN} Cleanup... "
|
|
|
|
rm zwave-js-ui-v*.zip
|
|
|
|
systemctl --system daemon-reload
|
|
|
|
systemctl start zwave-js-ui.service
|
|
|
|
echo -e "${CM}${CL} \n"
|
|
|
|
|
|
|
|
echo -e "${GN} Finished ${CL}"
|
|
|
|
|