FreeBSD Bugzilla – Attachment 152668 Details for
Bug 197387
[MAINTAINER] games/minecraft-server: Add support for running as a service
Home
|
New
|
Browse
|
Search
|
[?]
|
Reports
|
Help
|
New Account
|
Log In
Remember
[x]
|
Forgot Password
Login:
[x]
[patch]
Output from SVN patch
patch.diff (text/plain), 4.52 KB, created by
Jonathan Price
on 2015-02-07 14:35:31 UTC
(
hide
)
Description:
Output from SVN patch
Filename:
MIME Type:
Creator:
Jonathan Price
Created:
2015-02-07 14:35:31 UTC
Size:
4.52 KB
patch
obsolete
>Index: Makefile >=================================================================== >--- Makefile (revision 377170) >+++ Makefile (working copy) >@@ -2,6 +2,7 @@ > > PORTNAME= minecraft-server > PORTVERSION= 1.8.1 >+PORTREVISION= 1 > CATEGORIES= games java > MASTER_SITES= https://s3.amazonaws.com/Minecraft.Download/versions/${PORTVERSION}/ > DISTNAME= minecraft_server.${PORTVERSION}.jar >@@ -11,6 +12,10 @@ > MAINTAINER= freebsd@jonathanprice.org > COMMENT= Dedicated server for the game Minecraft > >+OPTIONS_DEFINE= DAEMON >+DAEMON_DESC= Allows controlling via rc.d >+OPTIONS_SUB= yes >+ > USERS= mcserver > GROUPS= ${USERS} > >@@ -27,6 +32,13 @@ > usercache.json \ > whitelist.json > >+.include <bsd.port.options.mk> >+ >+.if ${PORT_OPTIONS:MDAEMON} >+USE_RC_SUBR+= minecraft >+RUN_DEPENDS+= tmux:${PORTSDIR}/sysutils/tmux >+.endif >+ > do-install: > ${MKDIR} ${STAGEDIR}${PREFIX}/${PORTNAME} > ${INSTALL_DATA} ${DISTDIR}/${DISTNAME} ${STAGEDIR}${PREFIX}/${PORTNAME} >Index: files/minecraft.in >=================================================================== >--- files/minecraft.in (revision 0) >+++ files/minecraft.in (working copy) >@@ -0,0 +1,91 @@ >+#!/bin/sh >+# >+# $FreeBSD$ >+# PROVIDE: minecraft >+# REQUIRE: LOGIN >+# KEYWORD: shutdown >+# >+# rc.conf variables: >+# minecraft_enable (Default: NO) >+# minecraft_mem (Default: 1024M) >+# minecraft_args (Default: "") >+. /etc/rc.subr >+ >+name=minecraft >+rcvar=minecraft_enable >+desc="Dedicated server for the game Minecraft" >+ >+load_rc_config $name >+ >+minecraft_mem=${minecraft_mem:-"1024M"} >+minecraft_args=${minecraft_args:-""} >+ >+extra_commands="console status" >+start_cmd="${name}_start" >+stop_cmd="${name}_stop" >+console_cmd="${name}_console" >+status_cmd="${name}_status" >+ >+minecraft_start() >+{ >+ pgrep -qu mcserver java >+ isrunning=$? >+ if [ ${isrunning} -eq 0 ]; then >+ echo "${name} already running." >+ else >+ 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.1.8.1.jar nogui'" >+ fi >+} >+ >+minecraft_stop() >+{ >+ pgrep -qu mcserver java >+ isrunning=$? >+ if [ ${isrunning} -eq 0 ]; then >+ echo "Stopping ${name}." >+ su mcserver -c "%%LOCALBASE%%/bin/tmux send-keys -t ${name} \"stop\" ENTER" >+ >+ i=0 >+ while [ $i -lt 10 ]; do >+ i=$(($i + 1)) >+ pgrep -qu mcserver java >+ stillrunning=$? >+ if [ ${stillrunning} -eq 0 ]; then >+ sleep 1 >+ else >+ echo "${name} stopped." >+ return >+ fi >+ done >+ echo "ERROR: ${name} could not be stopped." >+ else >+ echo "${name} not running." >+ fi >+} >+ >+minecraft_console() >+{ >+ pgrep -qu mcserver java >+ isrunning=$? >+ if [ ${isrunning} -ne 0 ]; then >+ echo "${name} not running." >+ else >+ export TERM=xterm >+ su mcserver -c "%%LOCALBASE%%/bin/tmux attach-session -t ${name}" >+ fi >+} >+ >+minecraft_status() >+{ >+ pgrep -qu mcserver java >+ isrunning=$? >+ if [ ${isrunning} -eq 0 ]; then >+ echo "${name} is running." >+ else >+ echo "${name} is not running." >+ fi >+} >+ >+run_rc_command "$1" > >Property changes on: files/minecraft.in >___________________________________________________________________ >Added: svn:eol-style >## -0,0 +1 ## >+native >\ No newline at end of property >Added: svn:mime-type >## -0,0 +1 ## >+text/plain >\ No newline at end of property >Index: files/pkg-message.in >=================================================================== >--- files/pkg-message.in (revision 377170) >+++ files/pkg-message.in (working copy) >@@ -1,16 +1,22 @@ > When you first run minecraft-server, it will populate the file > %%ETCDIR%%/eula.txt > >-It is required to read the EULA, and then set: >-eula=true >+It is required to read the EULA, and then set eula=true > >-- To run the server, run %%PREFIX%%/bin/minecraft-server > - 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 >+ >+Without daemon option: >+- To run the server, run %%PREFIX%%/bin/minecraft-server > - To edit java's parameters, edit %%ETCDIR%%/java-args.txt > >-NOTE: >+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 see the interactive console, type service minecraft console >+ > Users upgrading from version < 1.8 are advised to run the server to > generate new config files, and then modify them based on their existing > configuration, as most files are now JSON instead of txt.
You cannot view the attachment while viewing its details because your browser does not support IFRAMEs.
View the attachment on a separate page
.
View Attachment As Diff
View Attachment As Raw
Flags:
freebsd
:
maintainer-approval+
Actions:
View
|
Diff
Attachments on
bug 197387
:
152663
|
152664
|
152665
| 152668