aboutsummaryrefslogtreecommitdiff
path: root/misc
diff options
context:
space:
mode:
authorTim Bishop <tdb@FreeBSD.org>2006-01-09 10:30:35 +0000
committerTim Bishop <tdb@FreeBSD.org>2006-01-09 10:30:35 +0000
commit3369145c11ef8ca3814e90dc61cd38ca8532ff5c (patch)
tree99bed8837bd9447092263019fdbc4a8d239b1e2a /misc
parent2e13905eeadc5ee43b1971c63e452583432702bf (diff)
downloadports-3369145c11ef8ca3814e90dc61cd38ca8532ff5c.tar.gz
ports-3369145c11ef8ca3814e90dc61cd38ca8532ff5c.zip
Notes
Diffstat (limited to 'misc')
-rw-r--r--misc/dnetc/Makefile27
-rw-r--r--misc/dnetc/files/dnetc.sh66
-rw-r--r--misc/dnetc/files/dnetc.sh.in76
-rw-r--r--misc/dnetc/files/pkg-deinstall.in (renamed from misc/dnetc/pkg-deinstall)20
-rw-r--r--misc/dnetc/files/pkg-install.in35
-rw-r--r--misc/dnetc/files/pkg-message.in (renamed from misc/dnetc/pkg-message)0
-rw-r--r--misc/dnetc/pkg-install32
-rw-r--r--misc/dnetc/pkg-plist1
8 files changed, 131 insertions, 126 deletions
diff --git a/misc/dnetc/Makefile b/misc/dnetc/Makefile
index 893df8a0dd4d..75ce4734f61d 100644
--- a/misc/dnetc/Makefile
+++ b/misc/dnetc/Makefile
@@ -7,7 +7,7 @@
PORTNAME= dnetc
PORTVERSION= ${VERSION}
-PORTREVISION= 1
+PORTREVISION= 2
PORTEPOCH= 1
CATEGORIES= misc
MASTER_SITES= ftp://ftp.distributed.net/pub/dcti/%SUBDIR%/ \
@@ -25,7 +25,7 @@ MD5_FILE= ${MASTERDIR}/distinfo.${ARCH}
ONLY_FOR_ARCHS= i386 alpha sparc64 amd64
-USE_RC_SUBR= yes
+USE_RC_SUBR= dnetc.sh
NO_BUILD= yes
BINDIR= ${PREFIX}/distributed.net
@@ -34,14 +34,18 @@ CLIENTUSER= dnetc
CLIENTGROUP= ${CLIENTUSER}
CLIENTUID= 105
-BINMODE= 700
-
PKGINSTALL= ${WRKDIR}/pkg-install
PKGDEINSTALL= ${WRKDIR}/pkg-deinstall
PKGMESSAGE= ${WRKDIR}/pkg-message
MAN1= dnetc.1
+SUB_FILES= pkg-install pkg-deinstall pkg-message
+SUB_LIST= BINDIR="${BINDIR}" \
+ CLIENTUSER="${CLIENTUSER}" \
+ CLIENTGROUP="${CLIENTGROUP}" \
+ CLIENTUID="${CLIENTUID}"
+
.include <bsd.port.pre.mk>
.if ${ARCH} == sparc64 || ${ARCH} == alpha
@@ -61,17 +65,6 @@ MASTER_SITE_SUBDIR= prerelease/rc
DISTNAME= dnetc${PORTVERSION:E}-freebsd5-${ARCH:S/i386/x86/}-elf
.endif
-post-extract:
- @${SED} -e 's#%%CLIENTUSER%%#${CLIENTUSER}#g' -e 's#%%CLIENTGROUP%%#${CLIENTGROUP}#' \
- -e 's#%%CLIENTUID%%#${CLIENTUID}#g' ${MASTERDIR}/pkg-install > ${PKGINSTALL}
- @${SED} -e 's#%%CLIENTUSER%%#${CLIENTUSER}#g' -e 's#%%CLIENTGROUP%%#${CLIENTGROUP}#' \
- ${MASTERDIR}/pkg-deinstall > ${PKGDEINSTALL}
- @${SED} -e 's#%%BINDIR%%#${BINDIR}#' ${MASTERDIR}/pkg-message > ${PKGMESSAGE}
- @${SED} -e 's#%%BINDIR%%#${BINDIR}#' \
- -e 's#%%CLIENTUSER%%#${CLIENTUSER}#g' \
- -e 's#%%RC_SUBR%%#${RC_SUBR}#g' \
- ${FILESDIR}/dnetc.sh > ${WRKDIR}/dnetc.sh
-
do-configure:
@if [ ! -f ${PREFIX}/dnetc.ini ]; then \
${INSTALL} -c -m 644 ${FILESDIR}/dnetc.ini ${WRKSRC}; \
@@ -88,12 +81,10 @@ do-install:
${CHOWN} ${CLIENTUSER}:${CLIENTGROUP} ${BINDIR}
${CHMOD} 775 ${BINDIR}
- ${INSTALL} -c -m ${BINMODE} -o ${CLIENTUSER} -g ${CLIENTGROUP} ${WRKSRC}/dnetc ${BINDIR}
+ ${INSTALL} -c -m 755 -o ${CLIENTUSER} -g ${CLIENTGROUP} ${WRKSRC}/dnetc ${BINDIR}
${INSTALL_MAN} ${WRKSRC}/${MAN1} ${PREFIX}/man/man1
- ${INSTALL_SCRIPT} ${WRKDIR}/dnetc.sh ${PREFIX}/etc/rc.d/dnetc.sh
-
${INSTALL} -c -m 644 -o ${CLIENTUSER} -g ${CLIENTGROUP} ${WRKSRC}/dnetc.ini ${BINDIR}/dnetc.ini.sample
.if !exists(${BINDIR}/dnetc.ini)
${INSTALL} -c -m 644 -o ${CLIENTUSER} -g ${CLIENTGROUP} ${WRKSRC}/dnetc.ini ${BINDIR}/dnetc.ini
diff --git a/misc/dnetc/files/dnetc.sh b/misc/dnetc/files/dnetc.sh
deleted file mode 100644
index 6410450af7f6..000000000000
--- a/misc/dnetc/files/dnetc.sh
+++ /dev/null
@@ -1,66 +0,0 @@
-#!/bin/sh
-#
-# $FreeBSD$
-#
-# PROVIDE: dnetc
-# REQUIRE: LOGIN
-# KEYWORD: FreeBSD shutdown
-
-dnetc_enable=${dnetc_enable:-"NO"}
-
-dir="%%BINDIR%%"
-user="%%CLIENTUSER%%"
-
-. %%RC_SUBR%%
-
-name="dnetc"
-rcvar=`set_rcvar`
-
-required_files=${dir}/${name}.ini
-
-start_cmd="${name}_start"
-stop_cmd="${name}_stop"
-
-extra_commands="flush fetch update"
-
-flush_cmd="${name}_flush"
-fetch_cmd="${name}_fetch"
-update_cmd="${name}_update"
-
-dnetc_start()
-{
- if ps -U${user} >/dev/null; then
- echo "${name} already running?"
- else
- su -m ${user} -c "${dir}/${name} -quiet" >/dev/null 2>&1
- echo -n " ${name}"
- fi
-}
-
-dnetc_stop()
-{
- if ps -U${user} >/dev/null; then
- su -m ${user} -c "${dir}/${name} -shutdown" >/dev/null 2>&1
- echo -n " ${name}"
- else
- echo "${name} not running?"
- fi
-}
-
-dnetc_flush()
-{
- su -m ${user} -c "${dir}/${name} -flush" >/dev/null 2>&1
-}
-
-dnetc_fetch()
-{
- su -m ${user} -c "${dir}/${name} -fetch" >/dev/null 2>&1
-}
-
-dnetc_update()
-{
- su -m ${user} -c "${dir}/${name} -update" >/dev/null 2>&1
-}
-
-load_rc_config $name
-run_rc_command "$1"
diff --git a/misc/dnetc/files/dnetc.sh.in b/misc/dnetc/files/dnetc.sh.in
new file mode 100644
index 000000000000..cc3e4faf498c
--- /dev/null
+++ b/misc/dnetc/files/dnetc.sh.in
@@ -0,0 +1,76 @@
+#!/bin/sh
+#
+# $FreeBSD$
+#
+# PROVIDE: dnetc
+# REQUIRE: LOGIN
+# KEYWORD: FreeBSD shutdown
+
+#
+# Add the following lines to /etc/rc.conf to enable dnetc:
+# dnetc_enable (bool): Set to "NO" by default.
+# Set to "YES" to enable dnetc.
+# dnetc_dir (path): Set to "%%BINDIR%%" by default.
+# dnetc_user (user): Set to "%%CLIENTUSER%%" by default.
+#
+
+. %%RC_SUBR%%
+
+name="dnetc"
+rcvar=`set_rcvar`
+
+load_rc_config $name
+
+: ${dnetc_enable="NO"}
+: ${dnetc_dir="%%BINDIR%%"}
+: ${dnetc_user="%%CLIENTUSER%%"}
+
+required_files=${dnetc_dir}/${name}.ini
+
+start_cmd="${name}_start"
+stop_cmd="${name}_stop"
+
+extra_commands="flush fetch update"
+
+flush_cmd="${name}_flush"
+fetch_cmd="${name}_fetch"
+update_cmd="${name}_update"
+
+dnetc_start()
+{
+ if ps -x -o ucomm -U${dnetc_user} | grep ${name} >/dev/null; then
+ echo "${name} already running?"
+ else
+ su -m ${dnetc_user} -c "${dnetc_dir}/${name} -quiet" >/dev/null 2>&1
+ echo -n " ${name}"
+ fi
+}
+
+dnetc_stop()
+{
+ if ps -x -o ucomm -U${dnetc_user} | grep ${name} >/dev/null; then
+ su -m ${dnetc_user} -c "${dnetc_dir}/${name} -shutdown" >/dev/null 2>&1
+ # wait for dnetc to stop
+ sleep 2
+ echo -n " ${name}"
+ else
+ echo "${name} not running?"
+ fi
+}
+
+dnetc_flush()
+{
+ su -m ${dnetc_user} -c "${dnetc_dir}/${name} -flush" >/dev/null 2>&1
+}
+
+dnetc_fetch()
+{
+ su -m ${dnetc_user} -c "${dnetc_dir}/${name} -fetch" >/dev/null 2>&1
+}
+
+dnetc_update()
+{
+ su -m ${dnetc_user} -c "${dnetc_dir}/${name} -update" >/dev/null 2>&1
+}
+
+run_rc_command "$1"
diff --git a/misc/dnetc/pkg-deinstall b/misc/dnetc/files/pkg-deinstall.in
index a575f5a38879..21e38513323c 100644
--- a/misc/dnetc/pkg-deinstall
+++ b/misc/dnetc/files/pkg-deinstall.in
@@ -1,4 +1,6 @@
#!/bin/sh
+#
+# $FreeBSD$
if [ "$2" != "POST-DEINSTALL" ]; then
exit 0
@@ -8,21 +10,21 @@ CLIENTUSER=%%CLIENTUSER%%
CLIENTGROUP=%%CLIENTGROUP%%
if /usr/sbin/pw usershow "$CLIENTUSER" 2>/dev/null 1>&2; then
- if /usr/sbin/pw userdel -n $CLIENTUSER; then
- echo "=> Removed user \"$CLIENTUSER\"."
- else
- echo "=> Removing user \"$CLIENTUSER\" failed..."
- exit 1
- fi
+ if /usr/sbin/pw userdel -n $CLIENTUSER; then
+ echo "=> Removed user \"$CLIENTUSER\"."
+ else
+ echo "=> Removing user \"$CLIENTUSER\" failed."
+ exit 1
+ fi
fi
if /usr/sbin/pw groupshow "$CLIENTGROUP" 2>/dev/null 1>&2; then
if /usr/sbin/pw groupdel -n $CLIENTGROUP; then
echo "=> Removed group \"$CLIENTGROUP\"."
else
- echo "=> Removing group \"$CLIENTGROUP\" failed..."
- exit 1
- fi
+ echo "=> Removing group \"$CLIENTGROUP\" failed."
+ exit 1
+ fi
fi
exit 0
diff --git a/misc/dnetc/files/pkg-install.in b/misc/dnetc/files/pkg-install.in
new file mode 100644
index 000000000000..f93546ef53b8
--- /dev/null
+++ b/misc/dnetc/files/pkg-install.in
@@ -0,0 +1,35 @@
+#!/bin/sh
+#
+# $FreeBSD$
+
+if [ "$2" != "PRE-INSTALL" ]; then
+ exit 0
+fi
+
+CLIENTUSER=%%CLIENTUSER%%
+CLIENTGROUP=%%CLIENTGROUP%%
+UID=%%CLIENTUID%%
+GID=$UID
+
+if ! /usr/sbin/pw groupshow "$CLIENTGROUP" 2>/dev/null 1>&2; then
+ if /usr/sbin/pw groupadd $CLIENTGROUP -g $GID; then
+ echo "=> Added group \"$CLIENTGROUP\"."
+ else
+ echo "=> Adding group \"$CLIENTGROUP\" failed."
+ exit 1
+ fi
+fi
+
+if ! /usr/sbin/pw usershow "$CLIENTUSER" 2>/dev/null 1>&2; then
+ if /usr/sbin/pw useradd $CLIENTUSER -u $UID -g $CLIENTGROUP -h - \
+ -s "/sbin/nologin" -d "/nonexistent" \
+ -c "distributed.net client and proxy pseudo-user"; \
+ then
+ echo "=> Added user \"$CLIENTUSER\"."
+ else
+ echo "=> Adding user \"$CLIENTUSER\" failed."
+ exit 1
+ fi
+fi
+
+exit 0
diff --git a/misc/dnetc/pkg-message b/misc/dnetc/files/pkg-message.in
index 220c11cf62e0..220c11cf62e0 100644
--- a/misc/dnetc/pkg-message
+++ b/misc/dnetc/files/pkg-message.in
diff --git a/misc/dnetc/pkg-install b/misc/dnetc/pkg-install
deleted file mode 100644
index 128ca7d87816..000000000000
--- a/misc/dnetc/pkg-install
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-
-if [ "$2" != "PRE-INSTALL" ]; then
- exit 0
-fi
-
-CLIENTUSER=%%CLIENTUSER%%
-CLIENTGROUP=%%CLIENTGROUP%%
-UID=%%CLIENTUID%%
-GID=$UID
-
-if ! /usr/sbin/pw groupshow "$CLIENTGROUP" 2>/dev/null 1>&2; then
- if /usr/sbin/pw groupadd $CLIENTGROUP -g $GID; then
- echo "=> Added group \"$CLIENTGROUP\"."
- else
- echo "=> Adding group \"$CLIENTGROUP\" failed..."
- exit 1
- fi
-fi
-
-if ! /usr/sbin/pw usershow "$CLIENTUSER" 2>/dev/null 1>&2; then
- if /usr/sbin/pw useradd $CLIENTUSER -u $UID -g $CLIENTGROUP -h - \
- -s "/sbin/nologin" -d "/nonexistent" \
- -c "distributed.net client pseudo-user"; \
- then
- echo "=> Added user \"$CLIENTUSER\"."
- else
- echo "=> Adding user \"$CLIENTUSER\" failed..."
- exit 1
- fi
-fi
-exit 0
diff --git a/misc/dnetc/pkg-plist b/misc/dnetc/pkg-plist
index 10ce552f3518..20e11382d2ab 100644
--- a/misc/dnetc/pkg-plist
+++ b/misc/dnetc/pkg-plist
@@ -2,5 +2,4 @@ distributed.net/dnetc
@unexec if cmp -s %D/distributed.net/dnetc.ini %D/distributed.net/dnetc.ini.sample; then rm -f %D/distributed.net/dnetc.ini; fi
distributed.net/dnetc.ini.sample
@exec [ -f %B/dnetc.ini ] || cp %B/%f %B/dnetc.ini
-etc/rc.d/dnetc.sh
@dirrm distributed.net