diff options
Diffstat (limited to 'type')
| -rwxr-xr-x | type/__dtnrch_etax_sgnp/files/mkmime.xml.sh | 62 | ||||
| -rwxr-xr-x | type/__dtnrch_etax_sgnp/manifest | 24 |
2 files changed, 73 insertions, 13 deletions
diff --git a/type/__dtnrch_etax_sgnp/files/mkmime.xml.sh b/type/__dtnrch_etax_sgnp/files/mkmime.xml.sh index 5d73533..e140583 100755 --- a/type/__dtnrch_etax_sgnp/files/mkmime.xml.sh +++ b/type/__dtnrch_etax_sgnp/files/mkmime.xml.sh @@ -2,17 +2,63 @@ version=$(cat "${__object:?}/parameter/version") -cat <<EOF +cat <<'EOF' <?xml version="1.0"?> <mime-info xmlns="http://www.freedesktop.org/standards/shared-mime-info"> <!--Managed by cdist. CHANGES WILL BE OVERWRITTEN. DO NOT EDIT!--> - <mime-type type="application/x-sgnp${version}"> - <comment>Tax declaration St.Gallen nP ${version}</comment> - <comment xml:lang="de">Steuererklärung St.Gallen nP ${version}</comment> - <comment xml:lang="fr">Déclaration d'impôt St.Gallen nP ${version}</comment> - <comment xml:lang="it">Dichiarazione dei redditi St.Gallen nP ${version}</comment> - <comment xml:lang="rm">Decleraziun da taglia St.Gallen nP ${version}</comment> - <glob pattern="*.sgnp${version}"/> +EOF + +# Steuererklärung $((version)) +cat <<EOF + <mime-type type="application/x-sgnp$((version))"> + <comment>Tax declaration St.Gallen nP $((version))</comment> + <comment xml:lang="de">Steuererklärung St.Gallen nP $((version))</comment> + <comment xml:lang="fr">Déclaration d'impôt St.Gallen nP $((version))</comment> + <comment xml:lang="it">Dichiarazione dei redditi St.Gallen nP $((version))</comment> + <comment xml:lang="rm">Decleraziun da taglia St.Gallen nP $((version))</comment> + <glob pattern="*.sgnp$((version))"/> + </mime-type> +EOF + +# Einreichung $((version)) +cat <<EOF + <mime-type type="application/x-sgnp$((version))-submission"> + <comment>Tax submission St.Gallen nP $((version))</comment> + <comment xml:lang="de">Steuereinreichung St.Gallen nP $((version))</comment> + <comment xml:lang="fr">Dépôt d'impôt St.Gallen nP $((version))</comment> + <comment xml:lang="it">Archiviazione fiscale St.Gallen nP $((version))</comment> + <comment xml:lang="rm">Inoltraziun de taglia St.Gallen nP $((version))</comment> +$(for i in 1 2 3 4 5; do printf ' <glob pattern="*.sgnp%u"/>\n' $((version + i * 100)); done) </mime-type> +EOF + +if test $((version)) -ge 2013 +then + # Steuererklärung (Beendigung $((version + 1))) + cat <<-EOF + <mime-type type="application/x-sgbe$((version + 1))"> + <comment>Tax declaration (Ending $((version + 1))) St.Gallen nP</comment> + <comment xml:lang="de">Steuererklärung (Beendigung $((version + 1))) St.Gallen nP</comment> + <comment xml:lang="fr">Déclaration d'impôt (fin $((version + 1))) St.Gallen nP</comment> + <comment xml:lang="it">Dichiarazione dei redditi (fine $((version + 1)) St.Gallen nP</comment> + <comment xml:lang="rm">Decleraziun da taglia (fin $((version + 1))) St.Gallen nP</comment> + <glob pattern="*.sgbe$((version + 1))"/> + </mime-type> + EOF + + # Steuererklärung (Beendigung $((version + 1))) Einreichung + cat <<-EOF + <mime-type type="application/x-sgbe$((version + 1))-submission"> + <comment>Tax submission (ending $((version + 1))) St.Gallen nP</comment> + <comment xml:lang="de">Steuereinreichung (Beendigung $((version + 1))) St.Gallen nP</comment> + <comment xml:lang="fr">Dépôt d'impôt (fin $((version + 1))) St.Gallen nP</comment> + <comment xml:lang="it">Archiviazione fiscale (fine $((version + 1))) St.Gallen nP</comment> + <comment xml:lang="rm">Inoltraziun de taglia (fin $((version + 1))) St.Gallen nP</comment> + $(for i in 1 2 3 4 5; do printf ' <glob pattern="*.sgbe%u"/>\n' $((version + 1 + i * 100)); done) + </mime-type> + EOF +fi + +cat <<'EOF' </mime-info> EOF diff --git a/type/__dtnrch_etax_sgnp/manifest b/type/__dtnrch_etax_sgnp/manifest index 0aff839..db89d70 100755 --- a/type/__dtnrch_etax_sgnp/manifest +++ b/type/__dtnrch_etax_sgnp/manifest @@ -223,25 +223,39 @@ then then # Generate custom MIME declaration for SGnP application mkdir "${__object:?}/files" - "${__type:?}/files/mkmime.xml.sh" >"${__object:?}/files/mime-sgnp-${version}.xml" + "${__type:?}/files/mkmime.xml.sh" >"${__object:?}/files/mime-sgnp${version}.xml" fi - __line /etc/mime.types:"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} " + while read -r _mime _exts + do + __line /etc/mime.types:"application_x-${_mime}" \ + --state "$(case ${custom_mime_state} in (present) echo replace;; (*) echo "${custom_mime_state}";; esac)" \ + --file /etc/mime.types \ + --line "application/x-${_mime} ${_exts}" \ + --regex "^application/x-${_mime} " </dev/null + done <<-EOF + sgnp$((version)) sgnp$((version)) + sgnp$((version))-submission$(for i in 1 2 3 4 5; do printf ' sgnp%u' $((version + i * 100)); done) + sgbe$((version+1)) sgbe$((version+1)) + sgbe$((version+1))-submission$(for i in 1 2 3 4 5; do printf ' sgbe%u' $((version + 1 + i * 100)); done) + EOF + xdg_mime_dir=/usr/share/mime - __file "${xdg_mime_dir}/packages/sgnp-${version}.xml" \ + __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" + --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" \ + 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}'" |
