blob: 2cc9bc0d29cb57b624d5c916044b54bbc0d1a879 (
plain)
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
|
_good_ver="1.14.4_28.1.0-1"
post_install() {
if ! getent group "forge" &>/dev/null; then
echo "Adding forge system group..."
groupadd -r forge 1>/dev/null
fi
if ! getent passwd "forge" &>/dev/null; then
echo "Adding forge system user..."
useradd -r -g forge -d /srv/forge forge 1>/dev/null
fi
chown -R forge:forge /srv/forge
echo "The world data is stored under /srv/forge and the server runs as the forge user to increase security."
echo "Use the forged script under /usr/bin/forged to start, stop or backup the server."
echo "Adjust the configuration file under /etc/conf.d/forge to your liking."
echo "Make sure to change the SERVER_START_CMD variable if you want to use a JVM other than OpenJDK 8."
echo "Please note that you need Java 8 in order to run Forge."
echo "For the server to start you have to accept the EULA in /srv/forge/eula.txt!"
echo "The EULA file is generated after the first server start."
}
post_upgrade() {
if [ "$(vercmp "$2" "$_good_ver")" -lt 0 ]; then
post_install
IFS="_" read -ra _good_ver_temp <<< "$_good_ver"
_minecraft_ver=${_good_ver_temp[0]}
_old_name="forge-${_minecraft_ver}"
echo "==> NOTICE: All filenames have been changed from \"${_old_name}d\" to \"forged\"!"
echo "==> For example:"
echo "==> /usr/lib/systemd/system/${_old_name}d.service -> /usr/lib/systemd/system/forged.service"
echo "==> /usr/bin/${_old_name}d -> /usr/bin/forged"
echo "==> /srv/${_old_name} -> /srv/forge"
if [ -d "/srv/${_old_name}" ]; then
find "/srv/${_old_name}" -mindepth 1 -maxdepth 1 | while read -r _file; do
mv "$_file" "/srv/forge${_file#"/srv/${_old_name}"}"
done
rm -rf "/srv/${_old_name}"
echo "==> Game saves in /srv/${_old_name} were moved to /srv/forge."
fi
echo "==> The ${_old_name//./-} user was preserved on your system."
fi
chown -R forge:forge /srv/forge
}
post_remove() {
[ -d "/srv/forge" ] && echo "Game saves in /srv/forge were kept on your system."
echo "The forge user was preserved on your system."
}
|