-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathinit.sh
More file actions
executable file
·43 lines (37 loc) · 1.2 KB
/
init.sh
File metadata and controls
executable file
·43 lines (37 loc) · 1.2 KB
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
38
39
40
41
42
43
# Only use utilities available in the `git bash` terminal on windows
NAMEPATTERN='[^[:alnum:] _-]'
NAMEARG=$1
while [ -z $MODNAME ]; do
if [ -z $NAMEARG ]; then
echo Enter Mod Name:
read MODNAME
else
MODNAME=$NAMEARG
unset NAMEARG
fi
# skip verification
#break
if [[ $MODNAME =~ $NAMEPATTERN ]]; then
echo "!!! Name contains invalid characters."
echo "Valid characters include \`a-zA-Z0-9 _-\`"
unset MODNAME
continue
fi
echo "Checking for duplicates..."
if [ -z "$UPDATELIST" ]; then
UPDATELIST=$(curl -s $(curl -s https://everestapi.github.io/modupdater.txt))
fi
for MOD in $UPDATELIST; do
if [[ $MODNAME: == $MOD ]]; then
echo "Name already in use!"
unset MODNAME
break
fi
done
done
find $(dirname "$0") -type f -not -path '*/[@.]*' -exec sed -i -e "s/\\\$MODNAME\\\$/$MODNAME/g" {} \;
for f in $(dirname "$0")/*; do mv "$f" "$(echo "$f" | sed s/\\\$MODNAME\\\$/$MODNAME/g)"; done
echo "Initialization Complete."
rm $(dirname "$0")/init.* # delete init files
rm $(dirname "$0")/LICENSE # delete license
rm $(dirname "$0")/README.md # delete readme