lecture-notes/init.sh
2022-02-15 23:57:38 +01:00

28 lines
975 B
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
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 gitmodules .gitmodules
mv latexmkrc .latexmkrc
mv ci .ci
rm init.sh
rm -rf .git
git init
git add .
git commit -m "initial commit"
}