From f2654d1bccc30bceeb731d19ee9bb2ee680498bf0e437dd51f5dbffde992a987 Mon Sep 17 00:00:00 2001 From: Petr Gajdos Date: Fri, 4 Oct 2013 13:46:58 +0000 Subject: [PATCH] OBS-URL: https://build.opensuse.org/package/show/M17N:fonts/fontpackages?expand=0&rev=18 --- fontpackages.spec | 6 ---- reconfigure-fonts-cjk.sh | 11 ------- reconfigure-fonts.sh | 8 ----- rpm-macros.fonts-config | 67 +++++++++++++++++++++++++++++++--------- 4 files changed, 52 insertions(+), 40 deletions(-) delete mode 100644 reconfigure-fonts-cjk.sh delete mode 100644 reconfigure-fonts.sh diff --git a/fontpackages.spec b/fontpackages.spec index 6cb7300..73c1fdd 100644 --- a/fontpackages.spec +++ b/fontpackages.spec @@ -23,8 +23,6 @@ Summary: Commons for Font Packages License: BSD-3-Clause Group: System/Base Source0: rpm-macros.fonts-config -Source1: reconfigure-fonts.sh -Source2: reconfigure-fonts-cjk.sh Source100: COPYING BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildArch: noarch @@ -48,14 +46,10 @@ cp %{SOURCE100} . %install mkdir -p %{buildroot}%{_sysconfdir}/rpm cp -a %{SOURCE0} %{buildroot}%{_sysconfdir}/rpm/macros.fonts-config -mkdir -p %{buildroot}%{_datadir}/%{name}-devel -cp -a %{SOURCE1} %{SOURCE2} %{buildroot}%{_datadir}/%{name}-devel %files devel %defattr(-,root,root) %doc COPYING %config %{_sysconfdir}/rpm/macros.fonts-config -%dir %{_datadir}/%{name}-devel -%{_datadir}/%{name}-devel/*.sh %changelog diff --git a/reconfigure-fonts-cjk.sh b/reconfigure-fonts-cjk.sh deleted file mode 100644 index 9b57d41..0000000 --- a/reconfigure-fonts-cjk.sh +++ /dev/null @@ -1,11 +0,0 @@ -adobecifontconfig=/usr/sbin/acroread-cidfont-config -ghostscriptcjkconfig=/usr/sbin/ghostscript-cjk-config -runflag=/var/run/fontpackages/reconfigure-fonts-cjk -if [ -e $runflag ]; then - if [ -x $adobecidfontconfig ]; then - $adobecidfontconfig - fi - if [ -x $ghostscriptcjkconfig ]; then - $ghostscriptcjkconfig - fi -fi diff --git a/reconfigure-fonts.sh b/reconfigure-fonts.sh deleted file mode 100644 index 23ace0b..0000000 --- a/reconfigure-fonts.sh +++ /dev/null @@ -1,8 +0,0 @@ -runflag=/var/run/fontpackages/reconfigure-fonts -fontsconfig=/usr/sbin/fonts-config -if [ -e $runflag ]; then - if [ -x $fontsconfig ]; then - $fontsconfig --quiet - fi - rm $runflag -fi diff --git a/rpm-macros.fonts-config b/rpm-macros.fonts-config index b4ac7e5..e0338a9 100644 --- a/rpm-macros.fonts-config +++ b/rpm-macros.fonts-config @@ -6,10 +6,8 @@ %_fontsconfddir %{_fontsconfdir}/conf.d %_fontsconfavaildir %{_datadir}/%{name}/conf.avail # private -%__fontsconfigrunflag /var/run/fontpackages/reconfigure-fonts -%__run_fonts_config /usr/share/fontpackages-devel/reconfigure-fonts.sh -%__run_cjk_init /usr/share/fontpackages-devel/reconfigure-fonts-cjk.sh -%__fontsupdatescript /var/adm/update-scripts/%{name}-%{version}-%{release}-reconfigure-fonts +%__fontsconfigrunflag /var/run/fontpackages/reconfigure-fonts +%__fontsupdatescript /var/adm/update-scripts/%{name}-%{version}-%{release}-reconfigure-fonts # macro: link_avail_to_system_fontsconf name # (takes exactly one argument, name of configuration file) @@ -73,6 +71,29 @@ Requires(pre): perl aaa_base \ %nil + +# macro: reconfigure_fonts +# font setup for suse +%reconfigure_fonts \ + if test -x /usr/sbin/fonts-config ; then \ + LC_ALL=POSIX \ + /usr/sbin/fonts-config --verbose \ + fi \ + %nil + + +# macro: reconfigure_fonts +# cjk font setup for suse +%reconfigure_fonts_cjk \ + if test -x /usr/sbin/acroread-cidfont-config ; then \ + /usr/sbin/acroread-cidfont-config \ + fi \ + if test -x /usr/sbin/ghostscript-cjk-config ; then \ + /usr/sbin/ghostscript-cjk-config \ + fi \ + %nil + + # macro: reconfigure_fonts_post # now alias to reconfigure_fonts, this can change in the future # options: @@ -85,10 +106,23 @@ Requires(pre): perl aaa_base \ touch %{__fontsconfigrunflag}-cjk \ } \ if [ -n "$ZYPP_IS_RUNNING" ]; then \ - cp %{__run_fonts_config} %{__fontsupdatescript} \ + echo 'if [ -e %{__fontsconfigrunflag} ]; then' > %{__fontsupdatescript} \ + echo ' if [ -x /usr/sbin/fonts-config ]; then' >> %{__fontsupdatescript} \ + echo ' /usr/sbin/fonts-config --quiet' >> %{__fontsupdatescript} \ + echo ' fi' >> %{__fontsupdatescript} \ + echo ' rm %{__fontsconfigrunflag}' >> %{__fontsupdatescript} \ + echo 'fi' >> %{__fontsupdatescript} \ echo 'rm %{__fontsupdatescript}' >> %{__fontsupdatescript} \ %{-c: \ - cp %{__run_cjk_init} %{__fontsupdatescript}-cjk \ + echo 'if [ -e %{__fontsconfigrunflag}-cjk ]; then' > %{__fontsupdatescript}-cjk \ + echo ' if [ -x $adobecidfontconfig ]; then' >> %{__fontsupdatescript}-cjk \ + echo ' /usr/sbin/acroread-cidfont-config' >> %{__fontsupdatescript}-cjk \ + echo ' fi' >> %{__fontsupdatescript}-cjk \ + echo ' if [ -x $ghostscriptcjkconfig ]; then' >> %{__fontsupdatescript}-cjk \ + echo ' /usr/sbin/ghostscript-cjk-config' >> %{__fontsupdatescript}-cjk \ + echo ' fi' >> %{__fontsupdatescript}-cjk \ + echo ' rm %{__fontsconfigrunflag}-cjk' >> %{__fontsupdatescript} \ + echo 'fi' >> %{__fontsupdatescript}-cjk \ echo 'rm %{__fontsupdatescript}-cjk' >> %{__fontsupdatescript}-cjk \ } \ fi \ @@ -100,14 +134,11 @@ Requires(pre): perl aaa_base \ # -c (the fonts are CJK fonts, also do setup which is only needed # for CJK) %reconfigure_fonts_postun(c) \ - mkdir -p `dirname %{__fontsconfigrunflag}` \ - touch %{__fontsconfigrunflag} \ - %{-c: \ - touch %{__fontsconfigrunflag}-cjk \ - } \ if [ $1 -eq 0 ]; then \ - sh %{__run_fonts_config} \ - %{-c: sh %{__run_cjk_init}} \ + %reconfigure_fonts \ + %{-c: \ + %reconfigure_fonts_cjk \ + } \ fi \ %nil @@ -118,8 +149,14 @@ Requires(pre): perl aaa_base \ # for CJK) %reconfigure_fonts_posttrans \ if [ -z "$ZYPP_IS_RUNNING" ]; then \ - sh %{__run_fonts_config} \ - sh %{__run_cjk_init} \ + if [ -e %{__fontsconfigrunflag} ]; then \ + %reconfigure_fonts \ + rm %{__fontsconfigrunflag} \ + fi \ + if [ -e %{__fontsconfigrunflag}-cjk ]; then \ + %reconfigure_fonts_cjk \ + rm %{__fontsconfigrunflag}-cjk \ + fi \ fi \ %nil