Emerald installer now downloads the package. Both scripts identify themselves.
authorDavid Griffith <dave@661.org>
Fri, 5 Apr 2019 12:59:38 +0000 (05:59 -0700)
committerDavid Griffith <dave@661.org>
Fri, 5 Apr 2019 13:01:37 +0000 (06:01 -0700)
.gitignore
tools/install-emerald.sh
tools/uninstall-emerald.sh

index 7ff90f5062ec31d767b8d96fe45c5d97ef01d4ea..b2da6b9e0b52439bc1044d569526f0ea9daa589d 100644 (file)
@@ -1,3 +1,5 @@
 output/*
 *.pyc
 *.z5
+tools/emerald.zip
+tools/emerald
index bdecb19cfa95dddeb038db4e911ff2bd1c0cff2e..c374ce654abc086f7222dda902aaa5f6b9de601d 100755 (executable)
@@ -4,24 +4,67 @@
 # https://www.ctan.org/tex-archive/fonts/emerald/
 # into $TEXMFLOCAL, which is usually /usr/local/share/texmf
 #
-# To use, put emerald.zip in the same directory as this script, unzip
-# emerald.zip, and execute this script.
+# This script will download emerald.zip if it's not already present.
+# It must be run as root.
 #
 # Created by David Griffith <dave@661.org>
 # Released into the public domain 2016
 
+# Exit values:
+#      0       Script completed installation successfully.
+#
+#      1       Unable to find kpsewhich(1), maybe TeX isn't installed?
+#      2       Unable to find unzip(1).
+#      3       Script not run as root.
+#      4       Unable to download package.
+#
 
-
-if [ `ps -o uid= $$` -ne 0 ] ; then
-       echo "This script must be run as root"
-       exit 1
-fi
+EMERALD_URL="http://mirrors.ctan.org/fonts/emerald.zip"
+EMERALD_PKG=emerald.zip
 
 PERM=644
 DPERM=755
 PKGDIR="emerald"
 TEXMFLOCAL=`kpsewhich -var-value TEXMFLOCAL`
 
+echo "Emerald CTAN package installer..."
+
+if [ ! $(command -v kpsewhich) ] ; then
+       echo "  ** Cannot find kpsewhich!  Is TeX really installed?"
+       exit 1
+fi
+
+if [ ! $(command -v unzip) ] ; then
+       echo "  ** Cannot find unzip!  Please install it and try again."
+       exit 2
+fi
+
+if [ `ps -o uid= $$` -ne 0 ] ; then
+       echo "  ** This script must be run as root"
+       exit 3
+fi
+
+if [ -f $EMERALD_PKG ] ; then
+       echo "Found $EMERALD_PKG right here."
+else
+       echo "Attempting download from $EMERALD_URL..."
+       if [ $(command -v curl) ] ; then
+               echo "Downloading $EMERALD_URL using curl."
+               command curl -L $EMERALD_URL -o $EMERALD_PKG
+       elif [ $(command -v wget) ] ; then
+               echo "Downloading $EMERALD_URL using wget."
+               command wget $EMERALD_URL -O $EMERALD_PKG
+       else
+               echo "  ** Neither curl nor wget are present."
+               echo "  ** Please download the emerald package manually,"
+               echo "  ** put it in this directory, and try again."
+               exit 4
+       fi
+fi
+
+echo "Unpacking $EMERALD_PKG..."
+unzip -q $EMERALD_PKG
+
 echo "Installing to $TEXMFLOCAL..."
 echo "Making directories..."
 install -m $DPERM -d   $TEXMFLOCAL/fonts/afm/emerald \
@@ -45,3 +88,7 @@ install -m $PERM -D $PKGDIR/tex/latex/emerald/* $TEXMFLOCAL/tex/latex/emerald
 echo "Map emerald.map" >> $TEXMFLOCAL/web2c/updmap.cfg
 mktexlsr $TEXMFLOCAL
 updmap-sys
+
+echo "Done!"
+
+exit 0
index 096003bfb2b97ac9adeea65b2bc5851592531708..ad1c0f86c858022f989a7e72d45aca19ca6cdc0d 100755 (executable)
@@ -6,6 +6,8 @@
 # Created by David Griffith <dave@661.org>
 # Released into the public domain 2016
 
+echo "Emerald CTAN package uninstaller..."
+
 if [ `ps -o uid= $$` -ne 0 ] ; then
        echo "This script must be run as root"
        exit 1