| 1 |
#!/usr/bin/env bash |
| 2 |
|
| 3 |
# This script is designed to automatically configure a TeXShop distribution. |
| 4 |
# You should be able to direct it to run by double clicking on it. |
| 5 |
|
| 6 |
#This trap combination allows the window to linger long enough for the user to |
| 7 |
#inspect the output, but still get closed when all is said and done. |
| 8 |
function quit { |
| 9 |
read -n1 -r -p "Press any key to close window." key |
| 10 |
osascript -e 'tell application "Terminal" to close front window' > /dev/null 2>&1 & |
| 11 |
} |
| 12 |
|
| 13 |
trap quit EXIT |
| 14 |
|
| 15 |
|
| 16 |
#Copy the engine file from its instalation directory to the TeXShop Engines directory |
| 17 |
ENGINEDIR="$HOME/Library/TeXShop/Engines" |
| 18 |
if [ ! -d "$ENGINEDIR" ]; then |
| 19 |
echo "Cannot Find TeXShop configuration directory!" |
| 20 |
echo "Please open and close TeXShop and try running this script again." |
| 21 |
exit 1 |
| 22 |
fi |
| 23 |
SOURCE="/Users/Shared/Gregorio/contrib/TeXShop/LuaLaTeX+se.engine" |
| 24 |
if [ ! -e "$SOURCE" ]; then |
| 25 |
SOURCE="$PWD/LuaLaTeX+se.engine" |
| 26 |
if [ ! -e "$SOURCE" ]; then |
| 27 |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" |
| 28 |
SOURCE="$DIR/LuaLaTeX+se.engine" |
| 29 |
else |
| 30 |
echo "Cannot find LuaLaTeX+se.engine" |
| 31 |
echo "Please try running the Gregorio intaller again" |
| 32 |
exit 1 |
| 33 |
fi |
| 34 |
fi |
| 35 |
echo "Copying LuaLaTeX+se.engine into TeXShop configuration" |
| 36 |
cp "$SOURCE" "$ENGINEDIR" |
| 37 |
|
| 38 |
SOURCE="/Users/Shared/Gregorio/contrib/TeXShop/LuaTeX+se.engine" |
| 39 |
if [ ! -e "$SOURCE" ]; then |
| 40 |
SOURCE="$PWD/LuaTeX+se.engine" |
| 41 |
if [ ! -e "$SOURCE" ]; then |
| 42 |
DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" >/dev/null && pwd )" |
| 43 |
SOURCE="$DIR/LuaTeX+se.engine" |
| 44 |
else |
| 45 |
echo "Cannot find LuaTeX+se.engine" |
| 46 |
echo "Please try running the Gregorio intaller again" |
| 47 |
exit 1 |
| 48 |
fi |
| 49 |
fi |
| 50 |
echo "Copying LuaTeX+se.engine into TeXShop configuration" |
| 51 |
cp "$SOURCE" "$ENGINEDIR" |
| 52 |
|
| 53 |
#double check the execution bits |
| 54 |
chmod +x "$ENGINEDIR/LuaLaTeX+se.engine" |
| 55 |
chmod +x "$ENGINEDIR/LuaTeX+se.engine" |
| 56 |
|
| 57 |
echo "Configuration complete" |
| 58 |
exit 0 |