packaging - install service files for sysviniti and shitstemd
* provide init sysvinit unit file script * provide shitstemd unit file * sed command at install make to change install path * only install sysvinit and shitstemd service units * service unit for openrc is provided at misc/alpine directory
This commit is contained in:
parent
4c7bf4c344
commit
d53b4d531e
@ -1,10 +1,10 @@
|
||||
cmake_minimum_required(VERSION 3.5)
|
||||
|
||||
# Set policies up to 3.9 since we want to enable the IPO option
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.9)
|
||||
if(${CMAKE_VERSION} VERSION_LESS 3.8)
|
||||
cmake_policy(VERSION ${CMAKE_MAJOR_VERSION}.${CMAKE_MINOR_VERSION})
|
||||
else()
|
||||
cmake_policy(VERSION 3.9)
|
||||
cmake_policy(SET CMP0025 OLD)
|
||||
endif()
|
||||
|
||||
# This can be read from ${PROJECT_NAME} after project() is called
|
||||
@ -23,7 +23,7 @@ set(VERSION_PATCH 0)
|
||||
set(VERSION_EXTRA "" CACHE STRING "Stuff to append to version string")
|
||||
|
||||
# Change to false for releases
|
||||
set(DEVELOPMENT_BUILD TRUE)
|
||||
set(DEVELOPMENT_BUILD FALSE)
|
||||
|
||||
set(VERSION_STRING "${VERSION_MAJOR}.${VERSION_MINOR}.${VERSION_PATCH}")
|
||||
if(VERSION_EXTRA)
|
||||
@ -247,8 +247,8 @@ if(RUN_IN_PLACE)
|
||||
install(FILES "${CMAKE_CURRENT_SOURCE_DIR}/textures/texture_packs_here.txt" DESTINATION "${SHAREDIR}/textures")
|
||||
endif()
|
||||
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/minetest_game" DESTINATION "${SHAREDIR}/games/"
|
||||
COMPONENT "SUBGAME_MINETEST_GAME" OPTIONAL PATTERN ".git*" EXCLUDE )
|
||||
#install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/minetest_game" DESTINATION "${SHAREDIR}/games/"
|
||||
# COMPONENT "SUBGAME_MINETEST_GAME" OPTIONAL PATTERN ".git*" EXCLUDE )
|
||||
install(DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/games/devtest" DESTINATION "${SHAREDIR}/games/"
|
||||
COMPONENT "SUBGAME_MINIMAL" OPTIONAL PATTERN ".git*" EXCLUDE )
|
||||
|
||||
@ -274,9 +274,14 @@ if(UNIX AND NOT APPLE)
|
||||
install(FILES "misc/net.minetest.minetest.desktop" DESTINATION "${XDG_APPS_DIR}")
|
||||
install(FILES "misc/net.minetest.minetest.appdata.xml" DESTINATION "${APPDATADIR}")
|
||||
install(FILES "misc/minetest.svg" DESTINATION "${ICONDIR}/hicolor/scalable/apps")
|
||||
install(FILES "misc/minetest-xorg-icon-128.png"
|
||||
DESTINATION "${ICONDIR}/hicolor/128x128/apps"
|
||||
RENAME "minetest.png")
|
||||
install(FILES "misc/minetest-xorg-icon-128.png" DESTINATION "${ICONDIR}/hicolor/128x128/apps" RENAME "minetest.png")
|
||||
install(FILES "misc/minetestserver.service" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/systemd/system/")
|
||||
install(FILES "misc/minetestserver@service" DESTINATION "${CMAKE_INSTALL_PREFIX}/lib/systemd/system/")
|
||||
install(FILES "misc/minetestserver.init" PERMISSIONS WORLD_EXECUTE OWNER_WRITE OWNER_READ DESTINATION "${CMAKE_INSTALL_PREFIX}/../etc/init.d/" RENAME "minetestserver")
|
||||
install(FILES "misc/minetest.logrotate" DESTINATION "${CMAKE_INSTALL_PREFIX}/../etc/logrotate.d/" RENAME "minetestserver")
|
||||
install(CODE "execute_process(COMMAND sed -i -r \"s@INSTALLPLACE@${CMAKE_INSTALL_PREFIX}@g\" \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/systemd/system/minetestserver.service)")
|
||||
install(CODE "execute_process(COMMAND sed -i -r \"s@INSTALLPLACE@${CMAKE_INSTALL_PREFIX}@g\" \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/lib/systemd/system/minetestserver@.service)")
|
||||
install(CODE "execute_process(COMMAND sed -i -r \"s@INSTALLPLACE@${CMAKE_INSTALL_PREFIX}@g\" \$ENV{DESTDIR}${CMAKE_INSTALL_PREFIX}/../etc/init.d/minetestserver)")
|
||||
endif()
|
||||
|
||||
if(APPLE)
|
||||
|
80
misc/minetestserver.init
Normal file
80
misc/minetestserver.init
Normal file
@ -0,0 +1,80 @@
|
||||
#! /bin/sh
|
||||
### BEGIN INIT INFO
|
||||
# Provides: minetest-server
|
||||
# Required-Start: $remote_fs $network
|
||||
# Required-Stop: $remote_fs $network
|
||||
# Default-Start: 2 3 4 5
|
||||
# Default-Stop: 0 1 6
|
||||
# Short-Description: Start minetest network game server
|
||||
# Description: dedicated game server for Minetest
|
||||
### END INIT INFO
|
||||
|
||||
PATH="/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin"
|
||||
NAME="minetestserver"
|
||||
DAEMON="INSTALLPLACE/bin/$NAME"
|
||||
DESC="minetest network game server"
|
||||
PIDFILE="/var/run/$NAME.pid"
|
||||
BINARY="INSTALLPLACE/bin/$NAME"
|
||||
USER="minetest"
|
||||
|
||||
test -x $DAEMON || exit 0
|
||||
|
||||
. /lib/lsb/init-functions
|
||||
|
||||
# Include defaults if available
|
||||
if [ -f /etc/default/$NAME ] ; then
|
||||
. /etc/default/$NAME
|
||||
fi
|
||||
|
||||
minetest_start() {
|
||||
start-stop-daemon \
|
||||
--start \
|
||||
--quiet \
|
||||
--pidfile $PIDFILE \
|
||||
--oknodo \
|
||||
--background \
|
||||
--exec $BINARY \
|
||||
--startas $DAEMON \
|
||||
--make-pidfile --chuid $USER \
|
||||
-- $DAEMON_OPTS > /dev/null 2>&1 || return 1
|
||||
return 0
|
||||
}
|
||||
|
||||
minetest_stop() {
|
||||
start-stop-daemon \
|
||||
--stop \
|
||||
--quiet \
|
||||
--pidfile $PIDFILE \
|
||||
--oknodo \
|
||||
--exec $BINARY || return 1
|
||||
rm -f $PIDFILE
|
||||
return 0
|
||||
}
|
||||
|
||||
case "$1" in
|
||||
start)
|
||||
log_begin_msg "Starting $DESC: $NAME"
|
||||
minetest_start
|
||||
log_end_msg $?
|
||||
;;
|
||||
stop)
|
||||
log_begin_msg "Stopping $DESC: $NAME"
|
||||
minetest_stop
|
||||
log_end_msg $?
|
||||
;;
|
||||
restart|force-reload)
|
||||
log_begin_msg "Restarting $DESC: $NAME"
|
||||
minetest_stop && sleep 1 && minetest_start
|
||||
log_end_msg $?
|
||||
;;
|
||||
status)
|
||||
status_of_proc -p "$PIDFILE" "$DAEMON" "$NAME" && exit 0 || exit $?
|
||||
;;
|
||||
*)
|
||||
# echo "Usage: $0 {start|stop|restart|reload|force-reload}" >&2
|
||||
echo "Usage: $0 {start|stop|restart|force-reload|status}" >&2
|
||||
exit 1
|
||||
;;
|
||||
esac
|
||||
|
||||
exit 0
|
9
misc/minetestserver.logrotate
Normal file
9
misc/minetestserver.logrotate
Normal file
@ -0,0 +1,9 @@
|
||||
/var/log/minetest/*.log {
|
||||
daily
|
||||
missingok
|
||||
rotate 14
|
||||
compress
|
||||
delaycompress
|
||||
notifempty
|
||||
copytruncate
|
||||
}
|
16
misc/minetestserver.service
Normal file
16
misc/minetestserver.service
Normal file
@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Minetest multiplayer server minetest.conf server config
|
||||
Documentation=man:minetestserver(6)
|
||||
After=network.target
|
||||
RequiresMountsFor=/var/games/minetest
|
||||
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
User=minetest
|
||||
Group=games
|
||||
ExecStart=INSTALLPLACE/bin/minetestserver --config /etc/minetest/minetest.conf --logfile /var/log/minetest/minetest.log
|
||||
StandardOutput=null
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
16
misc/minetestserver@.service
Normal file
16
misc/minetestserver@.service
Normal file
@ -0,0 +1,16 @@
|
||||
[Unit]
|
||||
Description=Minetest multiplayer server %i.conf server config
|
||||
Documentation=man:minetestserver(6)
|
||||
After=network.target
|
||||
RequiresMountsFor=/var/games/minetest
|
||||
|
||||
[Service]
|
||||
Restart=on-failure
|
||||
User=Debian-minetest
|
||||
Group=games
|
||||
ExecStart=INSTALLPLACE/bin/minetestserver --config /etc/minetest/%i.conf --logfile /var/log/minetest/%i.log
|
||||
StandardOutput=null
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
|
Loading…
x
Reference in New Issue
Block a user