summaryrefslogtreecommitdiff
path: root/Build/source/texk/gregorio/gregorio-src/install-gtex.sh
diff options
context:
space:
mode:
authorAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-04-06 05:08:53 +0000
committerAkira Kakuto <kakuto@fuk.kindai.ac.jp>2017-04-06 05:08:53 +0000
commit5fedb5d6169efecebd0dfbb1da555805573d14e5 (patch)
tree1f2654660ca658b3d06ee656be81e9735684bf5d /Build/source/texk/gregorio/gregorio-src/install-gtex.sh
parent3c806bd4ccf248e9411683a41ef534d1a909bc99 (diff)
gregorio 5.0.0-rc1
git-svn-id: svn://tug.org/texlive/trunk@43706 c570f23f-e606-0410-a88d-b1316a301751
Diffstat (limited to 'Build/source/texk/gregorio/gregorio-src/install-gtex.sh')
-rwxr-xr-xBuild/source/texk/gregorio/gregorio-src/install-gtex.sh110
1 files changed, 91 insertions, 19 deletions
diff --git a/Build/source/texk/gregorio/gregorio-src/install-gtex.sh b/Build/source/texk/gregorio/gregorio-src/install-gtex.sh
index 21a7b50a2e8..965529df0de 100755
--- a/Build/source/texk/gregorio/gregorio-src/install-gtex.sh
+++ b/Build/source/texk/gregorio/gregorio-src/install-gtex.sh
@@ -1,6 +1,6 @@
#!/usr/bin/env bash
-# Copyright (C) 2015 The Gregorio Project (see CONTRIBUTORS.md)
+# Copyright (C) 2015-2017 The Gregorio Project (see CONTRIBUTORS.md)
#
# This file is part of Gregorio.
#
@@ -60,6 +60,10 @@
# To do this, set the SKIP environment variable to a comma-separated list of
# the parts you want don't want installed: tex, latex, fonts, docs, examples,
# and/or font-sources
+#
+# Setting the GENERATE_UNINSTALL environment variable to "false" will bypass
+# uninstall script generation and any existing uninstall script will be left
+# alone.
VERSION=`head -1 .gregorio-version`
FILEVERSION=`echo $VERSION | sed 's/\./_/g'`
@@ -67,15 +71,14 @@ FILEVERSION=`echo $VERSION | sed 's/\./_/g'`
TEXFILES=(tex/gregoriotex*.tex tex/gsp-default.tex tex/gregoriotex*.lua
tex/*.dat)
LATEXFILES=(tex/gregorio*.sty)
-TTFFILES=(gregorio.ttf greciliae.ttf granapadano.ttf gregorio-op.ttf
- greciliae-op.ttf granapadano-op.ttf greextra.ttf gregall.ttf
- gresgmodern.ttf)
+TTFFILES=(fonts/*.ttf)
DOCFILES=(doc/*.tex doc/*.lua doc/*.gabc doc/*.pdf doc/README.md)
EXAMPLEFILES=(examples/FactusEst.gabc examples/PopulusSion.gabc
examples/main-lualatex.tex examples/debugging.tex)
-FONTSRCFILES=(gregorio-base.sfd granapadano-base.sfd greciliae-base.sfd
- greextra.sfd squarize.py convertsfdtottf.py gregall.sfd
+FONTSRCFILES=(greextra.sfd squarize.py convertsfdtottf.py gregall.sfd
gresgmodern.sfd README.md)
+FONTSRCFILES=("${FONTSRCFILES[@]/#/fonts/}")
+FONTSRCFILES+=(fonts/*-base.sfd)
# Files which have been eliminated, or whose installation location have been
# changed. We will remove existing versions of these files in the target texmf
# tree before installing.
@@ -84,7 +87,14 @@ LEGACYFILES=(tex/luatex/gregoriotex/gregoriotex.sty
tex/luatex/gregoriotex/gregoriotex-ictus.tex
fonts/truetype/public/gregoriotex/parmesan.ttf
fonts/truetype/public/gregoriotex/parmesan-op.ttf
- fonts/source/gregoriotex/parmesan-base.sfd)
+ fonts/source/gregoriotex/parmesan-base.sfd
+ fonts/truetype/public/gregoriotex/gresym.ttf
+ fonts/truetype/public/gregoriotex/gregorio.ttf
+ fonts/truetype/public/gregoriotex/gregorio-op.ttf
+ fonts/source/gregoriotex/gregorio-base.sfd
+ fonts/truetype/public/gregoriotex/granapadano.ttf
+ fonts/truetype/public/gregoriotex/granapadano-op.ttf
+ fonts/source/gregoriotex/granapadano-base.sfd)
NAME=${NAME:-gregoriotex}
FORMAT=${FORMAT:-luatex}
@@ -94,8 +104,9 @@ KPSEWHICH=${KPSEWHICH:-kpsewhich}
CP=${CP:-cp}
RM=${RM:-rm}
-TTFFILES=("${TTFFILES[@]/#/fonts/}")
-FONTSRCFILES=("${FONTSRCFILES[@]/#/fonts/}")
+GENERATE_UNINSTALL=${GENERATE_UNINSTALL:-true}
+AUTO_UNINSTALL=${AUTO_UNINSTALL:-false}
+REMOVE_OLD_FILES=${REMOVE_OLD_FILES:-true}
arg="$1"
case "$arg" in
@@ -145,9 +156,15 @@ then
echo "Usage: $0 var:{tex-variable}"
echo " $0 dir:{directory}"
echo " $0 system|user|tds"
+ echo
+ echo "Please read the documentation in the script for additional options"
exit 1
fi
+UNINSTALL_SCRIPT_DIR="scripts/gregoriotex"
+UNINSTALL_SCRIPT_FILE="uninstall-gtex.sh"
+UNINSTALL_SCRIPT="${TEXMFROOT}/${UNINSTALL_SCRIPT_DIR}/${UNINSTALL_SCRIPT_FILE}"
+
function die {
echo 'Failed.'
exit 1
@@ -156,8 +173,18 @@ function die {
function install_to {
dir="$1"
shift
- mkdir -p "$dir" || die
- $CP "$@" "$dir" || die
+ mkdir -p "${TEXMFROOT}/$dir" || die
+ $CP "$@" "${TEXMFROOT}/$dir" || die
+
+ if ${GENERATE_UNINSTALL}
+ then
+ for name in "$@"
+ do
+ echo '$RM'" $dir/$(basename $name)" >> "${UNINSTALL_SCRIPT}"
+ done
+ echo "rmdir -p $dir 2> /dev/null || true" >> "${UNINSTALL_SCRIPT}"
+ echo >> "${UNINSTALL_SCRIPT}"
+ fi
}
function find_and_remove {
@@ -175,8 +202,43 @@ function not_installing {
echo "install-gtex.sh: not installing $@"
}
-echo "Removing old files"
-find_and_remove "${LEGACYFILES[@]}"
+if ${GENERATE_UNINSTALL}
+then
+ if [ -e "${UNINSTALL_SCRIPT}" ]
+ then
+ echo "${UNINSTALL_SCRIPT} exists."
+ echo "This suggests that some version of GregorioTeX is already installed."
+ if ${AUTO_UNINSTALL}
+ then
+ echo "AUTO_UNINSTALL=true, so uninstalling the old version of GregorioTeX."
+ bash "${UNINSTALL_SCRIPT}"
+ else
+ echo "Re-run this script setting the environment variable AUTO_UNINSTALL=true"
+ echo "to automatically uninstall the other version before installing the new one,"
+ echo "or clean up the old installation files manually."
+ exit 1
+ fi
+ fi
+
+ mkdir -p "${TEXMFROOT}/${UNINSTALL_SCRIPT_DIR}" || die
+ echo '# This script uninstalls GregorioTeX.' > "${UNINSTALL_SCRIPT}"
+ echo '# Run it with "bash /path/to/uninstall-gtex.sh".' >> "${UNINSTALL_SCRIPT}"
+ echo >> "${UNINSTALL_SCRIPT}"
+ echo 'RM=${RM:-rm}' >> "${UNINSTALL_SCRIPT}"
+ echo 'TEXHASH=${TEXHASH:-texhash}' >> "${UNINSTALL_SCRIPT}"
+ echo >> "${UNINSTALL_SCRIPT}"
+ echo 'cd $(dirname ${BASH_SOURCE[0]})/../..' >> "${UNINSTALL_SCRIPT}"
+ echo >> "${UNINSTALL_SCRIPT}"
+elif [ "$arg" != 'tds' ]
+then
+ echo "Not generating "${UNINSTALL_SCRIPT}""
+fi
+
+if ${REMOVE_OLD_FILES}
+then
+ echo "Removing old files."
+ find_and_remove "${LEGACYFILES[@]}"
+fi
declare -A skip_install
if [ -n "$SKIP" ]
@@ -193,22 +255,32 @@ fi
echo "Installing in '${TEXMFROOT}'."
${skip_install[tex]:-false} && not_installing tex files ||
- install_to "${TEXMFROOT}/tex/${FORMAT}/${NAME}" "${TEXFILES[@]}"
+ install_to "tex/${FORMAT}/${NAME}" "${TEXFILES[@]}"
${skip_install[latex]:-false} && not_installing latex files ||
- install_to "${TEXMFROOT}/tex/${LATEXFORMAT}/${NAME}" "${LATEXFILES[@]}"
+ install_to "tex/${LATEXFORMAT}/${NAME}" "${LATEXFILES[@]}"
${skip_install[fonts]:-false} && not_installing fonts ||
- install_to "${TEXMFROOT}/fonts/truetype/public/${NAME}" "${TTFFILES[@]}"
+ install_to "fonts/truetype/public/${NAME}" "${TTFFILES[@]}"
${skip_install[docs]:-false} && not_installing docs ||
- install_to "${TEXMFROOT}/doc/${FORMAT}/${NAME}" "${DOCFILES[@]}"
+ install_to "doc/${FORMAT}/${NAME}" "${DOCFILES[@]}"
${skip_install[examples]:-false} && not_installing examples ||
- install_to "${TEXMFROOT}/doc/${FORMAT}/${NAME}/examples" "${EXAMPLEFILES[@]}"
+ install_to "doc/${FORMAT}/${NAME}/examples" "${EXAMPLEFILES[@]}"
${skip_install[font-sources]:-false} && not_installing font sources ||
- install_to "${TEXMFROOT}/fonts/source/${NAME}" "${FONTSRCFILES[@]}"
+ install_to "fonts/source/${NAME}" "${FONTSRCFILES[@]}"
+
+if ${GENERATE_UNINSTALL}
+then
+ echo '$RM'" ${UNINSTALL_SCRIPT_DIR}/${UNINSTALL_SCRIPT_FILE}" >> "${UNINSTALL_SCRIPT}"
+ echo "rmdir -p ${UNINSTALL_SCRIPT_DIR} 2> /dev/null || true" >> "${UNINSTALL_SCRIPT}"
+ echo >> "${UNINSTALL_SCRIPT}"
+
+ echo '${TEXHASH}' >> "${UNINSTALL_SCRIPT}"
+fi
if [ "$arg" = 'tds' ]
then
echo "Making TDS-ready archive ${TDS_ZIP}."
rm -f ${TDS_ZIP}
+ (rm ${TEXMFROOT}/fonts/source/gregoriotex/gregorio-base.sfd ${TEXMFROOT}/fonts/source/gregoriotex/granapadano-base.sfd ) || die
(cd ${TEXMFROOT} && zip -9 ../${TDS_ZIP} -q -r .) || die
rm -r ${TEXMFROOT} || die
else