On 11/24/2014 3:19 PM, Ken Brown wrote:
And I'll make some TeX Live postinstall scripts to test it with.

I've done this now. For a complete TeX Live install (including all 68 texlive-collection-* packages), the postinstall time was reduced from 48 minutes to 15 minutes on my system.

For anyone interested in the details, I'm attaching my two perpetual postinstall scripts, as well as some patches to cygport that were needed.

The first two cygport patches have nothing to do with perpetual postinstall scripts. The second one, in particular, is responsible for part of the speedup and should have been done long ago.

Ken
>From cb74207fde628fa80919dc870a2de4fa2d66f0af Mon Sep 17 00:00:00 2001
From: Ken Brown <[email protected]>
Date: Tue, 25 Nov 2014 09:27:52 -0500
Subject: [PATCH 1/5] prep_texlive: remove references to /usr/share/texmf

This is no longer used as of TeX Live 2013.
---
 lib/src_postinst.cygpart | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart
index dab3dff..6d44b91 100644
--- a/lib/src_postinst.cygpart
+++ b/lib/src_postinst.cygpart
@@ -371,7 +371,7 @@ __prep_texlive() {
                _EOF
        fi
 
-       for d in /usr/share/texmf{-dist,}/fonts/{opentype,truetype,type1}
+       for d in /usr/share/texmf-dist/fonts/{opentype,truetype,type1}
        do
                if [ -d ${D}${d} ]
                then
@@ -655,7 +655,7 @@ __prepetc() {
                __prep_freedesktop_mime || error "Shared Mime Info postinstall 
failed"
        fi
 
-       for d in /usr/share/texmf{,-dist}
+       for d in /usr/share/texmf-dist
        do
                if [ -d ${D}${d} ]
                then
-- 
2.1.1

>From 2137f63aa5b8cf65a2f68cd9e36c4f9a21b159f7 Mon Sep 17 00:00:00 2001
From: Ken Brown <[email protected]>
Date: Fri, 28 Nov 2014 10:47:49 -0500
Subject: [PATCH 2/5] prep_texlive: group enable/disable commands into one
 invocation of updmap

---
 lib/src_postinst.cygpart | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart
index 6d44b91..33356d4 100644
--- a/lib/src_postinst.cygpart
+++ b/lib/src_postinst.cygpart
@@ -339,15 +339,23 @@ __prep_texlive() {
 
        if [ -n "${maps#0}" ]
        then
+               cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
+                       /usr/bin/updmap-sys --nohash --nomkmap \\
+               _EOF
+               cat >> ${D}/etc/preremove/${PN}.sh <<-_EOF
+                       /usr/bin/updmap-sys --nohash --nomkmap \\
+               _EOF
                for map in $maps
                do
                        cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
-                               /usr/bin/updmap-sys --nohash --nomkmap --enable 
$map
+                               --enable $map \\
                        _EOF
                        cat >> ${D}/etc/preremove/${PN}.sh <<-_EOF
-                               /usr/bin/updmap-sys --nohash --nomkmap 
--disable ${map#*=}
+                               --disable ${map#*=} \\
                        _EOF
                done
+               echo >> ${D}/etc/postinstall/${PN}.sh
+               echo >> ${D}/etc/preremove/${PN}.sh
                cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
                        /usr/bin/updmap-sys --nohash --syncwithtrees
                        /usr/bin/updmap-sys --nohash
-- 
2.1.1

>From 08369c85b5276e50d941a16b33791d453a15f837 Mon Sep 17 00:00:00 2001
From: Ken Brown <[email protected]>
Date: Wed, 26 Nov 2014 07:35:13 -0500
Subject: [PATCH 3/5] prep_texlive: remove calls to mktexlsr

Leave marker file to indicate that mktexlsr should be run by a
perpetual postinstall script.
---
 lib/src_postinst.cygpart | 9 ++-------
 1 file changed, 2 insertions(+), 7 deletions(-)

diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart
index 33356d4..9bb57f1 100644
--- a/lib/src_postinst.cygpart
+++ b/lib/src_postinst.cygpart
@@ -330,9 +330,8 @@ __prep_texlive() {
 
        dodir /etc/postinstall /etc/preremove
 
-       cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
-               /usr/bin/mktexlsr
-       _EOF
+       insinto /etc/texmf/postinstall
+       newins /dev/null run_mktexlsr
 
        fmts=$(__config_get texlive_fmts)
        maps=$(__config_get texlive_maps)
@@ -359,7 +358,6 @@ __prep_texlive() {
                cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
                        /usr/bin/updmap-sys --nohash --syncwithtrees
                        /usr/bin/updmap-sys --nohash
-                       /usr/bin/mktexlsr
                _EOF
        fi
        if [ -n "${fmts#0}" ]
@@ -374,9 +372,6 @@ __prep_texlive() {
                                /usr/bin/fmtutil-sys --disablefmt $fmt
                        _EOF
                done
-               cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
-                       /usr/bin/mktexlsr
-               _EOF
        fi
 
        for d in /usr/share/texmf-dist/fonts/{opentype,truetype,type1}
-- 
2.1.1

>From cd02204513b05f9dc506807d9cad89c428e92efa Mon Sep 17 00:00:00 2001
From: Ken Brown <[email protected]>
Date: Wed, 26 Nov 2014 07:47:38 -0500
Subject: [PATCH 4/5] prep_texlive: remove updmap calls except for
 enable/disable commands

Leave marker file to indicate that updmap should be run by a perpetual
postinstall script.
---
 lib/src_postinst.cygpart | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)

diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart
index 9bb57f1..31e08a7 100644
--- a/lib/src_postinst.cygpart
+++ b/lib/src_postinst.cygpart
@@ -338,6 +338,7 @@ __prep_texlive() {
 
        if [ -n "${maps#0}" ]
        then
+               newins /dev/null run_updmap
                cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
                        /usr/bin/updmap-sys --nohash --nomkmap \\
                _EOF
@@ -355,10 +356,6 @@ __prep_texlive() {
                done
                echo >> ${D}/etc/postinstall/${PN}.sh
                echo >> ${D}/etc/preremove/${PN}.sh
-               cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
-                       /usr/bin/updmap-sys --nohash --syncwithtrees
-                       /usr/bin/updmap-sys --nohash
-               _EOF
        fi
        if [ -n "${fmts#0}" ]
        then
-- 
2.1.1

>From e5ceb5a6ce182285495396f8cc6483b34b9d8902 Mon Sep 17 00:00:00 2001
From: Ken Brown <[email protected]>
Date: Wed, 26 Nov 2014 07:53:29 -0500
Subject: [PATCH 5/5] prep_texlive: remove calls to fc-cache

Leave a marker file to indicate that fc-cache should be run by a
perpetual postinstall script.
---
 lib/src_postinst.cygpart | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/lib/src_postinst.cygpart b/lib/src_postinst.cygpart
index 31e08a7..df5607d 100644
--- a/lib/src_postinst.cygpart
+++ b/lib/src_postinst.cygpart
@@ -371,13 +371,11 @@ __prep_texlive() {
                done
        fi
 
-       for d in /usr/share/texmf-dist/fonts/{opentype,truetype,type1}
+       for d in opentype truetype type1
        do
-               if [ -d ${D}${d} ]
+               if [ -d ${D}/usr/share/texmf-dist/fonts/${d} ]
                then
-                       cat >> ${D}/etc/postinstall/${PN}.sh <<-_EOF
-                               /usr/bin/fc-cache -f $d
-                       _EOF
+                       newins /dev/null run_fc_cache_${d}
                fi
        done
 }
-- 
2.1.1

postinstalldir=/etc/texmf/postinstall

if [ -f ${postinstalldir}/run_mktexlsr ]
then
    /usr/bin/mktexlsr
    /etc/texmf/web2c/20140523-1-update_fmtutil_cnf
    mv -f ${postinstalldir}/run_mktexlsr ${postinstalldir}/run_mktexlsr.done
fi

if [ -f ${postinstalldir}/refresh_fmts ]
then
    /usr/bin/fmtutil-sys --refresh
    mv -f ${postinstalldir}/refresh_fmts ${postinstalldir}/refresh_fmts.done
fi
postinstalldir=/etc/texmf/postinstall

if [ -f ${postinstalldir}/run_updmap ]
then
    echo y | /usr/bin/updmap-sys --syncwithtrees
    /usr/bin/updmap-sys
    mv -f ${postinstalldir}/run_updmap ${postinstalldir}/run_updmap.done
fi

for d in opentype type1 truetype
do
  if [ -f ${postinstalldir}/run_fc_cache_${d} ]
  then
    /usr/bin/fc-cache -f /usr/share/texmf-dist/fonts/${d}
    mv -f ${postinstalldir}/run_fc_cache_${d} \
       ${postinstalldir}/run_fc_cache_${d}.done
  fi
done

Reply via email to