aboutsummarylogtreecommitdiffstats
path: root/minecraft-server.install
diff options
context:
space:
mode:
authorPhilip Abernethy2015-07-03 19:16:00 +0200
committerPhilip Abernethy2015-07-03 19:16:00 +0200
commit2c972cc0990cbd02218c6ad916b503b8c707f72a (patch)
treedc4350977bca49990125d2ee7db8a9e4d1392e43 /minecraft-server.install
downloadaur-2c972cc0990cbd02218c6ad916b503b8c707f72a.tar.gz
Initial commit
Diffstat (limited to 'minecraft-server.install')
-rw-r--r--minecraft-server.install33
1 files changed, 33 insertions, 0 deletions
diff --git a/minecraft-server.install b/minecraft-server.install
new file mode 100644
index 000000000000..3031324e0028
--- /dev/null
+++ b/minecraft-server.install
@@ -0,0 +1,33 @@
+post_install() {
+ post_upgrade
+}
+
+post_upgrade() {
+ getent group "minecraft" &>/dev/null || groupadd -r minecraft 1>/dev/null
+ getent passwd "minecraft" &>/dev/null && usermod -s "/usr/bin/nologin" minecraft &>/dev/null || useradd -r -g minecraft -d "/srv/minecraft" -s "/usr/bin/nologin" minecraft 1>/dev/null
+ touch /srv/minecraft/server.log
+ chown -R minecraft:minecraft "/srv/minecraft" 1>/dev/null
+ ln -s /srv/minecraft/server.log /var/log/minecraft.log &>/dev/null
+ # Removes old data from previous version
+ cat << EOF
+==> World data is stored under /srv/minecraft
+==> The server runs as "minecraft", not root
+==> You can access the server's console as root with:
+ $ screen -r minecraft
+==> The systemd service is called "minecraftd.service"
+==> Calling "stop" or "restart" with systemctl will gracefully exit the server, saving world data
+==> Modify /etc/conf.d/minecraft to change the invocation of the server if you wish
+==> A script at /usr/bin/minecraftctl is also provided. See the wiki for details on its usage.
+==> For the server to start you have to accept the EULA in /srv/minecraft/eula.txt
+
+EOF
+}
+
+post_remove() {
+ if getent passwd "minecraft" >/dev/null; then
+ userdel minecraft >/dev/null
+ fi
+ if getent group "minecraft" >/dev/null; then
+ groupdel minecraft >/dev/null
+ fi
+}