Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 15 Oct 2015 14:14:21 +0000 (UTC)
From:      Mathieu Arnold <mat@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r399340 - in head/games/minecraft-server: . files
Message-ID:  <201510151414.t9FEELo3013057@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: mat
Date: Thu Oct 15 14:14:21 2015
New Revision: 399340
URL: https://svnweb.freebsd.org/changeset/ports/399340

Log:
  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

Modified:
  head/games/minecraft-server/Makefile
  head/games/minecraft-server/files/minecraft.in
  head/games/minecraft-server/files/pkg-message.in
  head/games/minecraft-server/pkg-plist

Modified: head/games/minecraft-server/Makefile
==============================================================================
--- head/games/minecraft-server/Makefile	Thu Oct 15 14:14:06 2015	(r399339)
+++ head/games/minecraft-server/Makefile	Thu Oct 15 14:14:21 2015	(r399340)
@@ -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>

Modified: head/games/minecraft-server/files/minecraft.in
==============================================================================
--- head/games/minecraft-server/files/minecraft.in	Thu Oct 15 14:14:06 2015	(r399339)
+++ head/games/minecraft-server/files/minecraft.in	Thu Oct 15 14:14:21 2015	(r399340)
@@ -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 Mine
 
 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

Modified: head/games/minecraft-server/files/pkg-message.in
==============================================================================
--- head/games/minecraft-server/files/pkg-message.in	Thu Oct 15 14:14:06 2015	(r399339)
+++ head/games/minecraft-server/files/pkg-message.in	Thu Oct 15 14:14:21 2015	(r399340)
@@ -3,9 +3,9 @@ When you first run minecraft-server, it 
 
 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

Modified: head/games/minecraft-server/pkg-plist
==============================================================================
--- head/games/minecraft-server/pkg-plist	Thu Oct 15 14:14:06 2015	(r399339)
+++ head/games/minecraft-server/pkg-plist	Thu Oct 15 14:14:21 2015	(r399340)
@@ -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



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201510151414.t9FEELo3013057>