1
0
mirror of https://git.FreeBSD.org/ports.git synced 2025-01-13 07:34:50 +00:00

- Allow overriding the user/group as which the service is run

- Don't clobber LC_ALL/LANG
- Add a deinstallation message

PR:		194959
Submitted by:	joshruehlig@gmail.com / maintainer
Approved by:	Ben Woods (maintainer)
This commit is contained in:
Adam Weinberger 2014-11-13 21:37:05 +00:00
parent 1f52b7c2e5
commit 7da019815c
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=372539
2 changed files with 40 additions and 6 deletions

View File

@ -11,6 +11,14 @@
#
# %%PORTNAME%%_enable: Set to YES to enable %%PORTNAME%%
# Default: NO
# %%PORTNAME%%_user: The user account used to run the %%PORTNAME%% daemon.
# This is optional, however do not specifically set this to an
# empty string as this will cause the daemon to run as root.
# Default: %%USER%%
# %%PORTNAME%%_group: The group account used to run the %%PORTNAME%% daemon.
# This is optional, however do not specifically set this to an
# empty string as this will cause the daemon to run with group wheel.
# Default: %%GROUP%%
# %%PORTNAME%%_data_dir: Directory where %%PORTNAME%% configuration
# data is stored.
# Default: /var/db/%%PORTNAME%%
@ -21,22 +29,36 @@ rcvar=${name}_enable
load_rc_config $name
: ${%%PORTNAME%%_enable:="NO"}
: ${%%PORTNAME%%_user:="%%USER%%"}
: ${%%PORTNAME%%_group:="%%GROUP%%"}
: ${%%PORTNAME%%_data_dir:="/var/db/%%PORTNAME%%"}
pidfile="/var/run/%%PORTNAME%%.pid"
command="/usr/sbin/daemon"
procname="%%LOCALBASE%%/bin/mono"
command_args="-f -u %%USER%% -p ${pidfile} ${procname} %%PREFIX%%/lib/mediabrowser/MediaBrowser.Server.Mono.exe -ffmpeg %%LOCALBASE%%/bin/ffmpeg -ffprobe %%LOCALBASE%%/bin/ffprobe -programdata ${%%PORTNAME%%_data_dir}"
command_args="-f -p ${pidfile} ${procname} %%PREFIX%%/lib/mediabrowser/MediaBrowser.Server.Mono.exe -ffmpeg %%LOCALBASE%%/bin/ffmpeg -ffprobe %%LOCALBASE%%/bin/ffprobe -programdata ${%%PORTNAME%%_data_dir}"
start_precmd=mediabrowser_precmd
mediabrowser_precmd()
start_precmd=%%PORTNAME%%_precmd
%%PORTNAME%%_precmd()
{
export LC_ALL="C"
export LANG="C"
: ${LC_ALL:="C"}
: ${LANG:="C"}
export LC_ALL
export LANG
if [ ! -e "${pidfile}" ]; then
install -g ${%%PORTNAME%%_group} -o ${%%PORTNAME%%_user} -- /dev/null "${pidfile}";
fi
if [ ! -d "${%%PORTNAME%%_data_dir}" ]; then
install -d -g %%GROUP%% -o %%GROUP%% "${%%PORTNAME%%_data_dir}";
install -d -g ${%%PORTNAME%%_group} -o ${%%PORTNAME%%_user} -- "${%%PORTNAME%%_data_dir}";
fi
}
stop_postcmd=%%PORTNAME%%_postcmd
%%PORTNAME%%_postcmd()
{
rm -f -- "${pidfile}"
}
run_rc_command "$1"

View File

@ -0,0 +1,12 @@
#!/bin/sh
# $FreeBSD$
#
case $2 in
DEINSTALL)
echo "==> If you are uninstalling mediabrowser permanently,"
echo " and you do *NOT* want to retain the database, logs"
echo " configuration and media metadata, you should"
echo " manually delete directory /var/db/mediabrowser."
;;
esac