2016-02-29 13:19:09 -08:00
|
|
|
_game="minecraft"
|
2016-02-29 12:35:38 -08:00
|
|
|
_user="minecraft"
|
|
|
|
_server_root="/srv/minecraft"
|
2015-09-20 14:23:34 -07:00
|
|
|
|
2016-01-23 03:45:46 -08:00
|
|
|
post_install() {
|
2016-02-29 12:35:38 -08:00
|
|
|
getent group "${_user}" &>/dev/null
|
2015-12-13 06:32:38 -08:00
|
|
|
if [ $? -ne 0 ]; then
|
2017-11-11 04:03:58 -08:00
|
|
|
echo "Adding ${_user} system group..."
|
2016-02-29 12:35:38 -08:00
|
|
|
groupadd -r ${_user} 1>/dev/null
|
2015-09-20 14:23:34 -07:00
|
|
|
fi
|
|
|
|
|
2016-02-29 12:35:38 -08:00
|
|
|
getent passwd "${_user}" &>/dev/null
|
2015-09-20 14:23:34 -07:00
|
|
|
if [ $? -ne 0 ]; then
|
2017-11-11 04:03:58 -08:00
|
|
|
echo "Adding ${_user} system user..."
|
2016-02-29 12:35:38 -08:00
|
|
|
useradd -r -g ${_user} -d "${_server_root}" ${_user} 1>/dev/null
|
2015-09-20 14:23:34 -07:00
|
|
|
fi
|
|
|
|
|
2016-02-29 12:35:38 -08:00
|
|
|
chown -R ${_user}:${_user} "${_server_root}"
|
2015-09-20 14:23:34 -07:00
|
|
|
|
2017-11-11 04:03:58 -08:00
|
|
|
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}d 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."
|
2015-09-20 14:23:34 -07:00
|
|
|
}
|
|
|
|
|
2015-07-03 10:16:00 -07:00
|
|
|
post_upgrade() {
|
2016-02-29 12:35:38 -08:00
|
|
|
chown -R ${_user}:${_user} "${_server_root}"
|
2015-09-20 14:23:34 -07:00
|
|
|
}
|
|
|
|
|
2015-07-03 10:16:00 -07:00
|
|
|
post_remove() {
|
2015-09-20 14:23:34 -07:00
|
|
|
# Notifying the user of kept dirs
|
2017-11-11 04:03:58 -08:00
|
|
|
[[ -d "${_server_root}" ]] && echo "Game saves in ${_server_root} were kept on your system."
|
|
|
|
echo "The ${_user} user was preserved on your system."
|
2015-07-03 10:16:00 -07:00
|
|
|
}
|