aboutsummarylogtreecommitdiffstats
path: root/papermc.install
diff options
context:
space:
mode:
Diffstat (limited to 'papermc.install')
-rw-r--r--papermc.install35
1 files changed, 35 insertions, 0 deletions
diff --git a/papermc.install b/papermc.install
new file mode 100644
index 000000000000..f3ebcaaeb95c
--- /dev/null
+++ b/papermc.install
@@ -0,0 +1,35 @@
+_game="papermc"
+_user="papermc"
+_server_root="/srv/papermc"
+
+post_install() {
+ getent group "${_user}" &>/dev/null
+ if [ $? -ne 0 ]; then
+ echo "Adding ${_user} system group..."
+ groupadd -r ${_user} 1>/dev/null
+ fi
+
+ getent passwd "${_user}" &>/dev/null
+ if [ $? -ne 0 ]; then
+ echo "Adding ${_user} system user..."
+ useradd -r -g ${_user} -d "${_server_root}" ${_user} 1>/dev/null
+ fi
+
+ chown -R ${_user}:${_user} "${_server_root}"
+
+ echo "The world data is stored under ${_server_root} and the server runs as ${_user} user to increase security."
+ echo "Use the ${_game} script under /usr/bin/${_game} to start, stop or backup the server."
+ echo "Adjust the configuration file under /etc/conf.d/${_game} to your liking."
+ echo "For the server to start you have to accept the EULA in ${_server_root}/eula.txt !"
+ echo "The EULA file is generated after the first server start."
+}
+
+post_upgrade() {
+ chown -R ${_user}:${_user} "${_server_root}"
+}
+
+post_remove() {
+ # Notifying the user of kept dirs
+ [[ -d "${_server_root}" ]] && echo "Game saves in ${_server_root} were kept on your system."
+ echo "The ${_user} user was preserved on your system."
+}