From b44c1de16bcf5c44e6b1ce607f9a90d72c28e442 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jes=C3=BAs?= Date: Tue, 28 Dec 2021 22:03:15 -0500 Subject: [update.sh]: refactory --- hyperterm/core/update.sh | 30 +++++++++--------------------- hyperterm/hyperterm.sha512 | 2 +- 2 files changed, 10 insertions(+), 22 deletions(-) (limited to 'hyperterm') 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 } # ---------------------- diff --git a/hyperterm/hyperterm.sha512 b/hyperterm/hyperterm.sha512 index 689a2d0..7bf5b06 100644 --- a/hyperterm/hyperterm.sha512 +++ b/hyperterm/hyperterm.sha512 @@ -14,7 +14,7 @@ fab9d339a99c7d2e1809d1c44f533523c6bfcdcc8d63c62b335ce7d4c666c8bdd7ac319316bf71f0 7447d3e167ab207d3ef4218e201a06bf5a3fc23281639f16f7f405f1d66b73923845d450fdb0a94672757866a9da0324f728564a1b61b2ed1678fe576eb565cf ./core/autocomplete.sh 065cfa39f1b4312ed275ad1039827a24f703176c653a8d27303d145f9d389a60ec5b3a9eb167e060cc6fd093b9c03cfb1a8b70254d444fbc6e62e2297d88b310 ./core/status.sh 7a832bc25b458eff5ac8d8e41fd8758f7405f7754e619cb2584f411c8819f37f04a65e1ffb9f061c7caa37ba61ef0818f8f6dbb4d05fd7374b1e38e5739a9c6c ./core/git.sh -01b36000294c1db37b043a79d0708b64201d572adda76f4e03d020dae3dc2a43ab40b243f578c5606b1f9a02f7e15bcd5da7647163ceb3e9f2c02264f5ddf35e ./core/update.sh +8396521dc738545c1b412ed7a50723c3a816f1aa950795ff3bcdc05503e9545b99b4b6e9f6c872a493c258a652c15624b7eb76f2e6d3a0fe97ad3100a5e561f1 ./core/update.sh f3e00b2aa8ab9f3ab44570adaa2520408ed66fd00f551654d60b64a4be3546ec781b7efa39bcd774937e654b6ffb4c7af3f21eeb36caf9c01f82f85cf28e2b4d ./core/languages.sh 1cfba599047d84a17ff92b695ebf527a505a30acc9ec21a2b9f410a7ea6dde4b23b5cf62e557d82f2fe9a8980649942424b879ca53baae4d4cb3057681baa7b6 ./core/colors.sh ab3089453e35cc38544dffe672d532cbd559634937893a053937b599175688aecc5f3caad3064e818b883b027f27713194e3909dc3ab0246922cea00557c595a ./hyperterm.sh -- cgit v1.2.3