diff options
| author | Dennis Camera <cdist@dtnr.ch> | 2021-03-20 20:27:31 +0100 |
|---|---|---|
| committer | Dennis Camera <cdist@dtnr.ch> | 2021-03-20 21:23:13 +0100 |
| commit | beace0166e5eb362fd39f76e2ef59dcc2cfffeab (patch) | |
| tree | 1be999f187a242de358787a3ad92802e4a22afd2 /type | |
| parent | 568bded953f98f1ea929ce7c6e68c87126516a45 (diff) | |
| download | __dtnrch_egov-beace0166e5eb362fd39f76e2ef59dcc2cfffeab.tar.gz __dtnrch_egov-beace0166e5eb362fd39f76e2ef59dcc2cfffeab.zip | |
[type/__dtnrch_install4j] Store installer cksum to detect updates
Diffstat (limited to 'type')
| -rw-r--r-- | type/__dtnrch_install4j/explorer/state | 13 | ||||
| -rwxr-xr-x | type/__dtnrch_install4j/gencode-remote | 5 |
2 files changed, 16 insertions, 2 deletions
diff --git a/type/__dtnrch_install4j/explorer/state b/type/__dtnrch_install4j/explorer/state index e9b3f99..4d3c9d3 100644 --- a/type/__dtnrch_install4j/explorer/state +++ b/type/__dtnrch_install4j/explorer/state @@ -20,11 +20,22 @@ # Print the current installation state of the install4j "package". # +installer=$(cat "${__object:?}/parameter/installer") destination=/${__object_id:?} if test -d "${destination}/.install4j" then - echo 'present' + if find "${destination}/.install4j/inst_cksum" -newer "${destination}/.install4j/files.log" | grep -q . + then + if cksum "${installer}" | cut -d ' ' -f 1,2 | cmp -s "${destination}/.install4j/inst_cksum" - + then + echo 'present' + else + echo 'different' + fi + else + echo 'outdated' + fi else echo 'absent' fi diff --git a/type/__dtnrch_install4j/gencode-remote b/type/__dtnrch_install4j/gencode-remote index 784afc9..d472f95 100755 --- a/type/__dtnrch_install4j/gencode-remote +++ b/type/__dtnrch_install4j/gencode-remote @@ -66,6 +66,7 @@ in fi printf "/bin/sh '%s' %s %s\\n" "${i4j_script}" "${i4j_opts}" "${i4j_vm_opts}" + printf "cksum '%s' | cut -d ' ' -f 1,2 >'%s'\\n" "${i4j_script}" "${destination}/.install4j/inst_cksum" echo 'installed' >>"${__messages_out:?}" ;; @@ -91,6 +92,8 @@ in mkdir "${remote_logs_dir}" || exit 1 + rm -f '${destination}/.install4j/inst_cksum' + i4j_exit=0 /bin/sh '${destination}/uninstall' ${i4j_opts} >"${remote_logs_dir}/i4j_stdout" 2>"${remote_logs_dir}/i4j_stderr" || i4j_exit=$? @@ -98,7 +101,7 @@ in cat >&2 <"${remote_logs_dir}/i4j_stderr" # install4j has issues with using exit codes, so we scan for errors in its output. - awk -v err=$((i4j_exit)) '/^An error occurred:/{if(!err)err=1} END{exit err}' "${remote_logs_dir}/i4j_stdout" "${remote_logs_dir}/i4j_stderr" + awk -v err=$((i4j_exit)) '/^An error occurred:/ || /^Error: A fatal exception has occurred./ {if(!err)err=1} END{exit err}' "${remote_logs_dir}/i4j_stdout" "${remote_logs_dir}/i4j_stderr" EOF echo 'uninstalled' >>"${__messages_out:?}" |
