diff options
| -rw-r--r-- | type/__dtnrch_etax_flnp/.gitignore | 1 | ||||
| -rwxr-xr-x | type/__dtnrch_etax_flnp/explorer/jvms | 129 | ||||
| -rwxr-xr-x | type/__dtnrch_etax_flnp/files/find_release.sh | 95 | ||||
| -rwxr-xr-x | type/__dtnrch_etax_flnp/files/get_release_props.sh | 41 | ||||
| -rwxr-xr-x | type/__dtnrch_etax_flnp/files/ini_get_section.awk | 42 | ||||
| -rwxr-xr-x | type/__dtnrch_etax_flnp/files/ini_sections.awk | 23 | ||||
| -rw-r--r-- | type/__dtnrch_etax_flnp/files/versions/2018/META.ini | 36 | ||||
| -rw-r--r-- | type/__dtnrch_etax_flnp/files/versions/2019/META.ini | 36 | ||||
| -rw-r--r-- | type/__dtnrch_etax_flnp/files/versions/2020/META.ini | 23 | ||||
| -rw-r--r-- | type/__dtnrch_etax_flnp/man.rst | 64 | ||||
| -rwxr-xr-x | type/__dtnrch_etax_flnp/manifest | 199 | ||||
| -rw-r--r-- | type/__dtnrch_etax_flnp/parameter/boolean | 1 | ||||
| -rw-r--r-- | type/__dtnrch_etax_flnp/parameter/default/state | 1 | ||||
| -rw-r--r-- | type/__dtnrch_etax_flnp/parameter/optional | 1 | ||||
| -rw-r--r-- | type/__dtnrch_etax_flnp/parameter/required | 1 |
15 files changed, 693 insertions, 0 deletions
diff --git a/type/__dtnrch_etax_flnp/.gitignore b/type/__dtnrch_etax_flnp/.gitignore new file mode 100644 index 0000000..0a2101f --- /dev/null +++ b/type/__dtnrch_etax_flnp/.gitignore @@ -0,0 +1 @@ +/cache/ diff --git a/type/__dtnrch_etax_flnp/explorer/jvms b/type/__dtnrch_etax_flnp/explorer/jvms new file mode 100755 index 0000000..eb91583 --- /dev/null +++ b/type/__dtnrch_etax_flnp/explorer/jvms @@ -0,0 +1,129 @@ +#!/bin/sh -e +# +# 2021 Dennis Camera (cdist at dtnr.ch) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see <http://www.gnu.org/licenses/>. +# +# Finds all installed JVMs + +jvm_ver() ( + jvm_dir=${1:?} + test -x "${jvm_dir}/bin/java" || return 1 + + version_output=$("${jvm_dir}/bin/java" -version 2>&1) + + # ignore gcj + test "$(expr "${version_output}" : '.*gcj')" = 0 || return 1 + + java_version=$(expr "${version_output}" : '.*"\(.*\)".*') + + read -r ver_major ver_minor ver_micro ver_patch ver_b <<-EOF + $( + printf '%s\n' "${java_version}" | awk ' + { + split($0, chars, "") + p = 1 + for (i = 1; i in chars; i++) { + c = chars[i] + if (c ~ /[0-9]/) { + v[p] = v[p] c + } else if (p < 4 && c == ".") { + p++ + } else if (c == "_") { + p = 4; v[p] = "" + } else if (chars[i] chars[i+1] == "-b") { + p = 5; v[p] = ""; i++ + } else if (c == "+") { + p = 5; v[p] = "" + } else if (p == 5 && c == "-") { + p = 6; v[p] = "" + } else + break + } + + for (i = 1; i <= 6; i++) + printf "%s%s", (i > 1 ? " " : ""), v[i]+0 + printf "\n" + }') + EOF + + if test $((ver_major)) -eq 1 + then + printf '%u 0 %u %u\n' $((ver_minor)) $((ver_micro)) $((ver_patch)) + else + printf '%u %u %u %u\n' $((ver_major)) $((ver_minor)) $((ver_micro)) $((ver_patch)) + fi +) + +os=$("${__explorer:?}/os") +case ${os} +in + (debian|devuan) + set -- /usr/lib/jvm/* + ;; + (macosx) + set -- /Library/Java/JavaVirtualMachines/*.jdk/Contents/Home/jre \ + /Library/Java/JavaVirtualMachines/*.jre/Contents/Home \ + /Library/Java/JavaVirtualMachines/*.jdk/Contents/Home \ + /System/Library/Frameworks/JavaVM.framework/Versions/1.?/Home \ + /Library/Internet\ Plug-Ins/JavaAppletPlugin.plugin/Contents/Home + ;; + (*) + # Just guessing... + set -- /usr/bin/java* \ + /usr/bin/jre* \ + /usr/bin/jdk* \ + /usr/bin/j2*re* \ + /usr/bin/j2sdk* \ + /usr/java*/jre \ + /usr/java* \ + /usr/jre* \ + /usr/jdk* \ + /usr/j2*re* \ + /usr/j2sdk* \ + /usr/java/j2*re* \ + /usr/java/j2sdk* \ + /opt/java* \ + /usr/java/jre* \ + /usr/java/jdk* \ + /usr/lib/java/jre \ + /usr/local/java* \ + /usr/local/jre* \ + /usr/local/jdk* \ + /usr/local/j2*re* \ + /usr/local/j2sdk* \ + /usr/jdk/java* \ + /usr/jdk/jre* \ + /usr/jdk/jdk* \ + /usr/jdk/j2*re* \ + /usr/jdk/j2sdk* \ + /usr/lib/jvm/* \ + /usr/lib/java* \ + /usr/lib/jre* \ + /usr/lib/jdk* \ + /usr/lib/j2*re* \ + /usr/lib/j2sdk* + ;; +esac + +for jvm_loc +do + test -d "${jvm_loc}" -a ! -h "${jvm_loc}" || continue + + printf '%s %s\n' "$(jvm_ver "${jvm_loc}")" "${jvm_loc}" +done \ +| LC_ALL=C sort -t ' ' -k 1n -k 2nr -k 3nr -k 4nr \ +| cut -d ' ' -f 1,2,5- diff --git a/type/__dtnrch_etax_flnp/files/find_release.sh b/type/__dtnrch_etax_flnp/files/find_release.sh new file mode 100755 index 0000000..d5cb5ad --- /dev/null +++ b/type/__dtnrch_etax_flnp/files/find_release.sh @@ -0,0 +1,95 @@ +#!/bin/sh -e +# +# 2021 Dennis Camera (cdist at dtnr.ch) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see <http://www.gnu.org/licenses/>. +# + + +kernel_name=$(cat "${__global:?}/explorer/kernel_name") +machine=$(cat "${__global:?}/explorer/machine") +os=$(cat "${__global:?}/explorer/os") + +version=$(cat "${__object:?}/parameter/version") + +# Check if the version number is valid +test -d "${__type:?}/files/versions/${version}" \ +&& test -f "${__type:?}/files/versions/${version}/META.ini" \ +|| exit 1 + +# Determine available "OS releases" +case ${kernel_name} +in + (Darwin) + options='macosx' + ;; + (*CYGWIN*|*NT*) + options='windows' + ;; + (*) + bit_suffix() { + case ${machine} + in + (*64*) echo "${1}64 ${1} ${1}32" ;; + (*) echo "${1} ${1}32" ;; + esac + } + + case ${os} + in + (debian|devuan|ubuntu) + options=$(bit_suffix debian) ;; + (rhel|scientific|centos|fedora) + options=$(bit_suffix redhat) ;; + (suse) + options=$(bit_suffix suse) ;; + esac + + case ${kernel_name} + in + (Linux) + options=${options-}${options:+ }$(bit_suffix linux) + ;; + (*BSD) + options=${options-}${options:+ }$(bit_suffix bsd) + ;; + esac + + options=${options-}${options:+ }$(bit_suffix unix) + ;; +esac + +metafile="${__type:?}/files/versions/${version}/META.ini" +sections=$(command -p awk -f "${__type:?}/files/ini_sections.awk" "${metafile}") + +# Check if any of the available releases are compatible +for _opt in ${options} +do + if printf '%s\n' "${sections}" | grep -Fqx "${_opt}" + then + variant=${_opt} + break + fi +done +unset _opt + +if test -n "${variant}" +then + printf '%s\n' "${variant}" +else + echo 'No compatible release found.' >&2 + exit 1 +fi diff --git a/type/__dtnrch_etax_flnp/files/get_release_props.sh b/type/__dtnrch_etax_flnp/files/get_release_props.sh new file mode 100755 index 0000000..2cb1895 --- /dev/null +++ b/type/__dtnrch_etax_flnp/files/get_release_props.sh @@ -0,0 +1,41 @@ +#!/bin/sh -e +# +# 2021 Dennis Camera (cdist at dtnr.ch) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see <http://www.gnu.org/licenses/>. +# + +version=$(cat "${__object:?}/parameter/version") + +AWK=$(command -p -v awk) +for sect in '' "${1:?no release given}" +do + "${AWK}" -f "${__type:?}/files/ini_get_section.awk" \ + "${sect}" \ + "${__type:?}/files/versions/${version}/META.ini" +done \ +| "${AWK}" ' + /=/ { + k = toupper(substr($0, 1, index($0, "=") - 1)) + sub(/ *$/, "", k) + v = substr($0, index($0, "=") + 1) + sub(/^ */, "", v) + sub(/ *$/, "", v) + if (v ~ /^".*"$/ || v ~ /^'\''.*'\''$/) + v = substr(v, 2, length(v) - 2) + gsub(/'\''/, "'\''\\'\'''\''", v) + printf "%s='\''%s'\''\n", k, v + }' diff --git a/type/__dtnrch_etax_flnp/files/ini_get_section.awk b/type/__dtnrch_etax_flnp/files/ini_get_section.awk new file mode 100755 index 0000000..42a9699 --- /dev/null +++ b/type/__dtnrch_etax_flnp/files/ini_get_section.awk @@ -0,0 +1,42 @@ +#!/usr/bin/awk -f +# +# 2021 Dennis Camera (cdist at dtnr.ch) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see <http://www.gnu.org/licenses/>. +# +# Print the lines of an .ini file inside a section. +# + +BEGIN { + SECTION = ARGV[1] + + for (i = 1; i <= ARGC; ++i) + ARGV[i] = ARGV[i+1] + ARGC-- + + if (!SECTION) { select = 1; m++ } +} + +/^[ \t]*$/ { next } +/^\[.*\]$/ { + select = ($0 == "[" SECTION "]") + if (select) m++ + next +} + +select + +END { exit !m } diff --git a/type/__dtnrch_etax_flnp/files/ini_sections.awk b/type/__dtnrch_etax_flnp/files/ini_sections.awk new file mode 100755 index 0000000..7fdcec9 --- /dev/null +++ b/type/__dtnrch_etax_flnp/files/ini_sections.awk @@ -0,0 +1,23 @@ +#!/usr/bin/awk -f +# +# 2021 Dennis Camera (cdist at dtnr.ch) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see <http://www.gnu.org/licenses/>. +# +# Prints all the sections in an .ini file. +# + +/^\[.*\]$/ { print substr($0, 2, length - 2) } diff --git a/type/__dtnrch_etax_flnp/files/versions/2018/META.ini b/type/__dtnrch_etax_flnp/files/versions/2018/META.ini new file mode 100644 index 0000000..fb9abc9 --- /dev/null +++ b/type/__dtnrch_etax_flnp/files/versions/2018/META.ini @@ -0,0 +1,36 @@ +version = 2018 +release = 1.0.0-51 +java = 1.8.0_192-b12 +java_min = 1.8.0 + +[macosx] +url = https://downloads.llv.li/stv/eTaxNP_2018/osx/etaxflnp2018-1.0.0-51.pkg +filename = etaxflnp2018-1.0.0-51.pkg +sha256sum = ebc386d035d6d1d95323be5fce30d2e0c8080b5672ede16b7a700269ea19aee7 +cksum = 221124049 86246489 + +[debian64] +url = http://downloads.llv.li/stv/eTaxNP_2018/linux/etaxflnp2018_1.0.0-51_amd64.deb +filename = etaxflnp2018_1.0.0-51_amd64.deb +sha256sum = a84826daee00410c66236569b643d9f5cf1d291af5bf5129c760c5686d435ab4 +cksum = 1085383761 73354744 +install_dir = /usr/share/etaxflnp2018 + +[debian32] +url = http://downloads.llv.li/stv/eTaxNP_2018/linux/etaxflnp2018_1.0.0-51_i386.deb +filename = etaxflnp2018_1.0.0-51_i386.deb +sha256sum = ead4038580f1e5a45ce1ad42fd216f548b7c95f18b6c9f735c4adf6127e3994c +cksum = 3931604483 75893956 +install_dir = /usr/share/etaxflnp2018 + +[suse64] +url = https://downloads.llv.li/stv/eTaxNP_2018/linux/etaxflnp2018-1.0.0-51.x86_64.rpm +filename = etaxflnp2018-1.0.0-51.x86_64.rpm +sha256sum = dd3717fd0e77778bfd2bbda0937a7ca5b0e46818c2f33a4ced5db1ec6877c146 +cksum = 1089855242 99148078 + +[suse32] +url = https://downloads.llv.li/stv/eTaxNP_2018/linux/etaxflnp2018-1.0.0-51.i386.rpm +filename = etaxflnp2018-1.0.0-51.i386.rpm +sha256sum = 0c90cc08312e02a54b1131ae2c8d5ef97018f8bba0037ae5f4b100e1524e7caf +cksum = 3101920363 102350385 diff --git a/type/__dtnrch_etax_flnp/files/versions/2019/META.ini b/type/__dtnrch_etax_flnp/files/versions/2019/META.ini new file mode 100644 index 0000000..b37db45 --- /dev/null +++ b/type/__dtnrch_etax_flnp/files/versions/2019/META.ini @@ -0,0 +1,36 @@ +version = 2019 +release = 1.0.3-60 +java = 1.8.0_292-b10 +java_min = 1.8.0 + +[macosx] +url = https://downloads.llv.li/stv/etax/update/etaxflnp/2019/etaxflnp2019-1.0.3-60.pkg +filename = etaxflnp2019-1.0.3-60.pkg +sha256sum = 1e672a47f12544e02e8d940dd2c1ea9d8e5b84f63247aa35adbe622ee02c6ee2 +cksum = 2867843604 89739166 + +[debian64] +url = https://downloads.llv.li/stv/etax/update/etaxflnp/2019/etaxflnp2019_1.0.3-60_amd64.deb +filename = etaxflnp2019_1.0.3-60_amd64.deb +sha256sum = c6d033631fd5d6cfe562d6901e9e64ab9a9deaa0f2934257f1e55b8504eddbd5 +cksum = 1259388338 77187208 +install_dir = /usr/share/etaxflnp2019 + +[debian32] +url = https://downloads.llv.li/stv/etax/update/etaxflnp/2019/etaxflnp2019_1.0.3-60_i386.deb +filename = etaxflnp2019_1.0.3-60_i386.deb +sha256sum = 489591e6bd157bbae826773832181c0d1d277db71fbc9c9dcab89c441e951165 +cksum = 3005329170 79350374 +install_dir = /usr/share/etaxflnp2019 + +[suse64] +url = https://downloads.llv.li/stv/etax/update/etaxflnp/2019/etaxflnp2019-1.0.3-60.x86_64.rpm +filename = etaxflnp2019-1.0.3-60.x86_64.rpm +sha256sum = 4706c25c8c0ea4a922c99a84a580b37cf2fb6d1c92526c9cb978d4e55fca694d +cksum = 3182094197 102629179 + +[suse32] +url = https://downloads.llv.li/stv/etax/update/etaxflnp/2019/etaxflnp2019-1.0.3-60.i386.rpm +filename = etaxflnp2019-1.0.3-60.i386.rpm +sha256sum = 65658af5d09127106d54159afbf880498c3fa56806d99fcb5e66fd646ff9b1d3 +cksum = 2456092976 105845538 diff --git a/type/__dtnrch_etax_flnp/files/versions/2020/META.ini b/type/__dtnrch_etax_flnp/files/versions/2020/META.ini new file mode 100644 index 0000000..980e61e --- /dev/null +++ b/type/__dtnrch_etax_flnp/files/versions/2020/META.ini @@ -0,0 +1,23 @@ +version = 2020 +release = 1.0.8-74 +java = 1.14.0.2+12 +java_min = 1.8.0 + +[macosx] +url = https://downloads.llv.li/stv/etax/update/etaxflnp/2020/etaxflnp2020-1.0.8-74.pkg +filename = etaxflnp2020-1.0.8-74.pkg +sha256sum = cbd3253272c118c52bcf0389c4b3daeb087d1ac250be2100f204705ae17e3fc2 +cksum = 2547544327 91748981 + +[debian64] +url = https://downloads.llv.li/stv/etax/update/etaxflnp/2020/etaxflnp2020_1.0.8-74_amd64.deb +filename = etaxflnp2020_1.0.8-74_amd64.deb +sha256sum = ff733a7ecb1d610180d497c473853e3910b681e16525fa9555bbbf3f8cb2e2b2 +cksum = 1105019897 84096844 +install_dir = /usr/share/etaxflnp2020 + +[suse64] +url = https://downloads.llv.li/stv/etax/update/etaxflnp/2020/etaxflnp2020-1.0.8-74.x86_64.rpm +filename = etaxflnp2020-1.0.8-74.x86_64.rpm +sha256sum = c721c9a7780d135224479a1dc65536570c9a801c32dbc227ccb6dabb93399e2e +cksum = 3518281697 100252855 diff --git a/type/__dtnrch_etax_flnp/man.rst b/type/__dtnrch_etax_flnp/man.rst new file mode 100644 index 0000000..1b3f4c8 --- /dev/null +++ b/type/__dtnrch_etax_flnp/man.rst @@ -0,0 +1,64 @@ +cdist-type__dtnrch_etax_fpnp(7) +=============================== + +NAME +---- +cdist-type__dtnrch_etax_fpnp - Install eTax FL natürliche Personen. + + +DESCRIPTION +----------- +Installs the eTax FLnP application. + + +REQUIRED PARAMETERS +------------------- +version + The version (year number) of the eTax FLnP application to install. + + +OPTIONAL PARAMETERS +------------------- +state + One of: + + ``present`` + Ensure the application is installed. + ``absent`` + Ensure the application is not installed. + + +BOOLEAN PARAMETERS +------------------ +use-system-jvm + Delete the bundled JRE and use a system JRE instead. + + +EXAMPLES +-------- + +.. code-block:: sh + + # Install with defaults + __dtnrch_etax_flnp eTax_FL_2020_nP --version 2020 + + # Uninstall the application + __dtnrch_etax_flnp eTax_FL_2020_nP --version 2020 --state absent + + +SEE ALSO +-------- +None. + + +AUTHORS +------- +Dennis Camera <cdist--@--dtnr.ch> + + +COPYING +------- +Copyright \(C) 2021 Dennis Camera. You can redistribute it +and/or modify it under the terms of the GNU General Public License as +published by the Free Software Foundation, either version 3 of the +License, or (at your option) any later version. diff --git a/type/__dtnrch_etax_flnp/manifest b/type/__dtnrch_etax_flnp/manifest new file mode 100755 index 0000000..a1be071 --- /dev/null +++ b/type/__dtnrch_etax_flnp/manifest @@ -0,0 +1,199 @@ +#!/bin/sh -e +# +# 2021 Dennis Camera (cdist at dtnr.ch) +# +# This file is part of cdist. +# +# cdist is free software: you can redistribute it and/or modify +# it under the terms of the GNU General Public License as published by +# the Free Software Foundation, either version 3 of the License, or +# (at your option) any later version. +# +# cdist is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU General Public License for more details. +# +# You should have received a copy of the GNU General Public License +# along with cdist. If not, see <http://www.gnu.org/licenses/>. +# + +quote() { printf "'%s'" "$(printf '%s\n' "$*" | sed -e "s/'/'\\\\''/g")"; } +strmatch() { eval "case \$1 in ($2) return 0 ;; (*) return 1 ;; esac"; } + +version_ge() { + test "$1" = "$( + printf '%s\n' "$1" "$2" | tr . , \ + | sort -t, -n -k1 -k2 -k3 | tr , . | tail -n 1)" +} + + +os=$(cat "${__global:?}/explorer/os") +machine_arch=$(cat "${__global:?}/explorer/machine") + +state_should=$(cat "${__object:?}/parameter/state") + +version=$(cat "${__object:?}/parameter/version") + +test -f "${__type:?}/files/versions/${version}/META.ini" || { + printf 'No such version: %s\n' "${version}" >&2 + exit 1 +} + +if release=$(sh -e "${__type:?}/files/find_release.sh") +then + if strmatch "${machine_arch}" '*64*' \ + && strmatch "${release}" '*32' + then + strmatch "${os}" 'devuan|devuan|ubuntu' || { + printf '%s: system is 64-bit, but installer is 32-bit.\n' "${__object_name:?}" >&2 + printf 'But multi-arch has not been implemented for %s.\n' "${os}" >&2 + exit 1 + } + + # need multi-arch + case ${machine_arch} + in + (x86_64) + __dpkg_architecture i386 + # for _p32 in libc6 libxtst6 + # do + # require=__dpkg_architecture/i386 \ + # __package_apt "${_p32}:i386" + # require32="${require32-}${require32:+ }__package_apt/${_p32}:i386" + # done + ;; + (*) + printf 'Do not know the corresponding 32-bit arch to %s.\n' "${machine_arch}" >&2 + exit 1 + ;; + esac + fi + + # Print all of the keys of the best-matching release + rel_props=$("${__type:?}/files/get_release_props.sh" "${release}") + eval "${rel_props}" +else + echo 'No release compatible with the target could be found.' >&2 + exit 1 +fi + + +################################################################################ +# Parameters + +case ${os} +in + (debian|devuan|ubuntu) + bundled_java_path="jre" + ;; + # (macosx) + # bundled_java_path=".install4j/jre.bundle" + # ;; + (*) + : "${__type:?}" # make shellcheck happy + echo "Your operating system (${os}) is currently not supported by this type (${__type##*/})." >&2 + echo "Please contribute an implementation for it if you can." >&2 + exit 1 + ;; +esac + + +################################################################################ +# Download and install eTax application + +case ${FILENAME} +in + (*.deb) + deb_name=${FILENAME:?} + + if test "${state_should}" != 'absent' + then + # DEB installation requires the .deb to be available locally + local_download_dir="${__type:?}/cache" + test -d "${local_download_dir:?}" || mkdir "${local_download_dir:?}" + local_file="${local_download_dir:?}/${deb_name}" + + if test ! -e "${local_file}" + then + # Download package + for _url in "${URL-}" "${URL_ALT-}" "${URL_ARCHIVE-}" + do + test -n "${_url}" || continue + + python3 -c 'import sys, urllib.request; urllib.request.urlretrieve(*sys.argv[1:3])' "${_url}" "${local_file}" \ + && break || continue + done + unset _url + fi + + test -n "${CKSUM-}" || { + echo 'Do not know the correct cksum.' >&2 + exit 1 + } + test "$(cksum "${local_file}" | cut -d' ' -f1,2)" = "${CKSUM}" || { + echo 'Checksums do not match.' >&2 + exit 1 + } + fi + + if test -f "${__object:?}/parameter/use-system-jvm" -a "${state_should}" = 'absent' + then + # HACK: When uninstalling the jre link needs to be removed first, + # because dpkg --remove will otherwise delete parts of the system JVM. + require="${require-}${require:+ }__link/${INSTALL_DIR:?}/${bundled_java_path}" + fi + + require="${require-}${require32:+ }${require32-}" \ + __package_dpkg "${deb_name}" \ + --source "${local_file-}" \ + --state "${state_should}" \ + --purge-if-absent + + test "${state_should}" = 'absent' || + export require="${require-}${require:+ }__package_dpkg/${deb_name}" + ;; + (*) + printf 'Support for this file type not implemented: %s\n' "${FILENAME##*.}" >&2 + exit 1 + ;; +esac + + +################################################################################ +# Replace JVM (if requested) + +if test -f "${__object:?}/parameter/use-system-jvm" \ + || test "${NO_JRE:-0}" -ne 0 +then + if test "${state_should}" != 'absent' + then + java_min_ver=${JAVA_MIN:?no java_min defined for version ${version}} + exec 3<"${__object:?}/explorer/jvms" + while read -r v1 v2 jvm_path <&3 + do + jvm_ver=1.$((v1)).$((v2)) + unset v1 v2 + + if version_ge "${jvm_ver:-0}" "${java_min_ver}"; then break; fi + done + exec 3<&- + + version_ge "${jvm_ver:-0}" "${java_min_ver}" || { + printf 'No JVM found matching minimum requirement (%s). Found only %s.\n' \ + "${java_min_ver}" "${jvm_ver:-(none)}" >&2 + exit 1 + } + + __link "${INSTALL_DIR:?}/${bundled_java_path}" --type symbolic --source "${jvm_path:?}" + + # If the JVM is replaced, we disable the JVM warning dialog at startup + # FIXME: BREify install dir in pattern + require="__link/${INSTALL_DIR:?}/${bundled_java_path}" \ + __check_messages "${__type##*/}-${version}-allow_system_jvm" \ + --pattern "^__link${INSTALL_DIR:?}/${bundled_java_path}:" \ + --execute "sed -i -e '/^[a-z]*TestedVM=/s/=.*\$/=*/' -e '/^runOnUntestedVM=/s/=.*\$/=true/' $(quote "${INSTALL_DIR:?}/configuration.properties")" + else + __link "${INSTALL_DIR:?}/${bundled_java_path}" --state absent --type symbolic --source '' + fi +fi diff --git a/type/__dtnrch_etax_flnp/parameter/boolean b/type/__dtnrch_etax_flnp/parameter/boolean new file mode 100644 index 0000000..dd8ae22 --- /dev/null +++ b/type/__dtnrch_etax_flnp/parameter/boolean @@ -0,0 +1 @@ +use-system-jvm diff --git a/type/__dtnrch_etax_flnp/parameter/default/state b/type/__dtnrch_etax_flnp/parameter/default/state new file mode 100644 index 0000000..e7f6134 --- /dev/null +++ b/type/__dtnrch_etax_flnp/parameter/default/state @@ -0,0 +1 @@ +present diff --git a/type/__dtnrch_etax_flnp/parameter/optional b/type/__dtnrch_etax_flnp/parameter/optional new file mode 100644 index 0000000..ff72b5c --- /dev/null +++ b/type/__dtnrch_etax_flnp/parameter/optional @@ -0,0 +1 @@ +state diff --git a/type/__dtnrch_etax_flnp/parameter/required b/type/__dtnrch_etax_flnp/parameter/required new file mode 100644 index 0000000..088eda4 --- /dev/null +++ b/type/__dtnrch_etax_flnp/parameter/required @@ -0,0 +1 @@ +version |
