diff options
| -rwxr-xr-x | type/__dtnrch_etax_sgnp/gencode-remote | 18 | ||||
| -rwxr-xr-x | type/__dtnrch_etax_sgnp/manifest | 70 |
2 files changed, 54 insertions, 34 deletions
diff --git a/type/__dtnrch_etax_sgnp/gencode-remote b/type/__dtnrch_etax_sgnp/gencode-remote index 7e91092..215f66b 100755 --- a/type/__dtnrch_etax_sgnp/gencode-remote +++ b/type/__dtnrch_etax_sgnp/gencode-remote @@ -25,6 +25,21 @@ then prefix=$(cat "${__object:?}/parameter/prefix") fi + +os=$(cat "${__global:?}/explorer/os") +case ${os} +in + (debian|devuan|ubuntu) + is_freedesktop=true + ;; + (macosx) + is_freedesktop=false + ;; + (*) + exit 1 + ;; +esac + if release=$(sh -e "${__type:?}/files/find_release.sh") then rel_props=$("${__type:?}/files/get_release_props.sh" "${release}") @@ -49,8 +64,9 @@ then fi i4j_object_name=$(printf '%s\n' "${install_dir}" | tr ' ' '_') -if grep -q "^__dtnrch_install4j${i4j_object_name}:installed" "${__messages_in:?}" +if grep -q "^__dtnrch_install4j${i4j_object_name}:installed" "${__messages_in:?}" \ + && ${is_freedesktop} then # Post-install routine diff --git a/type/__dtnrch_etax_sgnp/manifest b/type/__dtnrch_etax_sgnp/manifest index 35a3b90..0322929 100755 --- a/type/__dtnrch_etax_sgnp/manifest +++ b/type/__dtnrch_etax_sgnp/manifest @@ -74,21 +74,16 @@ fi ################################################################################ -# Download tax application - +# Parameters case ${os} in (debian|devuan|ubuntu) download_dir="/var/cache/cdist/${__type##*/}" - - __directory "${download_dir}" --state present \ - --owner 0 --group 0 --mode 0755 --parents + is_freedesktop=true ;; (macosx) download_dir="/var/tmp/cdist/${__type##*/}" - - __directory "${download_dir}" --state present \ - --owner 0 --group 0 --mode 0755 --parents + is_freedesktop=false ;; (*) : "${__type:?}" # make shellcheck happy @@ -98,6 +93,13 @@ in ;; esac + +################################################################################ +# Download tax application + +__directory "${download_dir}" --state present \ + --owner 0 --group 0 --mode 0755 --parents + remote_file="${download_dir}/${FILENAME:?}" if test "${state_should}" != 'absent' @@ -216,30 +218,32 @@ else custom_mime_state=absent fi -version=$(cat "${__object:?}/parameter/version") -if test "${custom_mime_state}" = 'present' +if ${is_freedesktop} then - # Generate custom MIME declaration for SGnP application - mkdir "${__object:?}/files" - "${__type:?}/files/mkmime.xml.sh" >"${__object:?}/files/mime-sgnp-${version}.xml" -fi + if test "${custom_mime_state}" = 'present' + then + # Generate custom MIME declaration for SGnP application + mkdir "${__object:?}/files" + "${__type:?}/files/mkmime.xml.sh" >"${__object:?}/files/mime-sgnp-${version}.xml" + fi + + __line /etc/mime.types:"application_x-sgnp-${version}" \ + --state "$(case ${custom_mime_state} in (present) echo replace;; (*) echo "${custom_mime_state}";; esac)" \ + --file /etc/mime.types \ + --line "application/x-sgnp${version} sgnp${version}" \ + --regex "^application/x-sgnp${version} " -__line /etc/mime.types:"application_x-sgnp-${version}" \ - --state "$(case ${custom_mime_state} in (present) echo replace;; (*) echo "${custom_mime_state}";; esac)" \ - --file /etc/mime.types \ - --line "application/x-sgnp${version} sgnp${version}" \ - --regex "^application/x-sgnp${version} " - -xdg_mime_dir=/usr/share/mime -__file "${xdg_mime_dir}/packages/sgnp-${version}.xml" \ - --state "${custom_mime_state}" \ - --owner 0 --group 0 --mode 0644 \ - --source "${__object:?}/files/mime-sgnp-${version}.xml" - -# NOTE/HACK: We try to work around the broken dependency resolver by pushing -# this object back to be executed after this object, hoping that cdist will -# execute other tax objects before updating the MIME database. -require="${__object_name:?} __file${xdg_mime_dir}/packages/sgnp-${version}.xml" \ -__check_messages update_mime_database \ - --pattern "^__file${xdg_mime_dir}" \ - --execute "update-mime-database '${xdg_mime_dir}'" + xdg_mime_dir=/usr/share/mime + __file "${xdg_mime_dir}/packages/sgnp-${version}.xml" \ + --state "${custom_mime_state}" \ + --owner 0 --group 0 --mode 0644 \ + --source "${__object:?}/files/mime-sgnp-${version}.xml" + + # NOTE/HACK: We try to work around the broken dependency resolver by pushing + # this object back to be executed after this object, hoping that cdist will + # execute other tax objects before updating the MIME database. + require="${__object_name:?} __file${xdg_mime_dir}/packages/sgnp-${version}.xml" \ + __check_messages update_mime_database \ + --pattern "^__file${xdg_mime_dir}" \ + --execute "update-mime-database '${xdg_mime_dir}'" +fi |
