#!/bin/bash # safety first 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 cd template 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" cd .. # clean up meta files rm init.sh rm config rm README.md rm -rf .git # move template files into this directory mv "template/*" . mv "template/.*" . mv mainfile.tex $mainfile.tex mv stylefile.sty $stylefile.sty # init new repo git init git submodule add https://gitlab.com/latexci/packages/LatexPackagesBuild.git git submodule foreach git checkout master-build git add . git commit -m "initial commit" }