clean up bash script
This commit is contained in:
parent
d4147d6c76
commit
a9408056fd
1 changed files with 12 additions and 9 deletions
21
init.sh
21
init.sh
|
@ -11,7 +11,6 @@ then
|
|||
exit 1
|
||||
fi
|
||||
|
||||
source config
|
||||
|
||||
# More safety second
|
||||
echo "--------------------------------------------------------"
|
||||
|
@ -35,15 +34,11 @@ fi
|
|||
echo "" # Move to new line
|
||||
|
||||
{ ## DO NOT REMOVE THIS OR EVERYTHING BLOWS UP
|
||||
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
|
||||
# Read in config as environment variables
|
||||
source config
|
||||
|
||||
# clean up meta files from template repository
|
||||
rm init.sh config README.md LICENSE
|
||||
rm -rf .git
|
||||
|
||||
|
@ -56,10 +51,18 @@ rmdir template
|
|||
mv mainfile.tex $mainfile.tex
|
||||
mv stylefile.sty $stylefile.sty
|
||||
|
||||
# replace config parameters
|
||||
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"
|
||||
|
||||
# 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"
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue