diff options
author | brooks <brooks@FreeBSD.org> | 2008-04-04 23:48:14 +0800 |
---|---|---|
committer | brooks <brooks@FreeBSD.org> | 2008-04-04 23:48:14 +0800 |
commit | cdf33ec435eb3e69ab9f7fd31842e0927c39ead4 (patch) | |
tree | e26bae5b418e2d5c7303ccc217e8702cea5b267f | |
parent | 45de829e1bd62a34c07fea5a7baa44ac56077833 (diff) | |
download | freebsd-ports-gnome-cdf33ec435eb3e69ab9f7fd31842e0927c39ead4.tar.gz freebsd-ports-gnome-cdf33ec435eb3e69ab9f7fd31842e0927c39ead4.tar.zst freebsd-ports-gnome-cdf33ec435eb3e69ab9f7fd31842e0927c39ead4.zip |
Install squeezecenter with more normal permissions using the COPYTREE_SHARE
macro.
Use rc.subr's user and group startup functionality instead of the poorly
supported code in squeezecenter.
Switch to the default log layout where mutiple log files end up in
/var/log/slimserver. Changing location is required due to the startup
change and the split layout is easier to handle.
-rw-r--r-- | audio/squeezeboxserver/Makefile | 12 | ||||
-rw-r--r-- | audio/squeezeboxserver/files/pkg-install.in | 28 | ||||
-rw-r--r-- | audio/squeezeboxserver/files/squeezecenter.sh.in | 55 | ||||
-rw-r--r-- | audio/squeezecenter/Makefile | 12 | ||||
-rw-r--r-- | audio/squeezecenter/files/pkg-install.in | 28 | ||||
-rw-r--r-- | audio/squeezecenter/files/squeezecenter.sh.in | 55 |
6 files changed, 90 insertions, 100 deletions
diff --git a/audio/squeezeboxserver/Makefile b/audio/squeezeboxserver/Makefile index 8f073a356146..75f9df5e8411 100644 --- a/audio/squeezeboxserver/Makefile +++ b/audio/squeezeboxserver/Makefile @@ -7,7 +7,7 @@ PORTNAME= squeezecenter PORTVERSION= 7.0.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= audio MASTER_SITES= http://www.slimdevices.com/downloads/SqueezeCenter_v${PORTVERSION}/ DISTNAME= ${PORTNAME}-7.0-noCPAN @@ -183,9 +183,9 @@ pre-install: do-install: @${MKDIR} -m 0755 ${PREFIX}/${SLIMDIR} @${LN} -s ${SLIMDBDIR}/cache ${PREFIX}/${SLIMDIR}/Cache - @cd ${TMP_SLIMDIR} && \ - ${FIND} . | \ - ${CPIO} ${CPIOARGS} ${BINOWN}:${BINGRP} ${PREFIX}/${SLIMDIR} + @cd ${TMP_SLIMDIR} && ${COPYTREE_SHARE} . ${PREFIX}/${SLIMDIR} + @${CHMOD} 755 ${PREFIX}/${SLIMDIR}/slimserver.pl + @${CHMOD} 755 ${PREFIX}/${SLIMDIR}/scanner.pl @${LN} -s ${LOCALBASE}/share/mysql/errmsg.txt \ ${PREFIX}/${SLIMDIR}/MySQL/ @${LN} -s ${LOCALBASE}/share/mysql/english/errmsg.sys \ @@ -193,9 +193,7 @@ do-install: @${INSTALL_SCRIPT} ${WRKDIR}/softsqueeze.sh ${PREFIX}/bin/softsqueeze .if !defined(NOPORTDOCS) @${MKDIR} ${DOCSDIR} - @cd ${TMP_DOCSDIR} && \ - ${FIND} . | \ - ${CPIO} ${CPIOARGS} ${BINOWN}:${BINGRP} ${DOCSDIR} + @cd ${TMP_DOCSDIR} && ${COPYTREE_SHARE} . ${DOCSDIR} .endif post-install: diff --git a/audio/squeezeboxserver/files/pkg-install.in b/audio/squeezeboxserver/files/pkg-install.in index 546c4f467a0a..8fd4dd600fc8 100644 --- a/audio/squeezeboxserver/files/pkg-install.in +++ b/audio/squeezeboxserver/files/pkg-install.in @@ -1,5 +1,5 @@ #!/bin/sh -# $FreeBSD: /tmp/pcvs/ports/audio/squeezeboxserver/files/pkg-install.in,v 1.4 2008-04-02 17:30:27 brooks Exp $ +# $FreeBSD: /tmp/pcvs/ports/audio/squeezeboxserver/files/pkg-install.in,v 1.5 2008-04-04 15:48:14 brooks Exp $ name=slimserver u=%%SLIMUSER%% @@ -15,9 +15,11 @@ conffile=${statedir}/squeezecenter.conf playlistdir=${statedir}/playlists pidfile=/var/run/${name}.pid newsyslogfile=/etc/newsyslog.conf -logfile=/var/log/squeezecenter.log logcomment="# added by audio/squeezecenter port" -logline="${logfile} ${u}:${g} 644 3 100 * J ${pidfile}" +serverlogfile=/var/log/squeezecenter/server.log +scannerlogfile=/var/log/squeezecenter/scanner.log +serverlogline="${serverlogfile} ${u}:${g} 644 3 100 * J ${pidfile}" +scannerlogline="${scannerlogfile} ${u}:${g} 644 3 100 * J ${pidfile}" case $2 in PRE-INSTALL) @@ -44,27 +46,13 @@ PRE-INSTALL) fi ;; POST-INSTALL) - if [ -d ${statedir} ]; then - chown -R ${u}:${g} ${statedir} - fi - if [ -d ${cachedir} ]; then - chown -R ${u}:${g} ${cachedir} - fi - if [ -d ${playlistdir} ]; then - chown -R ${u}:${g} ${playlistdir} - fi - if [ -f ${conffile} ]; then - chown ${u}:${g} ${conffile} - fi - if [ -f ${logfile} ]; then - chown ${u}:${g} ${logfile} - fi - if egrep -q "^${logfile}\>" ${newsyslogfile}; then + if egrep -q "^${serverlogfile}\>" ${newsyslogfile}; then echo "Using existing ${newsyslogfile} entry." else echo "Adding squeezecenter log entry to ${newsyslogfile}." echo "$logcomment" >> ${newsyslogfile} - echo "$logline" >> ${newsyslogfile} + echo "$serverlogline" >> ${newsyslogfile} + echo "$scannerlogline" >> ${newsyslogfile} fi for file in %%CONFFILES%%; do path="${slimdir}/${file}" diff --git a/audio/squeezeboxserver/files/squeezecenter.sh.in b/audio/squeezeboxserver/files/squeezecenter.sh.in index 21ae9822438b..9b4a6f2687dc 100644 --- a/audio/squeezeboxserver/files/squeezecenter.sh.in +++ b/audio/squeezeboxserver/files/squeezecenter.sh.in @@ -17,12 +17,13 @@ name=squeezecenter start_precmd="squeezecenter_start_precmd" +stop_postcmd="squeezecenter_stop_postcmd" rcvar=`set_rcvar` command=%%PREFIX%%/%%SLIMDIR%%/slimserver.pl command_interpreter=%%PERL%% -pidfile=/var/run/${name}.pid -logfile=/var/log/squeezecenter.log +pidfile=/var/run/${name}/${name}.pid +logdir=/var/log/squeezecenter statedir=%%SLIMDBDIR%% cachedir=${statedir}/cache prefsdir=${statedir}/prefs @@ -30,33 +31,41 @@ playlistdir=${statedir}/playlists conffile=${statedir}/squeezecenter.conf u=%%SLIMUSER%% g=%%SLIMGROUP%% -command_args="--daemon --prefsfile=${conffile} --logfile=${logfile} --user=${u} --group=${g} --pidfile=${pidfile}" +command_args="--daemon --prefsfile=${conffile} --pidfile=${pidfile}" +squeezecenter_user=${u} +squeezecenter_group=${g} squeezecenter_start_precmd() { - if [ ! -d ${statedir} ]; then - mkdir -p ${statedir} - chown -R ${u}:${g} ${statedir} - fi - if [ ! -d ${cachedir} ]; then - mkdir -p ${cachedir} - chown -R ${u}:${g} ${cachedir} - fi - if [ ! -d ${prefsdir} ]; then - mkdir -p ${prefsdir} - chown -R ${u}:${g} ${prefsdir} - fi - if [ ! -d ${playlistdir} ]; then - mkdir -p ${playlistdir} - chown -R ${u}:${g} ${playlistdir} - fi - if [ ! -f ${conffile} ]; then - touch ${conffile} - chown ${u}:${g} ${conffile} - fi + mkdir -p /var/run/${name} + chown -R ${u}:${g} /var/run/${name} + + mkdir -p ${logdir} + chown -R ${u}:${g} ${logdir} + + mkdir -p ${statedir} + mkdir -p ${cachedir} + mkdir -p ${prefsdir} + mkdir -p ${playlistdir} + touch ${conffile} + chown -R ${u}:${g} ${statedir} + if [ ! -f ${logfile} ]; then touch ${logfile} chown ${u}:${g} ${logfile} + fi +} + +squeezecenter_stop_postcmd() +{ + pids=`pgrep -u $u` + if [ -n "${pids}" ]; then + sleep 1 + kill $pids > /dev/null 2>&1 + fi + pids=`pgrep -u $u` + if [ -n "${pids}" ]; then + wait_for_pids $pids fi } diff --git a/audio/squeezecenter/Makefile b/audio/squeezecenter/Makefile index 8f073a356146..75f9df5e8411 100644 --- a/audio/squeezecenter/Makefile +++ b/audio/squeezecenter/Makefile @@ -7,7 +7,7 @@ PORTNAME= squeezecenter PORTVERSION= 7.0.0 -PORTREVISION= 1 +PORTREVISION= 2 CATEGORIES= audio MASTER_SITES= http://www.slimdevices.com/downloads/SqueezeCenter_v${PORTVERSION}/ DISTNAME= ${PORTNAME}-7.0-noCPAN @@ -183,9 +183,9 @@ pre-install: do-install: @${MKDIR} -m 0755 ${PREFIX}/${SLIMDIR} @${LN} -s ${SLIMDBDIR}/cache ${PREFIX}/${SLIMDIR}/Cache - @cd ${TMP_SLIMDIR} && \ - ${FIND} . | \ - ${CPIO} ${CPIOARGS} ${BINOWN}:${BINGRP} ${PREFIX}/${SLIMDIR} + @cd ${TMP_SLIMDIR} && ${COPYTREE_SHARE} . ${PREFIX}/${SLIMDIR} + @${CHMOD} 755 ${PREFIX}/${SLIMDIR}/slimserver.pl + @${CHMOD} 755 ${PREFIX}/${SLIMDIR}/scanner.pl @${LN} -s ${LOCALBASE}/share/mysql/errmsg.txt \ ${PREFIX}/${SLIMDIR}/MySQL/ @${LN} -s ${LOCALBASE}/share/mysql/english/errmsg.sys \ @@ -193,9 +193,7 @@ do-install: @${INSTALL_SCRIPT} ${WRKDIR}/softsqueeze.sh ${PREFIX}/bin/softsqueeze .if !defined(NOPORTDOCS) @${MKDIR} ${DOCSDIR} - @cd ${TMP_DOCSDIR} && \ - ${FIND} . | \ - ${CPIO} ${CPIOARGS} ${BINOWN}:${BINGRP} ${DOCSDIR} + @cd ${TMP_DOCSDIR} && ${COPYTREE_SHARE} . ${DOCSDIR} .endif post-install: diff --git a/audio/squeezecenter/files/pkg-install.in b/audio/squeezecenter/files/pkg-install.in index 35cf842b7c81..47d5471e943a 100644 --- a/audio/squeezecenter/files/pkg-install.in +++ b/audio/squeezecenter/files/pkg-install.in @@ -1,5 +1,5 @@ #!/bin/sh -# $FreeBSD: /tmp/pcvs/ports/audio/squeezecenter/files/Attic/pkg-install.in,v 1.4 2008-04-02 17:30:27 brooks Exp $ +# $FreeBSD: /tmp/pcvs/ports/audio/squeezecenter/files/Attic/pkg-install.in,v 1.5 2008-04-04 15:48:14 brooks Exp $ name=slimserver u=%%SLIMUSER%% @@ -15,9 +15,11 @@ conffile=${statedir}/squeezecenter.conf playlistdir=${statedir}/playlists pidfile=/var/run/${name}.pid newsyslogfile=/etc/newsyslog.conf -logfile=/var/log/squeezecenter.log logcomment="# added by audio/squeezecenter port" -logline="${logfile} ${u}:${g} 644 3 100 * J ${pidfile}" +serverlogfile=/var/log/squeezecenter/server.log +scannerlogfile=/var/log/squeezecenter/scanner.log +serverlogline="${serverlogfile} ${u}:${g} 644 3 100 * J ${pidfile}" +scannerlogline="${scannerlogfile} ${u}:${g} 644 3 100 * J ${pidfile}" case $2 in PRE-INSTALL) @@ -44,27 +46,13 @@ PRE-INSTALL) fi ;; POST-INSTALL) - if [ -d ${statedir} ]; then - chown -R ${u}:${g} ${statedir} - fi - if [ -d ${cachedir} ]; then - chown -R ${u}:${g} ${cachedir} - fi - if [ -d ${playlistdir} ]; then - chown -R ${u}:${g} ${playlistdir} - fi - if [ -f ${conffile} ]; then - chown ${u}:${g} ${conffile} - fi - if [ -f ${logfile} ]; then - chown ${u}:${g} ${logfile} - fi - if egrep -q "^${logfile}\>" ${newsyslogfile}; then + if egrep -q "^${serverlogfile}\>" ${newsyslogfile}; then echo "Using existing ${newsyslogfile} entry." else echo "Adding squeezecenter log entry to ${newsyslogfile}." echo "$logcomment" >> ${newsyslogfile} - echo "$logline" >> ${newsyslogfile} + echo "$serverlogline" >> ${newsyslogfile} + echo "$scannerlogline" >> ${newsyslogfile} fi for file in %%CONFFILES%%; do path="${slimdir}/${file}" diff --git a/audio/squeezecenter/files/squeezecenter.sh.in b/audio/squeezecenter/files/squeezecenter.sh.in index 21ae9822438b..9b4a6f2687dc 100644 --- a/audio/squeezecenter/files/squeezecenter.sh.in +++ b/audio/squeezecenter/files/squeezecenter.sh.in @@ -17,12 +17,13 @@ name=squeezecenter start_precmd="squeezecenter_start_precmd" +stop_postcmd="squeezecenter_stop_postcmd" rcvar=`set_rcvar` command=%%PREFIX%%/%%SLIMDIR%%/slimserver.pl command_interpreter=%%PERL%% -pidfile=/var/run/${name}.pid -logfile=/var/log/squeezecenter.log +pidfile=/var/run/${name}/${name}.pid +logdir=/var/log/squeezecenter statedir=%%SLIMDBDIR%% cachedir=${statedir}/cache prefsdir=${statedir}/prefs @@ -30,33 +31,41 @@ playlistdir=${statedir}/playlists conffile=${statedir}/squeezecenter.conf u=%%SLIMUSER%% g=%%SLIMGROUP%% -command_args="--daemon --prefsfile=${conffile} --logfile=${logfile} --user=${u} --group=${g} --pidfile=${pidfile}" +command_args="--daemon --prefsfile=${conffile} --pidfile=${pidfile}" +squeezecenter_user=${u} +squeezecenter_group=${g} squeezecenter_start_precmd() { - if [ ! -d ${statedir} ]; then - mkdir -p ${statedir} - chown -R ${u}:${g} ${statedir} - fi - if [ ! -d ${cachedir} ]; then - mkdir -p ${cachedir} - chown -R ${u}:${g} ${cachedir} - fi - if [ ! -d ${prefsdir} ]; then - mkdir -p ${prefsdir} - chown -R ${u}:${g} ${prefsdir} - fi - if [ ! -d ${playlistdir} ]; then - mkdir -p ${playlistdir} - chown -R ${u}:${g} ${playlistdir} - fi - if [ ! -f ${conffile} ]; then - touch ${conffile} - chown ${u}:${g} ${conffile} - fi + mkdir -p /var/run/${name} + chown -R ${u}:${g} /var/run/${name} + + mkdir -p ${logdir} + chown -R ${u}:${g} ${logdir} + + mkdir -p ${statedir} + mkdir -p ${cachedir} + mkdir -p ${prefsdir} + mkdir -p ${playlistdir} + touch ${conffile} + chown -R ${u}:${g} ${statedir} + if [ ! -f ${logfile} ]; then touch ${logfile} chown ${u}:${g} ${logfile} + fi +} + +squeezecenter_stop_postcmd() +{ + pids=`pgrep -u $u` + if [ -n "${pids}" ]; then + sleep 1 + kill $pids > /dev/null 2>&1 + fi + pids=`pgrep -u $u` + if [ -n "${pids}" ]; then + wait_for_pids $pids fi } |