Upgpkg: 1.9-1
Make script and build files more easily adaptable for especially other flavors of minecraft servers.
This commit is contained in:
parent
f312efaac7
commit
cc8b55b179
2
.SRCINFO
2
.SRCINFO
|
@ -28,6 +28,6 @@ pkgbase = minecraft-server
|
||||||
md5sums = fef6fadd0739ae03ff71ba61025be207
|
md5sums = fef6fadd0739ae03ff71ba61025be207
|
||||||
md5sums = cab358c32dd0d4d2463e60ee2996f658
|
md5sums = cab358c32dd0d4d2463e60ee2996f658
|
||||||
md5sums = 54438e0c47cc5083e0a4376688b46092
|
md5sums = 54438e0c47cc5083e0a4376688b46092
|
||||||
md5sums = 59bf34cc34f61fc36824620bf5e7f2fd
|
md5sums = aa1603e6c4090bfcf3177cb59b15bae8
|
||||||
|
|
||||||
pkgname = minecraft-server
|
pkgname = minecraft-server
|
||||||
|
|
19
PKGBUILD
19
PKGBUILD
|
@ -28,21 +28,24 @@ md5sums=('ff68834eee875bcf367422c67673207c'
|
||||||
'fef6fadd0739ae03ff71ba61025be207'
|
'fef6fadd0739ae03ff71ba61025be207'
|
||||||
'cab358c32dd0d4d2463e60ee2996f658'
|
'cab358c32dd0d4d2463e60ee2996f658'
|
||||||
'54438e0c47cc5083e0a4376688b46092'
|
'54438e0c47cc5083e0a4376688b46092'
|
||||||
'59bf34cc34f61fc36824620bf5e7f2fd')
|
'aa1603e6c4090bfcf3177cb59b15bae8')
|
||||||
|
|
||||||
|
_game="minecraft"
|
||||||
|
_server_root="/srv/minecraft"
|
||||||
|
|
||||||
package() {
|
package() {
|
||||||
install -Dm644 minecraftd.conf "${pkgdir}/etc/conf.d/minecraft"
|
install -Dm644 minecraftd.conf "${pkgdir}/etc/conf.d/${_game}"
|
||||||
install -Dm755 minecraftd.sh "${pkgdir}/usr/bin/minecraftd"
|
install -Dm755 minecraftd.sh "${pkgdir}/usr/bin/${_game}d"
|
||||||
install -Dm644 minecraftd.service "${pkgdir}/usr/lib/systemd/system/minecraftd.service"
|
install -Dm644 minecraftd.service "${pkgdir}/usr/lib/systemd/system/${_game}d.service"
|
||||||
install -Dm644 minecraftd-backup.service "${pkgdir}/usr/lib/systemd/system/minecraftd-backup.service"
|
install -Dm644 minecraftd-backup.service "${pkgdir}/usr/lib/systemd/system/${_game}d-backup.service"
|
||||||
install -Dm644 minecraftd-backup.timer "${pkgdir}/usr/lib/systemd/system/minecraftd-backup.timer"
|
install -Dm644 minecraftd-backup.timer "${pkgdir}/usr/lib/systemd/system/${_game}d-backup.timer"
|
||||||
install -Dm644 minecraft_server.${pkgver}.jar "${pkgdir}/srv/minecraft/minecraft_server.${pkgver}.jar"
|
install -Dm644 minecraft_server.${pkgver}.jar "${pkgdir}/srv/minecraft/minecraft_server.${pkgver}.jar"
|
||||||
ln -s "minecraft_server.${pkgver}.jar" "${pkgdir}/srv/minecraft/minecraft_server.jar"
|
ln -s "minecraft_server.${pkgver}.jar" "${pkgdir}/srv/minecraft/minecraft_server.jar"
|
||||||
|
|
||||||
# Link the log files
|
# Link the log files
|
||||||
mkdir -p "${pkgdir}/var/log/"
|
mkdir -p "${pkgdir}/var/log/"
|
||||||
ln -s "/srv/minecraft/logs" "${pkgdir}/var/log/minecraft" #&>/dev/null
|
ln -s "${_server_root}/logs" "${pkgdir}/var/log/${_game}"
|
||||||
|
|
||||||
# Give the group write permissions and set user or group ID on execution
|
# Give the group write permissions and set user or group ID on execution
|
||||||
chmod g+ws "${pkgdir}/srv/minecraft"
|
chmod g+ws "${pkgdir}${_server_root}"
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,3 +1,4 @@
|
||||||
|
_game="minecraft"
|
||||||
_user="minecraft"
|
_user="minecraft"
|
||||||
_server_root="/srv/minecraft"
|
_server_root="/srv/minecraft"
|
||||||
|
|
||||||
|
@ -18,8 +19,8 @@ post_install() {
|
||||||
|
|
||||||
echo -e "\e[34;1m==>\e[39;1m NOTE: The world data is stored under ${_server_root} and the server runs \e[0m"
|
echo -e "\e[34;1m==>\e[39;1m NOTE: The world data is stored under ${_server_root} and the server runs \e[0m"
|
||||||
echo -e "\e[34;1m==>\e[39;1m as ${_user} user to increase security. \e[0m"
|
echo -e "\e[34;1m==>\e[39;1m as ${_user} user to increase security. \e[0m"
|
||||||
echo -e "\e[34;1m==>\e[39;1m NOTE: Use the minecraft script under /usr/bin/minecraftd to start, stop or backup the server \e[0m"
|
echo -e "\e[34;1m==>\e[39;1m NOTE: Use the ${_game} script under /usr/bin/${_game}d to start, stop or backup the server \e[0m"
|
||||||
echo -e "\e[34;1m==>\e[39;1m and the configuration file under /etc/conf.d/minecraft to adjust it to your liking. \e[0m"
|
echo -e "\e[34;1m==>\e[39;1m and the configuration file under /etc/conf.d/${_game} to adjust it to your liking. \e[0m"
|
||||||
echo -e "\e[34;1m==>\e[39;1m NOTE: For the server to start you have to accept the EULA in ${_server_root}/eula.txt \e[0m"
|
echo -e "\e[34;1m==>\e[39;1m NOTE: For the server to start you have to accept the EULA in ${_server_root}/eula.txt \e[0m"
|
||||||
echo -e "\e[34;1m==>\e[39;1m which is generated after the first server start. \e[0m"
|
echo -e "\e[34;1m==>\e[39;1m which is generated after the first server start. \e[0m"
|
||||||
}
|
}
|
||||||
|
@ -27,26 +28,26 @@ post_install() {
|
||||||
post_upgrade() {
|
post_upgrade() {
|
||||||
chown -R ${_user}:${_user} "${_server_root}"
|
chown -R ${_user}:${_user} "${_server_root}"
|
||||||
|
|
||||||
if [[ -f /etc/conf.d/minecraft.pacnew ]]; then
|
if [[ -f /etc/conf.d/${_game}.pacnew ]]; then
|
||||||
echo -e "\e[34;1m==>\e[39;1m NOTE: There was a new change on how backup files are handled! Unfortunately this makes \e[0m"
|
echo -e "\e[34;1m==>\e[39;1m NOTE: There was a new change on how backup files are handled! Unfortunately this makes \e[0m"
|
||||||
echo -e "\e[34;1m==>\e[39;1m old backups incompatible with the newly implemeted restore feature. Bare in mind that no data is lost \e[0m"
|
echo -e "\e[34;1m==>\e[39;1m old backups incompatible with the newly implemeted restore feature. Bare in mind that no data is lost \e[0m"
|
||||||
echo -e "\e[34;1m==>\e[39;1m neither are those backups useless. They just will not work with the restore capability of the management script. \e[0m"
|
echo -e "\e[34;1m==>\e[39;1m neither are those backups useless. They just will not work with the restore capability of the management script. \e[0m"
|
||||||
echo -e "\e[34;1m==>\e[39;1m NOTE: Please merge the new configuration file into /etc/conf.d/minecraft by e.g. using pacdiff. \e[0m"
|
echo -e "\e[34;1m==>\e[39;1m NOTE: Please merge the new configuration file into /etc/conf.d/${_game} by e.g. using pacdiff. \e[0m"
|
||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
pre_remove() {
|
pre_remove() {
|
||||||
echo -e "\e[34;1m==>\e[39;1m Stopping and disabling minecraftd... \e[0m"
|
echo -e "\e[34;1m==>\e[39;1m Stopping and disabling ${_game}d... \e[0m"
|
||||||
systemctl stop minecrafd.service
|
systemctl stop ${_game}d.service
|
||||||
systemctl disable minecraftd.service
|
systemctl disable ${_game}d.service
|
||||||
|
|
||||||
/usr/bin/minecraftd stop > /dev/null
|
/usr/bin/${_game}d stop > /dev/null
|
||||||
}
|
}
|
||||||
|
|
||||||
post_remove() {
|
post_remove() {
|
||||||
# Notifying the user of kept dirs
|
# Notifying the user of kept dirs
|
||||||
[[ -d "${_server_root}" ]] && chown -R root:root "${_server_root}" && echo -e "\e[34;1m==>\e[39;1m NOTE: Game saves in ${_server_root} were kept on your system.\e[0m"
|
[[ -d "${_server_root}" ]] && chown -R root:root "${_server_root}" && echo -e "\e[34;1m==>\e[39;1m NOTE: Game saves in ${_server_root} were kept on your system.\e[0m"
|
||||||
[[ -f "/etc/conf.d/minecraft" ]] && echo -e "\e[34;1m==>\e[39;1m NOTE: Your configuration file /etc/conf.d/minecraft was kept on your system.\e[0m"
|
[[ -f "/etc/conf.d/${_game}" ]] && echo -e "\e[34;1m==>\e[39;1m NOTE: Your configuration file /etc/conf.d/${_game} was kept on your system.\e[0m"
|
||||||
|
|
||||||
echo -e "\e[34;1m==>\e[39;1m Removing ${_user} system user and group... \e[0m"
|
echo -e "\e[34;1m==>\e[39;1m Removing ${_user} system user and group... \e[0m"
|
||||||
if getent passwd ${_user} >/dev/null 2>&1; then
|
if getent passwd ${_user} >/dev/null 2>&1; then
|
||||||
|
|
|
@ -32,7 +32,7 @@ declare -r game="minecraft"
|
||||||
[[ ! -z "${IDLE_IF_TIME}" ]] && declare -r IDLE_IF_TIME=${IDLE_IF_TIME} || IDLE_IF_TIME="1200"
|
[[ ! -z "${IDLE_IF_TIME}" ]] && declare -r IDLE_IF_TIME=${IDLE_IF_TIME} || IDLE_IF_TIME="1200"
|
||||||
|
|
||||||
# Variables passed over the command line will always override the one from a config file
|
# Variables passed over the command line will always override the one from a config file
|
||||||
source /etc/conf.d/minecraft || echo "Could not source /etc/conf.d/minecraft"
|
source /etc/conf.d/${game} || echo "Could not source /etc/conf.d/${game}"
|
||||||
|
|
||||||
# Check whether sudo is needed at all
|
# Check whether sudo is needed at all
|
||||||
if [[ $(whoami) == ${GAME_USER} ]]; then
|
if [[ $(whoami) == ${GAME_USER} ]]; then
|
||||||
|
|
Loading…
Reference in New Issue
Block a user