File ttf-ms-win10.spec of Package ttf-ms-win10
#
# spec file for package ttf-ms-win10
#
# Copyright (c) 2023 SUSE LLC
#
# All modifications and additions to the file contributed by third parties
# remain the property of their copyright owners, unless otherwise agreed
# upon. The license for this file, and modifications and additions to the
# file, is the same license as for the pristine package itself (unless the
# license for the pristine package is not an Open Source License, in which
# case the license is the MIT License). An "Open Source License" is a
# license that conforms to the Open Source Definition (Version 1.9)
# published by the Open Source Initiative.
# Please submit bugfixes or comments via https://bugs.opensuse.org/
#
#
Name: ttf-ms-win10
Version: 10.0.19042.789
Release: 6
Summary: Microsoft Windows 10 TrueType fonts
License: Custom
URL: http://www.microsoft.com/typography/fonts/product.aspx?PID=164
Source0: http://software-static.download.prss.microsoft.com/pr/download/19042.631.201119-0144.20h2_release_svc_refresh_CLIENTENTERPRISEEVAL_OEMRET_x86FRE_en-us.iso
Group: Fonts
BuildRequires: 7zip udisks2 udftools util-linux fontconfig
BuildArch: noarch
%description
Microsoft Windows 10 TrueType fonts. This package includes various font styles and weights.
%check
%prep
# Criar diretório temporário para os arquivos extraídos da ISO
mkdir -p %{_builddir}/iso_extract
mkdir -p %{_builddir}/font-files
# Extrair o conteúdo da ISO diretamente com 7z
7z x %{SOURCE0} -o%{_builddir}/iso_extract
# Listar o conteúdo do arquivo "install.wim" para depuração
7z l %{_builddir}/iso_extract/sources/install.wim > %{_builddir}/wim_content.log
# Acessar o arquivo "install.wim" extraído para obter as fontes
7z e %{_builddir}/iso_extract/sources/install.wim Windows/Fonts/*.ttf Windows/Fonts/*.ttc -o%{_builddir}/font-files
# Procurar e extrair o arquivo de licença
7z e %{_builddir}/iso_extract/sources/install.wim Windows/System32/Licenses/neutral/Eval/EnterpriseEval/license.rtf -o%{_builddir}/font-files
%build
%install
# Criar o diretório de fontes no buildroot
mkdir -p %{buildroot}/usr/share/fonts/truetype
mkdir -p %{buildroot}/usr/share/licenses/%{name}/
# Copiar as fontes extraídas para o diretório correto
install -Dm644 %{_builddir}/font-files/*.ttf %{buildroot}/usr/share/fonts/truetype/
install -Dm644 %{_builddir}/font-files/*.ttc %{buildroot}/usr/share/fonts/truetype/
install -Dm644 %{_builddir}/font-files/license.rtf %{buildroot}/usr/share/licenses/%{name}/
%post
# Atualizar o cache de fontes após a instalação
fc-cache -fv
%files
/usr/share/fonts/truetype/
/usr/share/licenses/%{name}/
%changelog