lecture-notes/init.sh

32 lines
1.1 KiB
Bash
Executable File

#!/bin/bash
if [[ $(pwd) == *template* ]]
then
echo "Don't run this in the template directory!"
echo "Rename the current folder or edit init.sh to do this anyways"
exit
fi
{ ## DO NOT REMOVE THIS OR EVERYTHING BLOWS UP
cat config
source config
find -type f | xargs sed -i "s/\$mainfile/$(printf '%s\n' "$mainfile" | sed -e 's/[\/&]/\\&/g')/g"
find -type f | xargs sed -i "s/\$course/$(printf '%s\n' "$course" | sed -e 's/[\/&]/\\&/g')/g"
find -type f | xargs sed -i "s/\$stylefile/$(printf '%s\n' "$stylefile" | sed -e 's/[\/&]/\\&/g')/g"
find -type f | xargs sed -i "s/\$repo/$(printf '%s\n' "$repo" | sed -e 's/[\/&]/\\&/g')/g"
find -type f | xargs sed -i "s/\$term/$(printf '%s\n' "$term" | sed -e 's/[\/&]/\\&/g')/g"
mv mainfile.tex $mainfile.tex
mv stylefile.sty $stylefile.sty
mv gitlab-ci.yml .gitlab-ci.yml
mv gitignore .gitignore
mv latexmkrc .latexmkrc
mv ci .ci
rm init.sh
rm -rf .git
rm config
git init
git add .
git submodule add https://gitlab.com/latexci/packages/LatexPackagesBuild.git
git submodule foreach git checkout master-build
mv gitmodules .gitmodules
git commit -m "initial commit"
}