modernize multiple seqs and fix deprecated use of endCheckEmpty
This commit is contained in:
@@ -1,27 +1,21 @@
|
||||
#!/bin/bash
|
||||
|
||||
toolName=element-web
|
||||
latestUrl="https://api.github.com/repos/vector-im/element-web/releases/latest"
|
||||
readonly toolName=element-web
|
||||
readonly latestUrl="https://api.github.com/repos/vector-im/element-web/releases/latest"
|
||||
|
||||
# Get script working directory
|
||||
# (when called from a different directory)
|
||||
WDIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >>/dev/null 2>&1 && pwd )"
|
||||
CONFIG=0
|
||||
CONFIG_FILE_NAME="${toolName}.cfg"
|
||||
CONFIG_FILE_TEMPLATE="$WDIR/${CONFIG_FILE_NAME}.example"
|
||||
sq_config=0
|
||||
|
||||
seq_config() {
|
||||
initSeqConfig "$CONFIG_FILE_NAME" "$CONFIG_FILE_TEMPLATE"
|
||||
if [ $? -eq 0 ] ; then
|
||||
if initSeqConfig "${seq_configName:?}" "${seq_configTemplate:?}" ; then
|
||||
echo " ${toolName} path: ${ELEMENT_WEB_LOC}"
|
||||
echo " ${toolName} backup: ${ELEMENT_WEB_BACKUP}"
|
||||
CONFIG=1
|
||||
sq_config=1
|
||||
fi
|
||||
}
|
||||
|
||||
step_18_info() { echo "Check for updates"; }
|
||||
step_18_alias() { echo "updatecheck"; }
|
||||
step_18() {
|
||||
step_1_info() { echo "Check for updates"; }
|
||||
step_1_alias() { echo "updatecheck"; }
|
||||
step_1() {
|
||||
shift
|
||||
local latestVersion=
|
||||
if [ ! -z "${1:-}" ] ; then
|
||||
@@ -30,8 +24,8 @@ step_18() {
|
||||
latestVersion=$(curl --silent "$latestUrl" | grep -Po '"tag_name": "v\K.*?(?=")')
|
||||
fi
|
||||
|
||||
local isInstalled=$(grep -E "${latestVersion}" "${ELEMENT_WEB_LOC}/version" >>/dev/null && echo "1" || echo "0")
|
||||
if [ $isInstalled -eq 1 ] ; then
|
||||
local isInstalled=$(grep -E "${latestVersion}" "${ELEMENT_WEB_LOC:-}/version" >>/dev/null 2>&1 && echo "1" || echo "0")
|
||||
if (( isInstalled )) ; then
|
||||
echo " [I] Version $latestVersion is already installed"
|
||||
return 1
|
||||
else
|
||||
@@ -42,18 +36,19 @@ step_18() {
|
||||
|
||||
|
||||
step_20_info() {
|
||||
echo -n "Create a backup [ELEMENT WEB ROOT]"
|
||||
if [ $CONFIG -ne 0 ] ; then
|
||||
echo -n "Create a backup"
|
||||
if (( sq_config )) ; then
|
||||
echo " at $ELEMENT_WEB_BACKUP"
|
||||
else
|
||||
echo
|
||||
fi
|
||||
}
|
||||
step_20_options() { echo "[ELEMENT WEB ROOT]"; }
|
||||
step_20_alias() { echo "backup"; }
|
||||
step_20() {
|
||||
shift
|
||||
local tempRoot=
|
||||
if [ $CONFIG -eq 0 ] ; then
|
||||
if (( ! sq_config )) ; then
|
||||
error -e "No configuration file found"
|
||||
return 1
|
||||
fi
|
||||
@@ -79,12 +74,13 @@ step_22_info() {
|
||||
if ! contextHelp ; then
|
||||
echo ": $(curl --silent "$latestUrl" | grep -Po '"tag_name": "\K.*?(?=")')"
|
||||
else
|
||||
echo " [CUSTOM VERSION]"
|
||||
echo
|
||||
fi
|
||||
else
|
||||
echo "Get version $1 from github"
|
||||
fi
|
||||
}
|
||||
step_22_options() { echo "[CUSTOM VERSION]"; }
|
||||
step_22_alias() { echo "upgrade"; }
|
||||
step_22() {
|
||||
shift # don't need step number
|
||||
@@ -160,5 +156,7 @@ step_24() {
|
||||
exe rm -rf "$tempDown"
|
||||
}
|
||||
|
||||
# shellcheck disable=SC2034 # Appears unused
|
||||
readonly sqr_minVersion=16
|
||||
# shellcheck disable=SC1091 # Don't follow this source
|
||||
. /usr/local/bin/sequencer.sh
|
||||
|
Reference in New Issue
Block a user