lecture-notes/init.sh

32 lines
1.1 KiB
Bash
Raw Normal View History

2022-02-15 23:24:20 +01:00
#!/bin/bash
2022-02-15 23:51:27 +01:00
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
2022-02-15 23:39:10 +01:00
{ ## DO NOT REMOVE THIS OR EVERYTHING BLOWS UP
2022-02-15 23:58:47 +01:00
cat config
2022-02-15 23:20:19 +01:00
source config
2022-02-15 23:35:05 +01:00
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"
2022-02-15 23:50:22 +01:00
mv mainfile.tex $mainfile.tex
2022-02-15 23:57:38 +01:00
mv stylefile.sty $stylefile.sty
2022-02-15 23:50:22 +01:00
mv gitlab-ci.yml .gitlab-ci.yml
mv gitignore .gitignore
mv latexmkrc .latexmkrc
mv ci .ci
2022-02-15 23:39:10 +01:00
rm init.sh
rm -rf .git
2022-02-15 23:58:47 +01:00
rm config
2022-02-15 23:39:10 +01:00
git init
git add .
2022-02-16 00:14:00 +01:00
git submodule add https://gitlab.com/latexci/packages/LatexPackagesBuild.git
git submodule foreach git checkout master-build
mv gitmodules .gitmodules
2022-02-15 23:39:10 +01:00
git commit -m "initial commit"
2022-02-15 23:29:07 +01:00
}