aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils/usermin
diff options
context:
space:
mode:
authorolgeni <olgeni@FreeBSD.org>2004-06-20 04:58:44 +0800
committerolgeni <olgeni@FreeBSD.org>2004-06-20 04:58:44 +0800
commit8a0504034ec136face71c616b4e38921f6acec26 (patch)
tree4938d622620eddbc954fab447f6eef4b88f9d911 /sysutils/usermin
parent75630b6d3d548cc4b71421e4d5434a4e9395412f (diff)
downloadfreebsd-ports-gnome-8a0504034ec136face71c616b4e38921f6acec26.tar.gz
freebsd-ports-gnome-8a0504034ec136face71c616b4e38921f6acec26.tar.zst
freebsd-ports-gnome-8a0504034ec136face71c616b4e38921f6acec26.zip
Use rc.subr.
Diffstat (limited to 'sysutils/usermin')
-rw-r--r--sysutils/usermin/Makefile47
-rw-r--r--sysutils/usermin/files/patch-setup.sh20
-rw-r--r--sysutils/usermin/files/usermin.sh.in43
-rw-r--r--sysutils/usermin/files/usermin.sh.sample43
-rw-r--r--sysutils/usermin/pkg-message4
-rw-r--r--sysutils/usermin/pkg-plist9
-rw-r--r--sysutils/usermin/scripts/pre-configure15
7 files changed, 88 insertions, 93 deletions
diff --git a/sysutils/usermin/Makefile b/sysutils/usermin/Makefile
index ae72de91f4ba..a02493a5ae8f 100644
--- a/sysutils/usermin/Makefile
+++ b/sysutils/usermin/Makefile
@@ -7,7 +7,7 @@
PORTNAME= usermin
PORTVERSION= 1.080
-PORTREVISION= 1
+PORTREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= http://www.webmin.com/uupdates/ \
${MASTER_SITE_SOURCEFORGE}
@@ -23,7 +23,8 @@ RUN_DEPENDS= ${SITE_PERL}/${PERL_ARCH}/Net/SSLeay.pm:${PORTSDIR}/security/p5-Net
NO_BUILD= yes
USE_PERL5= yes
-SCRIPTS_ENV+= WRKDIR="${WRKDIR}"
+USE_RC_SUBR= yes
+USE_REINPLACE= yes
USERMIN_MODULES=quota-1.080-1.wbm.gz
@@ -36,27 +37,33 @@ post-extract:
${TAR} --unlink -xzf ${DISTDIR}/$${usermin_module} -C ${WRKSRC}; \
done; \
fi
- @${FIND} ${WRKSRC} -name "*.orig" -or -name "*.bak" | ${XARGS} ${RM}
+
+post-patch:
+ @${REINPLACE_CMD} -e "s=%%PREFIX%%=${PREFIX}=" ${WRKSRC}/setup.sh
+ @${FIND} ${WRKSRC} -name "*.cgi" -print \
+ | ${XARGS} ${REINPLACE_CMD} -e "s@/usr/local/bin/perl@${PERL}@"
+ @${FIND} ${WRKSRC} -name "*.orig" -print | ${XARGS} ${RM}
+ @${FIND} ${WRKSRC} -name "*.bak" -print | ${XARGS} ${RM}
+# we may have 2 levels of empty directories which cause the plist generation
+# system to fail
+ @${FIND} ${WRKSRC} -type d -empty -print | ${XARGS} ${RMDIR}
+ @${FIND} ${WRKSRC} -type d -empty -print | ${XARGS} ${RMDIR}
do-install:
@${MKDIR} ${PREFIX}/lib/usermin
@${CP} -r ${WRKSRC}/* ${PREFIX}/lib/usermin
-# we may have 2 levels of empty directories which cause the plist generation
-# system to fail
- @cd ${PREFIX}/lib/usermin && ${FIND} . -type d -empty -print \
- | ${XARGS} ${RMDIR}
- @cd ${PREFIX}/lib/usermin && ${FIND} . -type d -empty -print \
- | ${XARGS} ${RMDIR}
- @${CP} ${WRKDIR}/usermin.sh ${PREFIX}/etc/rc.d/usermin.sh-dist
- @${CHMOD} 554 ${PREFIX}/etc/rc.d/usermin.sh-dist
+ @${SED} -e "s=%%RC_SUBR%%=${RC_SUBR}=" \
+ -e "s=%%PREFIX%%=${PREFIX}=" \
+ -e "s=%%PERL5%%=${PERL}=" \
+ < ${FILESDIR}/usermin.sh.sample > ${PREFIX}/etc/rc.d/usermin.sh
+ @${CHMOD} 555 ${PREFIX}/etc/rc.d/usermin.sh
post-install:
- @cd ${PREFIX} ; ${FIND} lib/usermin -type f -o -type l | ${SORT} \
- > ${WRKDIR}/PLIST.lib-usermin
- @cd ${PREFIX} ; ${FIND} lib/usermin -type d | ${SORT} -r \
- | ${SED} -e 's/^/@dirrm /g' \
- >> ${WRKDIR}/PLIST.lib-usermin
-
+ @cd ${WRKSRC} ; ${FIND} * -type f -o -type l | ${SORT} | ${AWK} \
+ '{ print "lib/usermin/" $$1 }' > ${WRKDIR}/PLIST.lib-usermin
+ @cd ${WRKSRC} ; ${FIND} * -type d | ${SORT} -r | ${AWK} \
+ '{ print "lib/usermin/" $$1 }' | ${SED} -e 's/^/@dirrm /g' \
+ >> ${WRKDIR}/PLIST.lib-webmin
@${ECHO_CMD} "r ${TMPPLIST}" > ${WRKDIR}/ex.script
@${ECHO_CMD} "/Insert PLIST.lib-usermin" >> ${WRKDIR}/ex.script
@${ECHO_CMD} "d" >> ${WRKDIR}/ex.script
@@ -64,12 +71,6 @@ post-install:
@${ECHO_CMD} "x!" >> ${WRKDIR}/ex.script
@${CP} -p ${TMPPLIST} ${TMPPLIST}.pre-lib-usermin
@cd ${WRKDIR} ; ex < ex.script
-# stop usermin if configured and enabled at startup
- @[ -n "${BATCH}" ] || ([ ! -d ${PREFIX}/etc/usermin ] || [ ! -x ${PREFIX}/etc/rc.d/usermin.sh ] || ${PREFIX}/etc/rc.d/usermin.sh stop > /dev/null)
-# upgrade configuration if etc/usermin exists
- @[ ! -d ${PREFIX}/etc/usermin ] || ${ECHO_CMD} | nostart=Y ${PREFIX}/lib/usermin/setup.sh
-# run interactive setup if not in BATCH mode and no configuration exists
- @[ -n "${BATCH}" ] || ([ -d ${PREFIX}/etc/usermin ] || nostart=Y ${PREFIX}/lib/usermin/setup.sh)
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>
diff --git a/sysutils/usermin/files/patch-setup.sh b/sysutils/usermin/files/patch-setup.sh
index c0f683ed6a10..4616de21cc68 100644
--- a/sysutils/usermin/files/patch-setup.sh
+++ b/sysutils/usermin/files/patch-setup.sh
@@ -1,20 +1,20 @@
$FreeBSD$
---- setup.sh.orig Sat Jan 31 10:52:05 2004
-+++ setup.sh Sat Jan 31 10:55:35 2004
+--- setup.sh.orig Fri Jun 4 01:18:07 2004
++++ setup.sh Sat Jun 19 21:59:35 2004
@@ -84,12 +84,12 @@
echo "Unless you want to run multiple versions of Usermin at the same time"
echo "you can just accept the defaults."
echo ""
-printf "Config file directory [/etc/usermin]: "
-+printf "Config file directory [!!PREFIX!!/etc/usermin]: "
++printf "Config file directory [%%PREFIX%%/etc/usermin]: "
if [ "$config_dir" = "" ]; then
read config_dir
fi
if [ "$config_dir" = "" ]; then
- config_dir=/etc/usermin
-+ config_dir=!!PREFIX!!/etc/usermin
++ config_dir=%%PREFIX%%/etc/usermin
fi
abspath=`echo $config_dir | grep "^/"`
if [ "$abspath" = "" ]; then
@@ -38,9 +38,17 @@ $FreeBSD$
echo "Perl 5 interpreter on your system."
echo ""
- if [ -x /usr/bin/perl ]; then
-+ if [ -x !!PERL!! ]; then
-+ perldef=!!PERL!!
++ if [ -x %%PERL%% ]; then
++ perldef=%%PERL%%
+ elif [ -x /usr/bin/perl ]; then
perldef=/usr/bin/perl
elif [ -x /usr/local/bin/perl ]; then
perldef=/usr/local/bin/perl
+@@ -465,7 +467,6 @@
+ echo "Creating start and stop scripts.."
+ rm -f $config_dir/stop $config_dir/start
+ echo "#!/bin/sh" >>$config_dir/start
+-echo "echo Starting Usermin server in $wadir" >>$config_dir/start
+ echo "trap '' 1" >>$config_dir/start
+ echo "LANG=" >>$config_dir/start
+ echo "export LANG" >>$config_dir/start
diff --git a/sysutils/usermin/files/usermin.sh.in b/sysutils/usermin/files/usermin.sh.in
index bf7ec974a489..4aadd72b5513 100644
--- a/sysutils/usermin/files/usermin.sh.in
+++ b/sysutils/usermin/files/usermin.sh.in
@@ -1,27 +1,28 @@
#!/bin/sh
-
+#
# $FreeBSD$
+#
+# PROVIDE: usermin
+# REQUIRE: LOGIN
+# KEYWORD: FreeBSD
+#
+# Add the following line to /etc/rc.conf to enable usermin:
+#
+# usermin_enable="YES"
+#
+
+usermin_enable="NO"
-case $1 in
+. %%RC_SUBR%%
- start)
- if [ -x !!PREFIX!!/etc/usermin/start ]; then
- !!PREFIX!!/etc/usermin/start >/dev/null
- echo -n ' usermin'
- fi
- exit 0
- ;;
+name=usermin
+rcvar=`set_rcvar`
- stop)
- if [ -x !!PREFIX!!/etc/usermin/stop ]; then
- !!PREFIX!!/etc/usermin/stop >/dev/null
- echo -n ' usermin'
- fi
- exit 0
- ;;
+prefix=%%PREFIX%%
+procname=%%PERL5%%
+pidfile=/var/log/usermin/miniserv.pid
+required_dirs=${prefix}/etc/usermin
+command=${prefix}/etc/usermin/start
- *)
- echo "usage: `basename $0` {start|stop}" >&2
- exit 64
- ;;
-esac
+load_rc_config ${name}
+run_rc_command "$1"
diff --git a/sysutils/usermin/files/usermin.sh.sample b/sysutils/usermin/files/usermin.sh.sample
index bf7ec974a489..4aadd72b5513 100644
--- a/sysutils/usermin/files/usermin.sh.sample
+++ b/sysutils/usermin/files/usermin.sh.sample
@@ -1,27 +1,28 @@
#!/bin/sh
-
+#
# $FreeBSD$
+#
+# PROVIDE: usermin
+# REQUIRE: LOGIN
+# KEYWORD: FreeBSD
+#
+# Add the following line to /etc/rc.conf to enable usermin:
+#
+# usermin_enable="YES"
+#
+
+usermin_enable="NO"
-case $1 in
+. %%RC_SUBR%%
- start)
- if [ -x !!PREFIX!!/etc/usermin/start ]; then
- !!PREFIX!!/etc/usermin/start >/dev/null
- echo -n ' usermin'
- fi
- exit 0
- ;;
+name=usermin
+rcvar=`set_rcvar`
- stop)
- if [ -x !!PREFIX!!/etc/usermin/stop ]; then
- !!PREFIX!!/etc/usermin/stop >/dev/null
- echo -n ' usermin'
- fi
- exit 0
- ;;
+prefix=%%PREFIX%%
+procname=%%PERL5%%
+pidfile=/var/log/usermin/miniserv.pid
+required_dirs=${prefix}/etc/usermin
+command=${prefix}/etc/usermin/start
- *)
- echo "usage: `basename $0` {start|stop}" >&2
- exit 64
- ;;
-esac
+load_rc_config ${name}
+run_rc_command "$1"
diff --git a/sysutils/usermin/pkg-message b/sysutils/usermin/pkg-message
index 144aee9a469f..5be45c6778fe 100644
--- a/sysutils/usermin/pkg-message
+++ b/sysutils/usermin/pkg-message
@@ -8,4 +8,8 @@ run the following command as root:
You won't have to perform this step
after every usermin upgrade.
+Since 1.080_2, to run usermin from
+startup, add usermin_enable="YES"
+in your /etc/rc.conf.
+
===================================
diff --git a/sysutils/usermin/pkg-plist b/sysutils/usermin/pkg-plist
index b7617cde8aa1..ba3e895d607d 100644
--- a/sysutils/usermin/pkg-plist
+++ b/sysutils/usermin/pkg-plist
@@ -1,10 +1,5 @@
-@comment stop service at deinstall time
-@unexec [ -n "$BATCH" ] || ([ ! -d %D/etc/usermin ] || [ ! -x %D/etc/rc.d/usermin.sh ] || %D/etc/rc.d/usermin.sh stop >/dev/null )
-etc/rc.d/usermin.sh-dist
+etc/rc.d/usermin.sh
@comment Insert PLIST.lib-usermin here
@comment -=[ begin PLIST.lib-usermin ]=-
@comment -=[ end PLIST.lib-usermin ]=-
-@comment upgrade configuration if etc/usermin exists
-@exec [ ! -d %D/etc/usermin ] || echo | nostart=Y %D/lib/usermin/setup.sh
-@comment run interactive setup if not in BATCH mode and no configuration exists
-@exec [ -n "$BATCH" ] || ([ -d %D/etc/usermin ] || nostart=Y %D/lib/usermin/setup.sh)
+@dirrm lib/usermin
diff --git a/sysutils/usermin/scripts/pre-configure b/sysutils/usermin/scripts/pre-configure
deleted file mode 100644
index 98f61a99440a..000000000000
--- a/sysutils/usermin/scripts/pre-configure
+++ /dev/null
@@ -1,15 +0,0 @@
-#! /bin/sh
-
-perl -pi -e "s=!!PREFIX!!=$PREFIX=" ${WRKSRC}/setup.sh
-
-if [ -x /usr/bin/perl5 ]; then
- PERL5=/usr/bin/perl
-elif [ -x $PREFIX/bin/perl ]; then
- PERL5=$PREFIX/bin/perl
-fi
-
-perl -pi -e "s=!!PERL5!!=$PERL5=" ${WRKSRC}/setup.sh
-
-sed -e "s=!!PREFIX!!=$PREFIX=" < ${FILESDIR}/usermin.sh.sample > ${WRKDIR}/usermin.sh
-
-exit 0