Date: Sun, 29 May 2005 17:55:47 +0400 (MSD) From: Denis Shaposhnikov <dsh@vlink.ru> To: FreeBSD-gnats-submit@freebsd.org Cc: dsh@vlink.ru, ports@freebsd.org Subject: port fix: rc.subr'ize irc/ircd-ru Message-ID: <200505291355.j4TDtlOo059897@neva.vlink.ru>
next in thread | raw e-mail | index | archive | help
>Submitter-Id: current-users >Originator: Denis Shaposhnikov >Organization: >Confidential: no >Synopsis: port fix: rc.subr'ize irc/ircd-ru >Severity: non-critical >Priority: medium >Category: ports >Class: change-request >Release: FreeBSD 6.0-CURRENT i386 >Environment: System: FreeBSD neva.vlink.ru 6.0-CURRENT FreeBSD 6.0-CURRENT #15: Sun May 15 21:04:21 MSD 2005 dsh@neva.vlink.ru:/var/FreeBSD/obj/var/FreeBSD/src/sys/NEVA i386 >Description: Make startup script of ircd use rc.subr subsystem. >How-To-Repeat: >Fix: diff -Nru ircd-ru.orig/Makefile ircd-ru/Makefile --- ircd-ru.orig/Makefile Sun May 29 16:56:41 2005 +++ ircd-ru/Makefile Sun May 29 17:42:40 2005 @@ -18,7 +18,8 @@ USE_BZIP2= yes GNU_CONFIGURE= yes USE_REINPLACE= yes -PKGMESSAGE= ${WRKSRC}/pkg-message +SUB_FILES= pkg-message +USE_RC_SUBR= ircd.sh VARDIR= /var PLIST_SUB= VARDIR=${VARDIR} @@ -94,12 +95,7 @@ @${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL post-install: - @${INSTALL_SCRIPT} -m 555 ${FILESDIR}/ircd.sh.sample ${PREFIX}/etc/rc.d - @${CHOWN} -R ircd:ircd ${PREFIX}/etc/ircd-ru ${DATADIR} ${VARDIR}/log/ircd-ru ${VARDIR}/run/ircd-ru -.if !defined(NOPORTDOCS) - @${CHOWN} -R ircd:ircd ${DOCSDIR} -.endif - @${SED} -e 's|%%PREFIX%%|${PREFIX}|g' pkg-message > ${PKGMESSAGE} + @${CHOWN} -R ircd:ircd ${VARDIR}/log/ircd-ru @${CAT} ${PKGMESSAGE} .include <bsd.port.post.mk> diff -Nru ircd-ru.orig/files/ircd.sh.in ircd-ru/files/ircd.sh.in --- ircd-ru.orig/files/ircd.sh.in Thu Jan 1 03:00:00 1970 +++ ircd-ru/files/ircd.sh.in Sun May 29 17:27:01 2005 @@ -0,0 +1,32 @@ +#! /bin/sh + +# +# PROVIDE: ircd +# +# Add the fellowing line to /etc/rc.conf to enable ircd: +# +# ircd_enable="YES" +# + +. "%%RC_SUBR%%" + +name=ircd +rcvar=`set_rcvar` + +command=/usr/local/sbin/ircd + +ircd_pidfile="/var/run/ircd-ru/ircd.pid" +ircd_required_files="/usr/local/etc/ircd-ru/ircd.conf /usr/local/etc/ircd-ru/ircd.motd /usr/local/etc/ircd-ru/ircd.smotd" +ircd_user="ircd" + +pidfile=${ircd_pidfile} +required_files=${ircd_required_files} + +ircd_precmd () { + /usr/bin/install -d -o ircd -g ircd /var/run/ircd-ru + eval `/usr/bin/limits -U ${ircd_user} -e` +} +start_precmd="ircd_precmd" + +load_rc_config ${name} +run_rc_command "$1" diff -Nru ircd-ru.orig/files/ircd.sh.sample ircd-ru/files/ircd.sh.sample --- ircd-ru.orig/files/ircd.sh.sample Sun May 29 16:56:41 2005 +++ ircd-ru/files/ircd.sh.sample Thu Jan 1 03:00:00 1970 @@ -1,23 +0,0 @@ -#!/bin/sh - -PREFIX=$(expr $0 : "\(/.*/\)etc/rc\.d/$(basename $0)\$") - -IRCD=${PREFIX}sbin/ircd - -case "$1" in -start) - if [ -x $IRCD ]; then - $IRCD -u ircd -g ircd >/dev/null 2>&1 - echo -n ' ircd' - fi - ;; -stop) - kill `cat /var/run/ircd-ru/ircd.pid` >/dev/null 2>&1 - echo -n ' ircd' - ;; -*) - echo "Usage: `basename $0` {start|stop}" >&2 - ;; -esac - -exit 0 diff -Nru ircd-ru.orig/files/pkg-message.in ircd-ru/files/pkg-message.in --- ircd-ru.orig/files/pkg-message.in Thu Jan 1 03:00:00 1970 +++ ircd-ru/files/pkg-message.in Sun May 29 17:36:23 2005 @@ -0,0 +1,16 @@ + +---------------------------------------------------- + +ircd-RU has now been installed. + +This port create user ircd and group ircd + +You should now edit %%PREFIX%%/ircd-RU/etc/ircd.conf + to suit your needs. + (cp ircd.conf-dist ircd.conf; vi ircd.conf) + +You may then start the server by running: + echo "ircd_enable=\"YES\"" >> /etc/rc.conf + %%PREFIX%%/etc/rc.d/ircd.sh start + +---------------------------------------------------- diff -Nru ircd-ru.orig/pkg-message ircd-ru/pkg-message --- ircd-ru.orig/pkg-message Sun May 29 16:56:41 2005 +++ ircd-ru/pkg-message Thu Jan 1 03:00:00 1970 @@ -1,17 +0,0 @@ - ----------------------------------------------------- - -ircd-RU has now been installed. - -This port create user ircd and group ircd - -You should now edit %%PREFIX%%/ircd-RU/etc/ircd.conf - to suit your needs. - (cp ircd.conf-dist ircd.conf; vi ircd.conf) - -You may then start the server by running: - cd %%PREFIX%%/etc/rc.d/ - mv ircd.sh.sample ircd.sh - %%PREFIX%%/etc/rc.d/ircd.sh start - ----------------------------------------------------- diff -Nru ircd-ru.orig/pkg-plist ircd-ru/pkg-plist --- ircd-ru.orig/pkg-plist Sun May 29 16:56:41 2005 +++ ircd-ru/pkg-plist Sun May 29 17:32:16 2005 @@ -7,7 +7,6 @@ etc/ircd-ru/ru_RU.CP1251/ircd.motd-dist etc/ircd-ru/ru_RU.CP1251/ircd.smotd-dist etc/ircd-ru/ru_RU.KOI8-R/ircd.conf-dist -etc/rc.d/ircd.sh.sample %%PORTDOCS%%%%DOCSDIR%%/README.Ilines %%PORTDOCS%%%%DOCSDIR%%/opers.txt %%PORTDOCS%%%%DOCSDIR%%/ru_RU.KOI8-R/FAQ @@ -27,8 +26,5 @@ %%PORTDOCS%%@dirrm %%DOCSDIR%% @exec mkdir -m 755 %%VARDIR%%/log/ircd-ru @exec chown ircd:ircd %%VARDIR%%/log/ircd-ru -@exec mkdir -m 755 %%VARDIR%%/run/ircd-ru -@exec chown ircd:ircd %%VARDIR%%/run/ircd-ru -@unexec rm -R %%VARDIR%%/run/ircd-ru 2>&1 >/dev/null || true @unexec rm -R %%VARDIR%%/log/ircd-ru 2>&1 >/dev/null || true @unexec (rmdir %D/etc/ircd-ru && pw user del ircd) || echo 'To completely remove this port delete user ircd, group ircd and remove etc/ircd-ru'
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200505291355.j4TDtlOo059897>