forked from Nomi-CEu/Nomi-CEu
-
Notifications
You must be signed in to change notification settings - Fork 0
/
pack-mode-switcher.sh
57 lines (44 loc) · 1012 Bytes
/
pack-mode-switcher.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
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env sh
touch .mode
set -e
echo "Nomifactory GTCEu Port / Pack mode switcher"
NORMAL_CFG=config-overrides/normal
EXPERT_CFG=config-overrides/expert
TARGET=./config
CURRENT_MODE="$(head .mode)"
CURRENT_MODE=${CURRENT_MODE:="normal"}
echo "Current Mode: $CURRENT_MODE"
if [ -z "$1" ]; then
echo -n "Set pack mode (Normal / Expert): "
read MODE
else
MODE="$1"
fi
case $MODE in
N|n|normal)
cp -rf "$NORMAL_CFG/." ${TARGET}
# Only copy server.properties if it exists.
if [ -f "server.properties" ]; then
mv "${TARGET}/server.properties" ./
else
rm "${TARGET}/server.properties"
fi
# Update Mode
echo normal > .mode
;;
E|e|expert)
cp -rf "$EXPERT_CFG/." ${TARGET}
if [ -f "server.properties" ]; then
mv "${TARGET}/server.properties" ./
else
rm "${TARGET}/server.properties"
fi
# Update Mode
echo expert > .mode
;;
*)
echo -e "Error: Invalid input $MODE"
exit 1
;;
esac
echo "Done!"