blob: 85b86186ae49126f074fcc99a0953531b951fbbe (
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
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
|
# Maintainer: thisischrys <thisischrys+aur at gmail dot com>
# Maintainer: Nitroretro <nitroretro@protonmail.com>
# Based on the `minecraft-server` AUR package by:
## Maintainer: Gordian Edenhofer <gordian.edenhofer@gmail.com>
## Contributor: Philip Abernethy <chais.z3r0@gmail.com>
## Contributor: sowieso <sowieso@dukun.de>
_ver="1.10.2_12.18.3.2185-11"
_minecraft_ver_latest="1.15.2"
IFS="-" read -ra _ver_temp <<< "$_ver"
IFS="_" read -ra _pkgver_temp <<< "${_ver_temp[0]}"
IFS="." read -ra _minecraft_ver_temp <<< "${_pkgver_temp[0]}"
_minecraft_ver=${_pkgver_temp[0]}
_minecraft_ver_major=${_minecraft_ver_temp[0]:-0}
_minecraft_ver_minor=${_minecraft_ver_temp[1]:-0}
_minecraft_ver_patch=${_minecraft_ver_temp[2]:-0}
_forge_ver=${_pkgver_temp[1]}
_pkgver=${_ver_temp[0]//_/-}
if [ "$_minecraft_ver" = "$_minecraft_ver_latest" ]; then
pkgname="forge-server"
_forge_name="forge"
else
pkgname="forge-server-${_minecraft_ver}"
_forge_name="forge-${_minecraft_ver}"
fi
pkgver=${_ver_temp[0]}
pkgrel=${_ver_temp[1]}
pkgdesc="Minecraft Forge server unit files, script and jar"
arch=("any")
url="https://minecraftforge.net"
license=("custom")
depends=("java-runtime-headless=8" "screen" "sudo" "bash" "awk" "sed")
optdepends=("tar: needed in order to create world backups"
"netcat: required in order to suspend an idle server")
provides=("forge-server=${pkgver}")
backup=("etc/conf.d/${_forge_name}")
install="forge-server.install"
source=("forged-backup.service"
"forged-backup.timer"
"forged.service"
"forged.conf"
"forged.sh")
noextract=("forge-${_pkgver}.jar")
sha512sums=('defb6beee84ef2406ac85fb92bfa551ba31fc7b68d207f97d9dc9118bec523dc21232c977a9aa49b0cab332cc9312c5e90fe3344b53b6dde8f1a4034d2865287'
'46e5bb0973420bb5701fb6c918e56d9c755d0483209145ada4e06fc6d73fe4dfbcf240846cc299da1dfd12b75e6ae7af12e86bc3dda0388b217f526fb91785b0'
'079fa3b2b46cde3fc9d076bf193a58a98fd9c30a7e21a32e64f60abe95b8f9231501bb4d188e776dd2ba5ed2ebe955b18e953db6a0686895e01b9f417fb29aca'
'fbcec43a558cc941a394c579255cab0bb3a466bd98c7087b8e3cc586fe2482e487fc846b9055fd0a3652964326f5a6a64e1895feaa89ba57d1478bc11d506859'
'c4983d0f4b2011f0ffed810ed7f69ea557ed8166b1c336401d6ea56e3f58bffa282059790ceb04384d1a1e728555ea7aecfe0d5c0cc9da2838957423bb08f806'
'12ef115f29883ee48ddfe0463e5a817d8754fba776d97951347b9d657227836f148c392df49eaed61887f7fb7f8653321ba419e07d34df89e76888e42f2283ae'
'dedd8e121e79bdd39c824a2d4acbc231ae6339cfd29894c4e7299359d23bc92423f4a865865372745be996b0bc14f5777e06baae8b1f4e5c302eadeac5aecf15'
'7f158bed6957e5285ce45a480f6a222065af5427bd48481ef24eb770ff540aa67b2d1c1ed976d216db94323017f7c7ee1dfe16e3f222b14189f9823e0b49f0f3'
'2c9bdefe7d022be139e7aec2e5f1cc1f83ea9d35d2c945e26422e140027b5107ce32c56f0b97e7dbf6b6edb282075df4a18c156a6ed6b064bcb10a3b4481a9aa'
'07860198b7d40726e9597f9ac748904a8e27bdcf87151f0b1c8c2ade024ad16aa83d412b70f900a7de3f58773f325ee45eb6c30cb1395e45a4d8092a19b4f845'
'7fe8163f3f1bb86e59508aff851eb571e280da36c24a6faf49ae51d6a000282bac8c388ac1c0c1208220b3f8fb62466285a306213f5a014faa1b619f4c48bf9b')
# -- Forge Installer -- #
if [ "$_minecraft_ver_minor" = 7 ]; then
source+=("forge-${_pkgver}-installer.jar"::"https://files.minecraftforge.net/maven/net/minecraftforge/forge/${_pkgver}-${_minecraft_ver}/forge-${_pkgver}-${_minecraft_ver}-installer.jar")
else
source+=("forge-${_pkgver}-installer.jar"::"https://files.minecraftforge.net/maven/net/minecraftforge/forge/${_pkgver}/forge-${_pkgver}-installer.jar")
fi
[ "$_minecraft_ver_minor" = 5 ] && source+=("https://files.minecraftforge.net/fmllibs/fml_libs15.zip") && noextract+=("fml_libs15.zip")
# -- /Forge Installer -- #
# -- Licenses -- #
_licenses=()
_license_suffix="-${pkgname}-${_pkgver}.txt"
if [ "$_minecraft_ver_minor" -ge 10 ]; then
_branch="${_minecraft_ver_major}.${_minecraft_ver_minor}.x"
elif [ "$_minecraft_ver_minor" -ge 7 ]; then
_branch="$_minecraft_ver"
elif [ "$_minecraft_ver_minor" = 6 ]; then
_branch="1.6"
else
_branch="v7.9"
fi
_add_license() {
_path=$1
_repo=${2:-MinecraftForge}
_github_branch=${3:-"$_branch"}
_filename="$(basename "$_path")${_license_suffix}"
_licenses+=("$_filename")
source+=("$_filename"::"https://raw.githubusercontent.com/MinecraftForge/${_repo}/${_github_branch}/${_path}.txt")
}
if [ "$_minecraft_ver_minor" -ge 13 ]; then
_add_license "LICENSE"
elif [ "$_minecraft_ver_minor" = 12 ]; then
_add_license "LICENSE-Paulscode%20IBXM%20Library"
_add_license "LICENSE-Paulscode%20SoundSystem%20CodecIBXM"
_add_license "LICENSE"
elif [ "$_minecraft_ver_minor" -ge 7 ]; then
_add_license "MinecraftForge-License"
_add_license "Paulscode%20IBXM%20Library%20License"
_add_license "Paulscode%20SoundSystem%20CodecIBXM%20License"
case "$_minecraft_ver_minor" in
8) _add_license "LICENSE-fml";;
7) _add_license "fml/LICENSE-fml";;
*) _add_license "LICENSE-fml" && _add_license "LICENSE-new";;
esac
elif [ "$_minecraft_ver_minor" = 6 ]; then
_add_license "install/MinecraftForge-License"
_add_license "install/Paulscode%20IBXM%20Library%20License"
_add_license "install/Paulscode%20SoundSystem%20CodecIBXM%20License"
_add_license "LICENSE-fml" "FML" "902772ed0cb6c22c4cd7ad9b0ec7a02961b5e016"
else
_add_license "LICENSE-fml"
fi
# -- /Licenses -- #
prepare() {
[ "$_minecraft_ver_minor" = 10 ] && mkdir mods
[ "$_minecraft_ver_minor" = 5 ] && unzip -o fml_libs15.zip -d lib
java -jar "forge-${_pkgver}-installer.jar" --installServer
}
package() {
_server_root="${pkgdir}/srv/${_forge_name}"
# Install forged
install -Dm644 "forged-backup.service" "${pkgdir}/usr/lib/systemd/system/${_forge_name}d-backup.service"
install -Dm644 "forged-backup.timer" "${pkgdir}/usr/lib/systemd/system/${_forge_name}d-backup.timer"
install -Dm644 "forged.service" "${pkgdir}/usr/lib/systemd/system/${_forge_name}d.service"
install -Dm644 "forged.conf" "${pkgdir}/etc/conf.d/${_forge_name}"
install -Dm755 "forged.sh" "${pkgdir}/usr/bin/${_forge_name}d"
# Install Forge
_forge_jar="forge-${_pkgver}.jar"
[ "$_minecraft_ver_minor" -le 11 ] && _forge_jar="forge-${_pkgver}-universal.jar"
[ "$_minecraft_ver_minor" = 7 ] && _forge_jar="forge-${_pkgver}-${_minecraft_ver}-universal.jar"
[ "$_minecraft_ver_minor" -le 6 ] && _forge_jar="minecraftforge-universal-${_pkgver}.jar"
install -Dm644 "$_forge_jar" "${_server_root}/$_forge_jar"
ln -s "$_forge_jar" "${_server_root}/forge.jar"
find libraries -type f -print0 | xargs -0 -i@ install -Dm644 "@" "${_server_root}/@"
[ "$_minecraft_ver_minor" = 5 ] && find lib -type f -print0 | xargs -0 -i@ install -Dm644 "@" "${_server_root}/@"
# Install Minecraft Server (for 1.12.2 or lower)
if [ "$_minecraft_ver_minor" = 5 ]; then
install -Dm644 "minecraft_server.${_minecraft_ver}.jar" "${_server_root}/minecraft_server.jar"
elif [ "$_minecraft_ver_minor" -le 12 ]; then
install -Dm644 "minecraft_server.${_minecraft_ver}.jar" "${_server_root}/minecraft_server.${_minecraft_ver}.jar"
fi
# Link log files
mkdir -p "${pkgdir}/var/log/"
install -dm2755 "${_server_root}/logs"
ln -s "/srv/${_forge_name}/logs" "${pkgdir}/var/log/${_forge_name}"
# Install licenses
for _license in "${_licenses[@]}"; do
_filename="$(basename "$_license" "$_license_suffix").txt"
_filename="${_filename//\%20/ }"
install -Dm644 "$_license" "${pkgdir}/usr/share/licenses/${pkgname}/$_filename"
done
chmod g+ws "${_server_root}"
}
|