Package admx-chromium: Specfile

%define _destdir %_datadir/PolicyDefinitions
%define _unpackaged_files_terminate_build 1

Name: admx-chromium
Version: 120.0
Release: alt1

Summary: Chromium-specific ADMX policy templates
License: CC-BY-2.5
Group: System/Configuration/Other
BuildArch: noarch

BuildRequires: admx-lint
BuildRequires: iconv

Source0: policy_templates.tar

Chromium-specific ADMX files, which are registry-based policy settings provide
an XML-based structure for defining the display of the Administrative Template
policy settings in the Group Policy Object Editor.

%setup -q -n policy_templates

mkdir -p %buildroot%_datadir
cp -a windows/admx/ %buildroot%_destdir
for file in %buildroot%_destdir/*.admx %buildroot%_destdir/*-*/*.adml; do
    if echo "$(basename "$file")" | grep -q "^chrome"; then
        mv "$file" "$file.utf16"
        iconv -f UTF-16 -t UTF-8 <"$file.utf16" >"$file"
        rm -f "$file.utf16"
    grep -q "^\(<policyDefinitions\|<policyDefinitionResources\) .*xmlns:xsd=" "$file" ||
        sed -i 's/\(<policyDefinitions\|<policyDefinitionResources\)/\1 xmlns:xsd="http:\/\/\/2001\/XMLSchema"/' "$file"
    grep -q "^\(<policyDefinitions\|<policyDefinitionResources\) .*xmlns:xsi=" "$file" ||
        sed -i 's/\(<policyDefinitions\|<policyDefinitionResources\)/\1 xmlns:xsi="http:\/\/\/2001\/XMLSchema-instance"/' "$file"
    grep -q "^\(<policyDefinitions\|<policyDefinitionResources\) .*xmlns=" "$file" ||
        sed -i 's/\(<policyDefinitions\|<policyDefinitionResources\)/\1 xmlns="http:\/\/\/GroupPolicy\/2006\/07\/PolicyDefinitions"/' "$file"

for file in %buildroot%_destdir/*.admx %buildroot%_destdir/*-*/*.adml; do
    admx-lint --input_file "$file"

%dir %_destdir
%dir %_destdir/*-*/

* Mon Dec 25 2023 Evgeny Sinelnikov <> 120.0-alt1
- Update to latest release 120.0-6099.130

* Thu Nov 23 2023 Evgeny Sinelnikov <> 119.0-alt1
- Update to latest release 119.0-6045.160

* Fri Oct 20 2023 Evgeny Sinelnikov <> 118.0-alt1
- Update to latest release 118.0-5993.89

* Thu Dec 29 2022 Evgeny Sinelnikov <> 108.0-alt1
- Update to latest release 108.0-5359.125

* Tue Oct 25 2022 Evgeny Sinelnikov <> 106.0-alt1
- Update to latest release 106.0-5249.119

* Thu Sep 15 2022 Evgeny Sinelnikov <> 105.0-alt1
- Update to latest release 105.0-5195.127

* Sun Jul 18 2021 Evgeny Sinelnikov <> 91.0-alt1
- Update to latest release 91.0-4472.164
- Add admx-lint check with special workaround:
- Convert UTF-16 chrome.adm files to UTF-8

* Fri May 07 2021 Evgeny Sinelnikov <> 90.0-alt1
- Update to latest release
- Fix installation to /usr/share/PolicyDefinitions
- Set right License and URL of upstream project

* Fri Apr 02 2021 Alenka Glukhovskaya <> 89.0-alt1
- Initial release