Use rc.subr.

This commit is contained in:
Jimmy Olgeni 2004-06-19 20:58:44 +00:00
parent 2998f14b5b
commit 16ebae5b9a
Notes: svn2git 2021-03-31 03:12:20 +00:00
svn path=/head/; revision=111831
15 changed files with 196 additions and 196 deletions

View file

@ -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>

View file

@ -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

View file

@ -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"
#
case $1 in
usermin_enable="NO"
start)
if [ -x !!PREFIX!!/etc/usermin/start ]; then
!!PREFIX!!/etc/usermin/start >/dev/null
echo -n ' usermin'
fi
exit 0
;;
. %%RC_SUBR%%
stop)
if [ -x !!PREFIX!!/etc/usermin/stop ]; then
!!PREFIX!!/etc/usermin/stop >/dev/null
echo -n ' usermin'
fi
exit 0
;;
name=usermin
rcvar=`set_rcvar`
*)
echo "usage: `basename $0` {start|stop}" >&2
exit 64
;;
esac
prefix=%%PREFIX%%
procname=%%PERL5%%
pidfile=/var/log/usermin/miniserv.pid
required_dirs=${prefix}/etc/usermin
command=${prefix}/etc/usermin/start
load_rc_config ${name}
run_rc_command "$1"

View file

@ -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"
#
case $1 in
usermin_enable="NO"
start)
if [ -x !!PREFIX!!/etc/usermin/start ]; then
!!PREFIX!!/etc/usermin/start >/dev/null
echo -n ' usermin'
fi
exit 0
;;
. %%RC_SUBR%%
stop)
if [ -x !!PREFIX!!/etc/usermin/stop ]; then
!!PREFIX!!/etc/usermin/stop >/dev/null
echo -n ' usermin'
fi
exit 0
;;
name=usermin
rcvar=`set_rcvar`
*)
echo "usage: `basename $0` {start|stop}" >&2
exit 64
;;
esac
prefix=%%PREFIX%%
procname=%%PERL5%%
pidfile=/var/log/usermin/miniserv.pid
required_dirs=${prefix}/etc/usermin
command=${prefix}/etc/usermin/start
load_rc_config ${name}
run_rc_command "$1"

View file

@ -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.
===================================

View file

@ -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

View file

@ -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

View file

@ -7,7 +7,7 @@
PORTNAME= webmin
PORTVERSION= 1.150
PORTREVISION= 1
PORTREVISION= 2
CATEGORIES= sysutils
MASTER_SITES= http://www.webmin.com/updates/ \
${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
WEBMIN_MODULES= fsdump-1.150-1.wbm.gz
@ -36,7 +37,6 @@ post-extract:
${TAR} --unlink -xzf ${DISTDIR}/$${webmin_module} -C ${WRKSRC}; \
done; \
fi
@${FIND} ${WRKSRC} -name "*.bak" | ${XARGS} ${RM}
post-patch:
@${CP} ${WRKDIR}/webmin-${PORTVERSION}/bind8/config-freebsd-3.0 \
@ -56,6 +56,9 @@ post-patch:
usermin/config
@${PERL} -pi -e "s|%%PREFIX%%|${PREFIX}|g" ${WRKSRC}/${file}
.endfor
@${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
@ -66,8 +69,11 @@ post-patch:
do-install:
@${MKDIR} ${PREFIX}/lib/webmin
@${CP} -r ${WRKSRC}/* ${PREFIX}/lib/webmin
@${CP} ${WRKDIR}/webmin.sh ${PREFIX}/etc/rc.d/webmin.sh-dist
@${CHMOD} 554 ${PREFIX}/etc/rc.d/webmin.sh-dist
@${SED} -e "s=%%RC_SUBR%%=${RC_SUBR}=" \
-e "s=%%PREFIX%%=${PREFIX}=" \
-e "s=%%PERL5%%=${PERL}=" \
< ${FILESDIR}/webmin.sh.sample > ${PREFIX}/etc/rc.d/webmin.sh
@${CHMOD} 555 ${PREFIX}/etc/rc.d/webmin.sh
post-install:
@cd ${WRKSRC} ; ${FIND} * -type f -o -type l | ${SORT} | ${AWK} \
@ -75,7 +81,6 @@ post-install:
@cd ${WRKSRC} ; ${FIND} * -type d | ${SORT} -r | ${AWK} \
'{ print "lib/webmin/" $$1 }' | ${SED} -e 's/^/@dirrm /g' \
>> ${WRKDIR}/PLIST.lib-webmin
@${ECHO_CMD} "r ${TMPPLIST}" > ${WRKDIR}/ex.script
@${ECHO_CMD} "/Insert PLIST.lib-webmin" >> ${WRKDIR}/ex.script
@${ECHO_CMD} "d" >> ${WRKDIR}/ex.script
@ -83,12 +88,6 @@ post-install:
@${ECHO_CMD} "x!" >> ${WRKDIR}/ex.script
@${CP} -p ${TMPPLIST} ${TMPPLIST}.pre-lib-webmin
@cd ${WRKDIR} ; ex < ex.script
# stop webmin if configured and enabled at startup
@[ -n "${BATCH}" ] || ([ ! -d ${PREFIX}/etc/webmin ] || [ ! -x ${PREFIX}/etc/rc.d/webmin.sh ] || ${PREFIX}/etc/rc.d/webmin.sh stop > /dev/null)
# upgrade configuration if etc/webmin exists
@[ ! -d ${PREFIX}/etc/webmin ] || ${ECHO_CMD} | nostart=Y ${PREFIX}/lib/webmin/setup.sh
# run interactive setup if not in BATCH mode and no configuration exists
@[ -n "${BATCH}" ] || ([ -d ${PREFIX}/etc/webmin ] || nostart=Y ${PREFIX}/lib/webmin/setup.sh)
@${CAT} ${PKGMESSAGE}
.include <bsd.port.mk>

View file

@ -1,23 +1,26 @@
--- setup.sh.orig Mon Dec 13 12:57:41 1999
+++ setup.sh Tue Dec 14 10:20:32 1999
@@ -33,12 +33,12 @@
$FreeBSD$
--- setup.sh.orig Fri Jun 4 01:15:55 2004
+++ setup.sh Sat Jun 19 19:24:25 2004
@@ -89,12 +89,12 @@
echo "Unless you want to run multiple versions of Webmin at the same time"
echo "you can just accept the defaults."
echo ""
-printf "Config file directory [/etc/webmin]: "
+printf "Config file directory [!!PREFIX!!/etc/webmin]: "
+printf "Config file directory [%%PREFIX%%/etc/webmin]: "
if [ "$config_dir" = "" ]; then
read config_dir
fi
if [ "$config_dir" = "" ]; then
- config_dir=/etc/webmin
+ config_dir=!!PREFIX!!/etc/webmin
+ config_dir=%%PREFIX%%/etc/webmin
fi
abspath=`echo $config_dir | grep "^/"`
if [ "$abspath" = "" ]; then
@@ -106,12 +106,12 @@
@@ -199,12 +199,12 @@
fi
else
# Ask for log directory
- printf "Log file directory [/var/webmin]: "
+ printf "Log file directory [/var/log/webmin]: "
@ -30,31 +33,53 @@
fi
abspath=`echo $var_dir | grep "^/"`
if [ "$abspath" = "" ]; then
@@ -135,7 +135,9 @@
@@ -232,7 +232,9 @@
echo "Webmin is written entirely in Perl. Please enter the full path to the"
echo "Perl 5 interpreter on your system."
echo ""
- if [ -x /usr/bin/perl ]; then
+ if [ -x !!PERL5!! ]; then
+ perldef=!!PERL5!!
+ if [ -x %%PERL5%% ]; then
+ perldef=%%PERL5%%
+ elif [ -x /usr/bin/perl ]; then
perldef=/usr/bin/perl
elif [ -x /usr/local/bin/perl ]; then
perldef=/usr/local/bin/perl
@@ -313,11 +315,11 @@
initsupp=`grep "^os_support=" $wadir/init/module.info | sed -e 's/os_support=//g' | grep $os_type`
atboot=0
if [ "$initsupp" != "" ]; then
@@ -418,22 +420,6 @@
fi
fi
- # Ask whether to run at boot time
- if [ "$atboot" = "" ]; then
- initsupp=`grep "^os_support=" "$srcdir/init/module.info" | sed -e 's/os_support=//g' | grep $os_type`
- atboot=0
- if [ "$initsupp" != "" ]; then
- printf "Start Webmin at boot time (y/n): "
- read atbootyn
- if [ "$atbootyn" = "y" -o "$atbootyn" = "Y" ]; then
- atboot=1
- fi
+ # printf "Start Webmin at boot time (y/n): "
+ # read atbootyn
+ # if [ "$atbootyn" = "y" -o "$atbootyn" = "Y" ]; then
+ # atboot=1
+ # fi
else
echo "Webmin does not support being started at boot time on your system."
fi
- else
- echo "Webmin does not support being started at boot time on your system."
- fi
- fi
- makeboot=$atboot
-
# Copy files to target directory
echo "***********************************************************************"
if [ "$wadir" != "$srcdir" ]; then
@@ -535,6 +521,7 @@
fi
fi
+noperlpath="yes"
if [ "$noperlpath" = "" ]; then
echo "Inserting path to perl into scripts.."
(find "$wadir" -name '*.cgi' -print ; find "$wadir" -name '*.pl' -print) | $perl "$wadir/perlpath.pl" $perl -
@@ -545,7 +532,6 @@
echo "Creating start and stop scripts.."
rm -f $config_dir/stop $config_dir/start $config_dir/restart
echo "#!/bin/sh" >>$config_dir/start
-echo "echo Starting Webmin server in $wadir" >>$config_dir/start
echo "trap '' 1" >>$config_dir/start
echo "LANG=" >>$config_dir/start
echo "export LANG" >>$config_dir/start

View file

@ -1,29 +1,28 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: webmin
# REQUIRE: LOGIN
# KEYWORD: FreeBSD
#
# Add the following line to /etc/rc.conf to enable webmin:
#
# webmin_enable="YES"
#
case $1 in
webmin_enable="NO"
start)
LD_PRELOAD=/usr/lib/libpam.so
export LD_PRELOAD
if [ -x !!PREFIX!!/etc/webmin/start ]; then
!!PREFIX!!/etc/webmin/start >/dev/null
echo -n ' webmin'
fi
exit 0
;;
. %%RC_SUBR%%
stop)
if [ -x !!PREFIX!!/etc/webmin/stop ]; then
!!PREFIX!!/etc/webmin/stop >/dev/null
echo -n ' webmin'
fi
exit 0
;;
name=webmin
rcvar=`set_rcvar`
*)
echo "usage: `basename $0` {start|stop}" >&2
exit 64
;;
esac
prefix=%%PREFIX%%
procname=%%PERL5%%
pidfile=/var/log/webmin/miniserv.pid
required_dirs=${prefix}/etc/webmin
command=${prefix}/etc/webmin/start
load_rc_config ${name}
run_rc_command "$1"

View file

@ -1,29 +1,28 @@
#!/bin/sh
#
# $FreeBSD$
#
# PROVIDE: webmin
# REQUIRE: LOGIN
# KEYWORD: FreeBSD
#
# Add the following line to /etc/rc.conf to enable webmin:
#
# webmin_enable="YES"
#
case $1 in
webmin_enable="NO"
start)
LD_PRELOAD=/usr/lib/libpam.so
export LD_PRELOAD
if [ -x !!PREFIX!!/etc/webmin/start ]; then
!!PREFIX!!/etc/webmin/start >/dev/null
echo -n ' webmin'
fi
exit 0
;;
. %%RC_SUBR%%
stop)
if [ -x !!PREFIX!!/etc/webmin/stop ]; then
!!PREFIX!!/etc/webmin/stop >/dev/null
echo -n ' webmin'
fi
exit 0
;;
name=webmin
rcvar=`set_rcvar`
*)
echo "usage: `basename $0` {start|stop}" >&2
exit 64
;;
esac
prefix=%%PREFIX%%
procname=%%PERL5%%
pidfile=/var/log/webmin/miniserv.pid
required_dirs=${prefix}/etc/webmin
command=${prefix}/etc/webmin/start
load_rc_config ${name}
run_rc_command "$1"

View file

@ -4,6 +4,6 @@ user accounts, Apache, DNS, file sharing and so on.
Webmin consists of a simple web server, and a number of CGI programs
which directly update system files like /etc/inetd.conf and
/etc/passwd.
/etc/master.passwd.
WWW: http://www.webmin.com/webmin/

View file

@ -8,4 +8,8 @@ run the following command as root:
You won't have to perform this step
after every webmin upgrade.
Since 1.150_2, to run webmin from
startup, add webmin_enable="YES"
in your /etc/rc.conf.
===================================

View file

@ -1,11 +1,5 @@
@comment stop service at deinstall time
@unexec [ -n "$BATCH" ] || ([ ! -d %D/etc/webmin ] || [ ! -x %D/etc/rc.d/webmin.sh ] || %D/etc/rc.d/webmin.sh stop >/dev/null )
etc/rc.d/webmin.sh-dist
etc/rc.d/webmin.sh
@comment Insert PLIST.lib-webmin here
@comment -=[ begin PLIST.lib-webmin ]=-
@comment -=[ end PLIST.lib-webmin ]=-
@dirrm lib/webmin
@comment upgrade configuration if etc/webmin exists
@exec [ ! -d %D/etc/webmin ] || echo | nostart=Y %D/lib/webmin/setup.sh
@comment run interactive setup if not in BATCH mode and no configuration exists
@exec [ -n "$BATCH" ] || ([ -d %D/etc/webmin ] || nostart=Y %D/lib/webmin/setup.sh)

View file

@ -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}/webmin.sh.sample > ${WRKDIR}/webmin.sh
exit 0