summaryrefslogtreecommitdiff
path: root/games/minecraft-server
diff options
context:
space:
mode:
authorMathieu Arnold <mat@FreeBSD.org>2015-10-15 14:14:21 +0000
committerMathieu Arnold <mat@FreeBSD.org>2015-10-15 14:14:21 +0000
commit24e4f4bff690f645bb8c2b45cfa8a2c1e7b41301 (patch)
treedf88a70115250ddaf2ab5d562b0ddf7de360d52d /games/minecraft-server
parentd8633ad2af12b8a9f5632f2792fc5bc482532586 (diff)
downloadfreebsd-ports-24e4f4bff690f645bb8c2b45cfa8a2c1e7b41301.zip
Allow to use different values for -Xmx and -Xms in the rc script. [1]
Cleanup. PR: 203664 [1] Submitted by: maintainer [1] Sponsored by: Absolight
Diffstat (limited to 'games/minecraft-server')
-rw-r--r--games/minecraft-server/Makefile22
-rw-r--r--games/minecraft-server/files/minecraft.in17
-rw-r--r--games/minecraft-server/files/pkg-message.in11
-rw-r--r--games/minecraft-server/pkg-plist4
4 files changed, 30 insertions, 24 deletions
diff --git a/games/minecraft-server/Makefile b/games/minecraft-server/Makefile
index 2580a5256474..618e508e87df 100644
--- a/games/minecraft-server/Makefile
+++ b/games/minecraft-server/Makefile
@@ -2,10 +2,10 @@
PORTNAME= minecraft-server
PORTVERSION= 1.8.8
+PORTREVISION= 1
CATEGORIES= games java
MASTER_SITES= https://s3.amazonaws.com/Minecraft.Download/versions/${PORTVERSION}/
-DISTNAME= minecraft_server.${PORTVERSION}.jar
-EXTRACT_SUFX=
+DISTFILES= minecraft_server.${PORTVERSION}.jar
EXTRACT_ONLY=
MAINTAINER= freebsd@jonathanprice.org
@@ -39,23 +39,15 @@ CONFIG_FILES= banned-ips.json \
usercache.json \
whitelist.json
-.include <bsd.port.options.mk>
-
-.if ${PORT_OPTIONS:MDAEMON}
-USE_RC_SUBR+= minecraft
-RUN_DEPENDS+= tmux:${PORTSDIR}/sysutils/tmux
-.endif
+DAEMON_VARS= USE_RC_SUBR=minecraft
+DAEMON_RUN_DEPENDS= tmux:${PORTSDIR}/sysutils/tmux
do-install:
${MKDIR} ${STAGEDIR}${PREFIX}/${PORTNAME}
- ${INSTALL_DATA} ${DISTDIR}/${DISTNAME} ${STAGEDIR}${PREFIX}/${PORTNAME}
+ ${INSTALL_DATA} ${DISTDIR}/${DISTFILES} ${STAGEDIR}${PREFIX}/${PORTNAME}
${MKDIR} ${STAGEDIR}${ETCDIR}
${MKDIR} ${STAGEDIR}/var/db/minecraft-server
${MKDIR} ${STAGEDIR}/var/log/minecraft-server
-.if ${PORT_OPTIONS:MSTANDALONE}
- ${INSTALL_SCRIPT} ${WRKDIR}/minecraft-server ${STAGEDIR}${PREFIX}/bin
- ${CP} ${FILESDIR}/java-args.txt ${STAGEDIR}${ETCDIR}
-.endif
.for file in ${CONFIG_FILES}
${LN} -s ${ETCDIR}/${file} ${STAGEDIR}${PREFIX}/${PORTNAME}/${file}
.endfor
@@ -63,4 +55,8 @@ do-install:
${LN} -sf /var/log/minecraft-server/debug ${STAGEDIR}${PREFIX}/${PORTNAME}/debug
${LN} -sf /var/db/minecraft-server ${STAGEDIR}${PREFIX}/${PORTNAME}/world
+post-install-STANDALONE-on:
+ ${INSTALL_SCRIPT} ${WRKDIR}/minecraft-server ${STAGEDIR}${PREFIX}/bin
+ ${CP} ${FILESDIR}/java-args.txt ${STAGEDIR}${ETCDIR}
+
.include <bsd.port.mk>
diff --git a/games/minecraft-server/files/minecraft.in b/games/minecraft-server/files/minecraft.in
index 45a873c25bbd..6e3d41d68cfd 100644
--- a/games/minecraft-server/files/minecraft.in
+++ b/games/minecraft-server/files/minecraft.in
@@ -7,7 +7,8 @@
#
# rc.conf variables:
# minecraft_enable (Default: NO)
-# minecraft_mem (Default: 1024M)
+# minecraft_mems (Default: 1024M)
+# minecraft_memx (Default: 1024M)
# minecraft_args (Default: "")
. /etc/rc.subr
@@ -17,7 +18,8 @@ desc="Dedicated server for the game Minecraft"
load_rc_config $name
-minecraft_mem=${minecraft_mem:-"1024M"}
+minecraft_mems=${minecraft_mems:-"1024M"}
+minecraft_memx=${minecraft_memx:-"1024M"}
minecraft_args=${minecraft_args:-""}
extra_commands="console status kill"
@@ -37,10 +39,17 @@ minecraft_start()
{
if is_running; then
echo "${name} is already running."
+ elif [ ${minecraft_mems%?} -gt ${minecraft_memx%?} ]; then
+ echo "ERROR: minecraft_mems is set greater than minecraft_memx."
+ echo "ERROR: Set minecraft_memx to be equal or greater than minecraft_mems in rc.conf."
else
+ if [ -n "${minecraft_mem}" ]; then
+ echo "WARNING: minecraft_mem is deprecated. Please change this to minecraft_memx."
+ minecraft_memx=${minecraft_mem}
+ fi
echo "Starting ${name}."
cd %%PREFIX%%/minecraft-server
- su mcserver -c "%%LOCALBASE%%/bin/tmux new-session -s minecraft -d '%%LOCALBASE%%/bin/java -Xmx${minecraft_mem} -Xms${minecraft_mem} ${minecraft_args} -jar %%PREFIX%%/minecraft-server/minecraft_server.%%VERSION%%.jar nogui'"
+ su mcserver -c "%%LOCALBASE%%/bin/tmux new-session -s minecraft -d '%%LOCALBASE%%/bin/java -Xmx${minecraft_memx} -Xms${minecraft_mems} ${minecraft_args} -jar %%PREFIX%%/minecraft-server/minecraft_server.%%VERSION%%.jar nogui'"
fi
}
@@ -62,7 +71,7 @@ minecraft_stop()
done
echo "WARN: ${name} could not be stopped or is taking longer than expected."
echo "WARN: To view the console, type 'service ${name} console'"
- echo "WARN: To kill $[name}, type 'service ${name} kill'"
+ echo "WARN: To kill ${name}, type 'service ${name} kill'"
else
echo "${name} is not running."
fi
diff --git a/games/minecraft-server/files/pkg-message.in b/games/minecraft-server/files/pkg-message.in
index fd86fa0a9925..4a538ae1e6c7 100644
--- a/games/minecraft-server/files/pkg-message.in
+++ b/games/minecraft-server/files/pkg-message.in
@@ -3,9 +3,9 @@ When you first run minecraft-server, it will populate the file
It is required to read the EULA, and then set eula=true
-- Configuration files can be found at %%ETCDIR%%
-- Log and debug output files can be found at /var/log/minecraft-server/
-- World files can be found at /var/db/minecraft-server
+- Configuration files can be found in %%ETCDIR%%/
+- Log and debug output files can be found in /var/log/minecraft-server/
+- World files can be found in /var/db/minecraft-server/
Without daemon option:
- To run the server, run %%PREFIX%%/bin/minecraft-server
@@ -13,8 +13,9 @@ Without daemon option:
With daemon option:
- The service has been installed with the name 'minecraft'
-- To adjust memory usage, use MINECRAFT_MEM= in /etc/rc.conf
-- To add other java parameters, use MINECRAFT_ARGS= in /etc/rc.conf
+- To adjust maximum memory usage (-Xmx), use minecraft_memx= in /etc/rc.conf
+- To adjust initial memory usage (-Xms), use minecraft_mems= in /etc/rc.conf
+- To add other java parameters, use minecraft_args= in /etc/rc.conf
- To see the interactive console, type service minecraft console
Users upgrading from version < 1.8 are advised to run the server to
diff --git a/games/minecraft-server/pkg-plist b/games/minecraft-server/pkg-plist
index 02007fc18c01..875811b65112 100644
--- a/games/minecraft-server/pkg-plist
+++ b/games/minecraft-server/pkg-plist
@@ -1,8 +1,6 @@
%%STANDALONE%%bin/minecraft-server
@owner mcserver
@group mcserver
-@dir minecraft-server
-@dir %%ETCDIR%%
%%STANDALONE%%%%ETCDIR%%/java-args.txt
minecraft-server/banned-ips.json
minecraft-server/banned-players.json
@@ -15,6 +13,8 @@ minecraft-server/server.properties
minecraft-server/usercache.json
minecraft-server/whitelist.json
minecraft-server/world
+@dir %%ETCDIR%%
+@dir minecraft-server
@dir /var/db/minecraft-server
@dir /var/log/minecraft-server
@owner