Skip site navigation (1)Skip section navigation (2)
Date:      Thu, 13 Nov 2014 21:37:05 +0000 (UTC)
From:      Adam Weinberger <adamw@FreeBSD.org>
To:        ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org
Subject:   svn commit: r372539 - in head/multimedia/mediabrowser: . files
Message-ID:  <201411132137.sADLb5Uc092249@svn.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: adamw
Date: Thu Nov 13 21:37:05 2014
New Revision: 372539
URL: https://svnweb.freebsd.org/changeset/ports/372539
QAT: https://qat.redports.org/buildarchive/r372539/

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

Added:
  head/multimedia/mediabrowser/pkg-deinstall   (contents, props changed)
Modified:
  head/multimedia/mediabrowser/files/mediabrowser.in

Modified: head/multimedia/mediabrowser/files/mediabrowser.in
==============================================================================
--- head/multimedia/mediabrowser/files/mediabrowser.in	Thu Nov 13 20:54:19 2014	(r372538)
+++ head/multimedia/mediabrowser/files/mediabrowser.in	Thu Nov 13 21:37:05 2014	(r372539)
@@ -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"

Added: head/multimedia/mediabrowser/pkg-deinstall
==============================================================================
--- /dev/null	00:00:00 1970	(empty, because file is newly added)
+++ head/multimedia/mediabrowser/pkg-deinstall	Thu Nov 13 21:37:05 2014	(r372539)
@@ -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



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