diff options
| author | Dennis Camera <cdist@dtnr.ch> | 2021-03-14 12:32:57 +0100 |
|---|---|---|
| committer | Dennis Camera <cdist@dtnr.ch> | 2021-03-19 11:06:07 +0100 |
| commit | c884ddf1e1e319cae309612902b4eaf3ca8be076 (patch) | |
| tree | d833543c4cc626f9d91fbb67e319c471df177af3 /type | |
| parent | c87c1486837f6a791abe31bd7632198d44d9973f (diff) | |
| download | __dtnrch_egov-c884ddf1e1e319cae309612902b4eaf3ca8be076.tar.gz __dtnrch_egov-c884ddf1e1e319cae309612902b4eaf3ca8be076.zip | |
[type/__dtnrch_etax_sgnp] Reorganize download code
Diffstat (limited to 'type')
| -rwxr-xr-x | type/__dtnrch_etax_sgnp/manifest | 71 |
1 files changed, 24 insertions, 47 deletions
diff --git a/type/__dtnrch_etax_sgnp/manifest b/type/__dtnrch_etax_sgnp/manifest index fe97508..428206f 100755 --- a/type/__dtnrch_etax_sgnp/manifest +++ b/type/__dtnrch_etax_sgnp/manifest @@ -64,6 +64,9 @@ else fi +################################################################################ +# Download tax application + case ${os} in (debian|devuan|ubuntu) @@ -71,7 +74,6 @@ in __directory "${download_dir}" --state present \ --owner 0 --group 0 --mode 0755 --parents - export require="__directory${download_dir}" ;; (*) # TODO: error message @@ -79,41 +81,32 @@ in ;; esac -################################################################################ -# Check download URLs (to select one that works) - -for _url in "${URL-}" "${URL_ALT-}" "${URL_ARCHIVE-}" -do - test -n "${_url}" || continue - - case $(python3 -c '__import__("sys").stdout.write("%u\n" % __import__("urllib.request").request.urlopen(__import__("sys").argv[1]).getcode())' "${_url}") - in - (200) - url=${_url} - break - ;; - (404|500) - continue - ;; - esac -done -unset _url - -test -n "${CKSUM}" || { - echo 'Do not know the correct cksum.' >&2 - exit 1 -} - - -################################################################################ -# Download tax application - remote_file="${download_dir}/${FILENAME:?}" if test "${state_should}" != 'absent' then + # Check download URLs (to select one that works) + + for _url in "${URL-}" "${URL_ALT-}" "${URL_ARCHIVE-}" + do + test -n "${_url}" || continue + case $(python3 -c '__import__("sys").stdout.write("%u\n" % __import__("urllib.request").request.urlopen(__import__("sys").argv[1]).getcode())' "${_url}") + in + (200) url=${_url}; break ;; + (404|500) continue ;; + esac + done + unset _url + + test -n "${CKSUM}" || { + echo 'Do not know the correct cksum.' >&2 + exit 1 + } + + require="__directory${remote_file%/*}" \ __download "${remote_file}" \ - --url "${url}" --sum "${CKSUM}" \ + --url "${url}" \ + --sum "${CKSUM}" \ --download remote require="${require-}${require:+ }__download${remote_file}" @@ -136,22 +129,6 @@ then install_dir="${prefix}/${install_dir##*/}" fi -################################################################################ -# Install tax application - -if test -s "${__object:?}/parameter/install-dir" -then - install_dir=$(cat "${__object:?}/parameter/install-dir") -else - install_dir=${DEFAULT_INSTALL_DIR:?} - install_dir=${install_dir%/} # no trailing slash -fi -if test -s "${__object:?}/parameter/prefix" -then - prefix=$(cat "${__object:?}/parameter/prefix") - install_dir="${prefix}/${install_dir##*/}" -fi - require="${require}${require32:+ }${require32-}" \ __dtnrch_install4j "${install_dir}" \ --state "${state_should}" \ |
