-
Notifications
You must be signed in to change notification settings - Fork 0
/
update-template.sh
executable file
·37 lines (28 loc) · 1.09 KB
/
update-template.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
#!/usr/bin/env bash
# DO NOT RUN THIS SCRIPT LOCALLY
# THIS SCRIPT IS FROM https://github.com/konst-aa/fun
if [ -d .git ]; then
echo "ERROR: .git/ already exists, and I don't want to delete it if this script was called by accident."
echo
echo "If you intend to download part of this repository, please rm -rf .git/ manually, then re-run."
exit 1
fi
# https://stackoverflow.com/a/52269934
git clone --depth 1 --filter=blob:none --no-checkout \
"https://github.com/konst-aa/fun.git"
mv fun/.git .
rm -d fun
# change stuff here to taste
TO_CHECKOUT=(
"README.md"
"LICENSE"
".gitignore"
)
rm ${TO_CHECKOUT[@]}
git checkout main -- ${TO_CHECKOUT[@]}
mv README.md README-TEMP.md
echo "# THIS README IS FOR THE REPOSITORY THIS SCRIPT BELONGS TO: [https://github.com/konst-aa/fun]" > README.md
echo "See the program's entry in the **rundown** section of the README for more information " >> README.md
echo "If there is a bug in the code, feel free to contact me, or put up an issue. Email: [email protected] " >> README.md
cat README-TEMP.md >> README.md
rm README-TEMP.md