summaryrefslogtreecommitdiff
path: root/type
diff options
context:
space:
mode:
authorDennis Camera <cdist@dtnr.ch>2021-03-13 23:22:40 +0100
committerDennis Camera <cdist@dtnr.ch>2021-03-19 11:06:07 +0100
commitc87c1486837f6a791abe31bd7632198d44d9973f (patch)
tree38037e283854490158707cd0ae1850bbbdcc1064 /type
parent42d3a5b13b06c2dc8c3edd777cdf30315a8a5667 (diff)
download__dtnrch_egov-c87c1486837f6a791abe31bd7632198d44d9973f.tar.gz
__dtnrch_egov-c87c1486837f6a791abe31bd7632198d44d9973f.zip
[type/__dtnrch_etax_sgnp] Install multi-arch on Debian if 64-bit but only 32-bit installer
Diffstat (limited to 'type')
-rwxr-xr-xtype/__dtnrch_etax_sgnp/files/find_release.sh18
-rwxr-xr-xtype/__dtnrch_etax_sgnp/files/get_release_props.sh37
-rwxr-xr-xtype/__dtnrch_etax_sgnp/gencode-remote5
-rwxr-xr-xtype/__dtnrch_etax_sgnp/manifest38
4 files changed, 77 insertions, 21 deletions
diff --git a/type/__dtnrch_etax_sgnp/files/find_release.sh b/type/__dtnrch_etax_sgnp/files/find_release.sh
index 1445a32..fc7dc66 100755
--- a/type/__dtnrch_etax_sgnp/files/find_release.sh
+++ b/type/__dtnrch_etax_sgnp/files/find_release.sh
@@ -1,6 +1,6 @@
#!/bin/sh -e
#
-# 2021 Dennis Camera (cdist at datenrei.ch)
+# 2021 Dennis Camera (cdist at dtnr.ch)
#
# This file is part of cdist.
#
@@ -91,18 +91,4 @@ test -n "${variant}" || {
exit 1
}
-# Print all of the keys of the best-matching release
-command -p awk -f "${__type:?}/files/ini_get_section.awk" \
- "${variant}" "${metafile}" \
-| command -p 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
- }'
+printf '%s\n' "${variant}"
diff --git a/type/__dtnrch_etax_sgnp/files/get_release_props.sh b/type/__dtnrch_etax_sgnp/files/get_release_props.sh
new file mode 100755
index 0000000..8c54031
--- /dev/null
+++ b/type/__dtnrch_etax_sgnp/files/get_release_props.sh
@@ -0,0 +1,37 @@
+#!/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")
+
+command -p awk -f "${__type:?}/files/ini_get_section.awk" \
+ "${1:?}" \
+ "${__type:?}/files/versions/${version}/META.ini" \
+| command -p 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_sgnp/gencode-remote b/type/__dtnrch_etax_sgnp/gencode-remote
index 9e1adee..a35de8e 100755
--- a/type/__dtnrch_etax_sgnp/gencode-remote
+++ b/type/__dtnrch_etax_sgnp/gencode-remote
@@ -25,9 +25,10 @@ then
prefix=$(cat "${__object:?}/parameter/prefix")
fi
-if meta=$(sh -e "${__type:?}/files/find_release.sh")
+if release=$(sh -e "${__type:?}/files/find_release.sh")
then
- eval "${meta}"
+ rel_props=$("${__type:?}/files/get_release_props.sh" "${release}")
+ eval "${rel_props}"
else
echo 'No release compatible for the target could be found.' >&2
exit 1
diff --git a/type/__dtnrch_etax_sgnp/manifest b/type/__dtnrch_etax_sgnp/manifest
index be625bc..fe97508 100755
--- a/type/__dtnrch_etax_sgnp/manifest
+++ b/type/__dtnrch_etax_sgnp/manifest
@@ -18,14 +18,46 @@
# along with cdist. If not, see <http://www.gnu.org/licenses/>.
#
+strmatch() { eval "case \$1 in ($2) return 0 ;; (*) return 1 ;; esac"; }
os=$(cat "${__global:?}/explorer/os")
+machine_arch=$(cat "${__global:?}/explorer/machine")
state_should=$(cat "${__object:?}/parameter/state")
-if meta=$(sh -e "${__type:?}/files/find_release.sh")
+if release=$(sh -e "${__type:?}/files/find_release.sh")
then
- eval "${meta}"
+ 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 for the target could be found.' >&2
exit 1
@@ -120,7 +152,7 @@ then
install_dir="${prefix}/${install_dir##*/}"
fi
-require=${require-} \
+require="${require}${require32:+ }${require32-}" \
__dtnrch_install4j "${install_dir}" \
--state "${state_should}" \
--installer "${remote_file}"