aboutsummaryrefslogtreecommitdiffstats
path: root/hyperterm/core
diff options
context:
space:
mode:
authorJesús <heckyel@hyperbola.info>2021-12-28 22:03:15 -0500
committerJesús <heckyel@hyperbola.info>2021-12-28 22:03:15 -0500
commitb44c1de16bcf5c44e6b1ce607f9a90d72c28e442 (patch)
tree38749af56284dc6c07574ad5c5065862b04b134d /hyperterm/core
parent1a158051507e50205d89f2c70940c6310e72517d (diff)
downloadhyperterm-b44c1de16bcf5c44e6b1ce607f9a90d72c28e442.tar.lz
hyperterm-b44c1de16bcf5c44e6b1ce607f9a90d72c28e442.tar.xz
hyperterm-b44c1de16bcf5c44e6b1ce607f9a90d72c28e442.zip
[update.sh]: refactory
Diffstat (limited to 'hyperterm/core')
-rw-r--r--hyperterm/core/update.sh30
1 files changed, 9 insertions, 21 deletions
diff --git a/hyperterm/core/update.sh b/hyperterm/core/update.sh
index 841780f..03e3608 100644
--- a/hyperterm/core/update.sh
+++ b/hyperterm/core/update.sh
@@ -10,32 +10,20 @@ function _which() {
# Check URL's
# ---------------------
function _url_exists() {
- if _which wget; then
- if wget --spider "$1" 2>/dev/null; then
- return 0 # URL 'ok'
- else
- return 1 # URL 'fail'
- fi
- elif _which curl; then
- if curl --output /dev/null --silent --head --fail "$1"; then
- return 0 # URL 'ok'
- else
- return 1 # URL 'fail'
- fi
- fi
+ curl --output /dev/null 2>&1 -s -w "%{http_code}\n" "$1"
}
function _urls() {
URL_1="https://c.hgit.ga/software/hyperterm.git"
URL_2="https://git.sr.ht/~heckyel/hyperterm"
-
- if [[ $(_url_exists "$URL_1") -eq 0 ]]; then
- URL="$URL_1"
- RAW="$URL_1/plain"
- elif [[ $(_url_exists "$URL_2") -eq 0 ]]; then
- URL="$URL_2"
- RAW="$URL_2/blob/master"
- fi
+ case $(_url_exists "$URL_1") in
+ 200) URL="$URL_1"
+ RAW="$URL_1/plain";;
+ esac
+ case $(_url_exists "$URL_2") in
+ 200) URL="$URL_2"
+ RAW="$URL_2/blob/master";;
+ esac
}
# ----------------------