42 lines
1.1 KiB
Bash
Executable File
42 lines
1.1 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Helper script to export LaTeX templates for new UW letters
|
|
# Copyright (c) 2009-2016 Benjamin Mako Hill <mako@atdot.cc>
|
|
# Released under the GPLv3 or later.
|
|
|
|
set -e
|
|
|
|
SOURCEDIR="$HOME/tex/uw_tex_letterhead"
|
|
CURDIR=$(pwd)
|
|
|
|
if [ -n "$1" ]
|
|
then
|
|
if [ -e "$1" ]; then
|
|
echo "error: '$1' already exists"
|
|
exit 1
|
|
fi
|
|
|
|
WORK_DIR=$(mktemp -d)
|
|
cd "$SOURCEDIR"
|
|
git archive --format=tar mako | tar x -C "$WORK_DIR"
|
|
cd "$CURDIR"
|
|
mv "$WORK_DIR" "$1"
|
|
cd "$1"
|
|
mv "washington_letterhead_letter-matrix-deptartment.tex" "$(basename "$1").tex"
|
|
rm -f "new_tex_uwletter" "README" "COPYING"
|
|
|
|
# create a symlink farm for the fonts
|
|
rm -rf ./fonts/*
|
|
|
|
# first create the directories
|
|
for fontdir in "${SOURCEDIR}/fonts/"*; do
|
|
mkdir "./fonts/$(basename "${fontdir}")"
|
|
# then the files
|
|
for fontfile in "${fontdir}/"*; do
|
|
ln -s "${fontfile}" "./fonts/$(basename "${fontdir}")/$(basename "${fontfile}")"
|
|
done
|
|
done
|
|
else
|
|
echo "specify a directory where the template should go"
|
|
fi
|