diff options
-rw-r--r-- | net-mgmt/smokeping/Makefile | 29 | ||||
-rw-r--r-- | net-mgmt/smokeping/files/smokeping.sh | 12 | ||||
-rw-r--r-- | net-mgmt/smokeping/pkg-deinstall | 4 | ||||
-rw-r--r-- | net-mgmt/smokeping/pkg-install | 118 | ||||
-rw-r--r-- | net-mgmt/smokeping/pkg-message | 8 | ||||
-rw-r--r-- | net-mgmt/smokeping/pkg-plist | 35 | ||||
-rw-r--r-- | net/smokeping/Makefile | 29 | ||||
-rw-r--r-- | net/smokeping/files/smokeping.sh | 12 | ||||
-rw-r--r-- | net/smokeping/pkg-deinstall | 4 | ||||
-rw-r--r-- | net/smokeping/pkg-install | 118 | ||||
-rw-r--r-- | net/smokeping/pkg-message | 8 | ||||
-rw-r--r-- | net/smokeping/pkg-plist | 35 |
12 files changed, 336 insertions, 76 deletions
diff --git a/net-mgmt/smokeping/Makefile b/net-mgmt/smokeping/Makefile index 4ce250fc8537..c12d2b1b508b 100644 --- a/net-mgmt/smokeping/Makefile +++ b/net-mgmt/smokeping/Makefile @@ -7,6 +7,7 @@ PORTNAME= smokeping PORTVERSION= 1.5 +PORTREVISION= 1 CATEGORIES= net www MASTER_SITES= http://people.ee.ethz.ch/~oetiker/webtools/smokeping/pub/ @@ -37,6 +38,7 @@ DOC2= EchoPing.pm EchoPingChargen.pm EchoPingDiscard.pm \ FPing.pm ParseConfig.pm Smokeping.pm \ base.pm basefork.pm basevars.pm smokeping.cgi \ smokeping smokeping_config smokeping_install +ETC1= basepage.html config smokemail config-echoping pre-patch: @${MV} ${WRKSRC}/bin/smokeping.dist ${WRKSRC}/bin/smokeping @@ -45,11 +47,12 @@ pre-patch: s|/usr/sepp/bin/perl|${PERL}|; \ s|/usr/sepp/bin/speedy|${PREFIX}/bin/speedy|; \ s|use lib qw\(/usr/pack/rrdtool-1.0.33-to/lib/perl\);\n||; \ + s|/home/oetiker/data/projects/AADJ-smokeping/dist/etc|${PREFIX}/etc/smokeping|; \ s|/home/oetiker/data/projects/AADJ-smokeping/dist|${PREFIX}/smokeping|; \ - s|/home/oetiker/.smokeping/config|${PREFIX}/smokeping/etc/config|; \ + s|/home/oetiker/.smokeping/config|${PREFIX}/etc/smokeping/config|; \ s|/usr/lib/sendmail|/usr/sbin/sendmail|; \ s|/usr/sepp/bin/fping|${PREFIX}/sbin/fping|; \ - s|piddir = /usr/local/smokeping/var|piddir = /var/run|; \ + s|piddir = /usr/local/smokeping/var|piddir = ${PREFIX}/var/smokeping|; \ s|imgcache = /home/oetiker/public_html/.simg|imgcache = ${PREFIX}/smokeping/htdocs/img|; \ s|imgurl = ../.simg|imgurl = /smokeimg|; \ ' \ @@ -60,17 +63,16 @@ pre-patch: ${PKGDIR}/pkg-message > ${PKGMESSAGE} do-build: - @${RM} ${WRKSRC}/doc/.cvsignore @${RM} ${WRKSRC}/lib/BER.pm @${RM} ${WRKSRC}/lib/SNMP_*.pm - @${RM} ${WRKSRC}/doc/*.pod - @${RM} ${WRKSRC}/Makefile + +pre-install: + PKG_PREFIX=${PREFIX} ${SH} pkg-install ${PKGNAME} PRE-INSTALL do-install: @${INSTALL_SCRIPT} ${WRKSRC}/bin/smokeping ${PREFIX}/bin .for file in ${MAN1} @${INSTALL_MAN} ${WRKSRC}/doc/${file} ${PREFIX}/man/man1 - @${RM} -f ${WRKSRC}/doc/${file} .endfor @${MKDIR} ${DOCDIR} .for file in ${DOC1} @@ -80,14 +82,17 @@ do-install: @${INSTALL_DATA} ${WRKSRC}/doc/${file}.html ${DOCDIR} @${INSTALL_DATA} ${WRKSRC}/doc/${file}.txt ${DOCDIR} .endfor - @${MKDIR} ${PREFIX}/smokeping - @${CP} -Rp ${WRKSRC}/[e-l]* ${PREFIX}/smokeping/ -.for file in config smokemail basepage.html config-echoping - @if [ ! -f ${PREFIX}/smokeping/etc/${file} ]; then \ - ${CP} ${PREFIX}/smokeping/etc/${file}.dist ${PREFIX}/smokeping/etc/${file} ; \ + @${MKDIR} ${PREFIX}/etc/smokeping +.for file in ${ETC1} + @${INSTALL_DATA} ${WRKSRC}/etc/${file}.dist ${PREFIX}/etc/smokeping + @if [ ! -f ${PREFIX}/etc/smokeping/${file} ]; then \ + ${INSTALL_DATA} ${WRKSRC}/etc/${file}.dist ${PREFIX}/etc/smokeping/${file} ; \ fi .endfor - @${MKDIR} ${PREFIX}/smokeping/var + @${MKDIR} ${PREFIX}/smokeping + @${CP} -Rp ${WRKSRC}/[hl]* ${PREFIX}/smokeping/ + @${MKDIR} ${PREFIX}/var/smokeping + @${CHOWN} smokeping:smokeping ${PREFIX}/var/smokeping @${MKDIR} ${PREFIX}/smokeping/htdocs/img @${CHOWN} www:www ${PREFIX}/smokeping/htdocs/img @if [ ! -f ${PREFIX}/etc/rc.d/smokeping.sh ]; then \ diff --git a/net-mgmt/smokeping/files/smokeping.sh b/net-mgmt/smokeping/files/smokeping.sh index 44e3bd0309f5..018a71bace7d 100644 --- a/net-mgmt/smokeping/files/smokeping.sh +++ b/net-mgmt/smokeping/files/smokeping.sh @@ -7,13 +7,19 @@ fi case "$1" in start) - [ -r ${PREFIX}/smokeping/etc/config ] && ${PREFIX}/bin/smokeping > /dev/null && echo -n ' smokeping' + [ -r ${PREFIX}/etc/smokeping/config ] && \ + su -f -m smokeping -c ${PREFIX}/bin/smokeping > /dev/null && \ + echo -n ' smokeping' ;; restart) - [ -r ${PREFIX}/smokeping/etc/config ] && ${PREFIX}/bin/smokeping --restart > /dev/null && echo -n ' smokeping' + [ -r ${PREFIX}/etc/smokeping/config ] && \ + su -f -m smokeping -c ${PREFIX}/bin/smokeping --restart > /dev/null && \ + echo -n ' smokeping' ;; stop) - [ -r /var/run/smokeping.pid ] && kill `cat /var/run/smokeping.pid` > /dev/null && echo -n ' smokeping' + [ -r ${PREFIX}/var/smokeping/smokeping.pid ] && \ + su -f -m smokeping -c kill `cat ${PREFIX}/var/smokeping/smokeping.pid` > /dev/null && \ + echo -n ' smokeping' ;; *) echo "Usage: `basename $0` {start|restart|stop}" >&2 diff --git a/net-mgmt/smokeping/pkg-deinstall b/net-mgmt/smokeping/pkg-deinstall index 65f707cb86d5..901e0c3182be 100644 --- a/net-mgmt/smokeping/pkg-deinstall +++ b/net-mgmt/smokeping/pkg-deinstall @@ -2,11 +2,11 @@ # $FreeBSD$ # -if [ -f /var/run/smokeping.pid ]; then +if [ -f ${PKG_PREFIX}/var/smokeping/smokeping.pid ]; then if [ -x ${PKG_PREFIX}/etc/rc.d/smokeping.sh ]; then ${PKG_PREFIX}/etc/rc.d/smokeping.sh stop > /dev/null fi - rm /var/run/smokeping.pid + rm ${PKG_PREFIX}/var/smokeping/smokeping.pid fi if [ "$2" != "POST-DEINSTALL" ]; then diff --git a/net-mgmt/smokeping/pkg-install b/net-mgmt/smokeping/pkg-install new file mode 100644 index 000000000000..ae0082364853 --- /dev/null +++ b/net-mgmt/smokeping/pkg-install @@ -0,0 +1,118 @@ +#! /bin/sh + +ask() { + local question default answer + + question=$1 + default=$2 + if [ -z "${PACKAGE_BUILDING}" ]; then + read -p "${question} [${default}]? " answer + fi + if [ x${answer} = x ]; then + answer=${default} + fi + echo ${answer} +} + +yesno() { + local dflt question answer + + question=$1 + dflt=$2 + while :; do + answer=$(ask "${question}" "${dflt}") + case "${answer}" in + [Yy]*) return 0;; + [Nn]*) return 1;; + esac + echo "Please answer yes or no." + done +} + +make_account() { + local u g gcos homeopt home + + u=$1 + g=$2 + gcos=$3 + homeopt=${4:+"-d $4"} + + if pw group show "${g}" >/dev/null 2>&1; then + echo "You already have a group \"${g}\", so I will use it." + else + echo "You need a group \"${g}\"." + if which -s pw && yesno "Would you like me to create it" y; then + pw groupadd ${g} || exit + echo "Done." + else + echo "Please create it, and try again." + if ! grep -q "^${u}:" /etc/passwd; then + echo "While you're at it, please create a user \"${u}\" too," + echo "with a default group of \"${g}\"." + fi + exit 1 + fi + fi + + if pw user show "${u}" >/dev/null 2>&1; then + echo "You already have a user \"${u}\", so I will use it." + else + echo "You need a user \"${u}\"." + if which -s pw && yesno "Would you like me to create it" y; then + pw useradd ${u} -g ${g} -h - ${homeopt} \ + -s /nonexistent -c "${gcos}" || exit + echo "Done." + else + echo "Please create it, and try again." + exit 1 + fi + fi + + if [ x"$homeopt" = x ]; then + eval home=~${u} + if [ ! -d "${home}" ]; then + if yesno \ + "Would you like me to create ${u}'s home directory (${home})" y + then + (umask 77 && \ + mkdir -p ${home}) || exit + chown -R ${u}:${g} ${home} || exit + else + echo "Please create it, and try again." + exit 1 + fi + fi + fi +} + +if [ "$2" != "PRE-INSTALL" ]; then + exit 0 +fi + +USER=www +GROUP=${USER} +UID=80 +GID=${UID} + +if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then + if pw groupadd ${GROUP} -g ${GID}; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + exit 1 + fi +fi + +if ! pw usershow "${USER}" 2>/dev/null 1>&2; then + if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ + -s "/sbin/nologin" -d "/nonexistent" \ + -c "World Wide Web Owner"; \ + then + echo "Added user \"${USER}\"." + else + echo "Adding user \"${USER}\" failed..." + exit 1 + fi +fi + +make_account smokeping smokeping "SmokePing Daemon" "/nonexistent" diff --git a/net-mgmt/smokeping/pkg-message b/net-mgmt/smokeping/pkg-message index 77c6243373dc..0f5956de1b74 100644 --- a/net-mgmt/smokeping/pkg-message +++ b/net-mgmt/smokeping/pkg-message @@ -4,10 +4,10 @@ SmokePing has now been installed in %%PREFIX%%/smokeping/. NOTE: A set of sample configuration files have been installed: - %%PREFIX%%/smokeping/etc/config - %%PREFIX%%/smokeping/etc/smokemail - %%PREFIX%%/smokeping/etc/basepage.html - %%PREFIX%%/smokeping/etc/config-echoping + %%PREFIX%%/etc/smokeping/config + %%PREFIX%%/etc/smokeping/smokemail + %%PREFIX%%/etc/smokeping/basepage.html + %%PREFIX%%/etc/smokeping/config-echoping You need edit these to suit your requirements. Please refer to %%PREFIX%%/share/doc/smokeping/smokeping_install.txt and diff --git a/net-mgmt/smokeping/pkg-plist b/net-mgmt/smokeping/pkg-plist index 9bc8806023c3..78e227cba3f9 100644 --- a/net-mgmt/smokeping/pkg-plist +++ b/net-mgmt/smokeping/pkg-plist @@ -1,4 +1,17 @@ bin/smokeping +etc/rc.d/smokeping.sh +@unexec if cmp -s %D/etc/smokeping/basepage.html %D/etc/smokeping/basepage.html.dist; then rm -f %D/etc/smokeping/basepage.html; fi +etc/smokeping/basepage.html.dist +@exec [ -f %B/basepage.html ] || cp %B/%f %B/basepage.html +@unexec if cmp -s %D/etc/smokeping/config %D/etc/smokeping/config.dist; then rm -f %D/etc/smokeping/config; fi +etc/smokeping/config.dist +@exec [ -f %B/config ] || cp %B/%f %B/config +@unexec if cmp -s %D/etc/smokeping/smokemail %D/etc/smokeping/smokemail.dist; then rm -f %D/etc/smokeping/smokemail; fi +etc/smokeping/smokemail.dist +@exec [ -f %B/smokemail ] || cp %B/%f %B/smokemail +@unexec if cmp -s %D/etc/smokeping/config-echoping %D/etc/smokeping/config-echoping.dist; then rm -f %D/etc/smokeping/config-echoping; fi +etc/smokeping/config-echoping.dist +@exec [ -f %B/config-echoping ] || cp %B/%f %B/config-echoping share/doc/smokeping/CHANGES share/doc/smokeping/CONTRIBUTORS share/doc/smokeping/COPYING @@ -39,18 +52,6 @@ share/doc/smokeping/smokeping_config.html share/doc/smokeping/smokeping_config.txt share/doc/smokeping/smokeping_install.html share/doc/smokeping/smokeping_install.txt -@unexec if cmp -s %D/smokeping/etc/basepage.html %D/smokeping/etc/basepage.html.dist; then rm -f %D/smokeping/etc/basepage.html; fi -smokeping/etc/basepage.html.dist -@exec [ -f %B/basepage.html ] || cp %B/%f %B/basepage.html -@unexec if cmp -s %D/smokeping/etc/config %D/smokeping/etc/config.dist; then rm -f %D/smokeping/etc/config; fi -smokeping/etc/config.dist -@exec [ -f %B/config ] || cp %B/%f %B/config -@unexec if cmp -s %D/smokeping/etc/smokemail %D/smokeping/etc/smokemail.dist; then rm -f %D/smokeping/etc/smokemail; fi -smokeping/etc/smokemail.dist -@exec [ -f %B/smokemail ] || cp %B/%f %B/smokemail -@unexec if cmp -s %D/smokeping/etc/config-echoping %D/smokeping/etc/config-echoping.dist; then rm -f %D/smokeping/etc/config-echoping; fi -smokeping/etc/config-echoping.dist -@exec [ -f %B/config-echoping ] || cp %B/%f %B/config-echoping smokeping/htdocs/smokeping.cgi smokeping/lib/Smokeping.pm smokeping/lib/probes/FPing.pm @@ -65,15 +66,15 @@ smokeping/lib/probes/EchoPingSmtp.pm smokeping/lib/probes/basefork.pm smokeping/lib/probes/basevars.pm smokeping/lib/ISG/ParseConfig.pm -etc/rc.d/smokeping.sh +@unexec rmdir %D/etc/smokeping || true @exec mkdir -p %D/smokeping/htdocs/img; chown www:www %D/smokeping/htdocs/img @unexec rm -rf %D/smokeping/htdocs/img -@exec mkdir -p %D/smokeping/var -@unexec rmdir %D/smokeping/var || true -@unexec rmdir %D/smokeping/etc || true +@exec mkdir -p %D/var/smokeping +@exec chown smokeping:smokeping %D/var/smokeping +@unexec rmdir %D/var/smokeping 2>/dev/null || true @dirrm smokeping/htdocs @dirrm smokeping/lib/probes @dirrm smokeping/lib/ISG @dirrm smokeping/lib @dirrm share/doc/smokeping -@unexec rmdir %D/smokeping || true +@unexec rmdir %D/smokeping 2>/dev/null || true diff --git a/net/smokeping/Makefile b/net/smokeping/Makefile index 4ce250fc8537..c12d2b1b508b 100644 --- a/net/smokeping/Makefile +++ b/net/smokeping/Makefile @@ -7,6 +7,7 @@ PORTNAME= smokeping PORTVERSION= 1.5 +PORTREVISION= 1 CATEGORIES= net www MASTER_SITES= http://people.ee.ethz.ch/~oetiker/webtools/smokeping/pub/ @@ -37,6 +38,7 @@ DOC2= EchoPing.pm EchoPingChargen.pm EchoPingDiscard.pm \ FPing.pm ParseConfig.pm Smokeping.pm \ base.pm basefork.pm basevars.pm smokeping.cgi \ smokeping smokeping_config smokeping_install +ETC1= basepage.html config smokemail config-echoping pre-patch: @${MV} ${WRKSRC}/bin/smokeping.dist ${WRKSRC}/bin/smokeping @@ -45,11 +47,12 @@ pre-patch: s|/usr/sepp/bin/perl|${PERL}|; \ s|/usr/sepp/bin/speedy|${PREFIX}/bin/speedy|; \ s|use lib qw\(/usr/pack/rrdtool-1.0.33-to/lib/perl\);\n||; \ + s|/home/oetiker/data/projects/AADJ-smokeping/dist/etc|${PREFIX}/etc/smokeping|; \ s|/home/oetiker/data/projects/AADJ-smokeping/dist|${PREFIX}/smokeping|; \ - s|/home/oetiker/.smokeping/config|${PREFIX}/smokeping/etc/config|; \ + s|/home/oetiker/.smokeping/config|${PREFIX}/etc/smokeping/config|; \ s|/usr/lib/sendmail|/usr/sbin/sendmail|; \ s|/usr/sepp/bin/fping|${PREFIX}/sbin/fping|; \ - s|piddir = /usr/local/smokeping/var|piddir = /var/run|; \ + s|piddir = /usr/local/smokeping/var|piddir = ${PREFIX}/var/smokeping|; \ s|imgcache = /home/oetiker/public_html/.simg|imgcache = ${PREFIX}/smokeping/htdocs/img|; \ s|imgurl = ../.simg|imgurl = /smokeimg|; \ ' \ @@ -60,17 +63,16 @@ pre-patch: ${PKGDIR}/pkg-message > ${PKGMESSAGE} do-build: - @${RM} ${WRKSRC}/doc/.cvsignore @${RM} ${WRKSRC}/lib/BER.pm @${RM} ${WRKSRC}/lib/SNMP_*.pm - @${RM} ${WRKSRC}/doc/*.pod - @${RM} ${WRKSRC}/Makefile + +pre-install: + PKG_PREFIX=${PREFIX} ${SH} pkg-install ${PKGNAME} PRE-INSTALL do-install: @${INSTALL_SCRIPT} ${WRKSRC}/bin/smokeping ${PREFIX}/bin .for file in ${MAN1} @${INSTALL_MAN} ${WRKSRC}/doc/${file} ${PREFIX}/man/man1 - @${RM} -f ${WRKSRC}/doc/${file} .endfor @${MKDIR} ${DOCDIR} .for file in ${DOC1} @@ -80,14 +82,17 @@ do-install: @${INSTALL_DATA} ${WRKSRC}/doc/${file}.html ${DOCDIR} @${INSTALL_DATA} ${WRKSRC}/doc/${file}.txt ${DOCDIR} .endfor - @${MKDIR} ${PREFIX}/smokeping - @${CP} -Rp ${WRKSRC}/[e-l]* ${PREFIX}/smokeping/ -.for file in config smokemail basepage.html config-echoping - @if [ ! -f ${PREFIX}/smokeping/etc/${file} ]; then \ - ${CP} ${PREFIX}/smokeping/etc/${file}.dist ${PREFIX}/smokeping/etc/${file} ; \ + @${MKDIR} ${PREFIX}/etc/smokeping +.for file in ${ETC1} + @${INSTALL_DATA} ${WRKSRC}/etc/${file}.dist ${PREFIX}/etc/smokeping + @if [ ! -f ${PREFIX}/etc/smokeping/${file} ]; then \ + ${INSTALL_DATA} ${WRKSRC}/etc/${file}.dist ${PREFIX}/etc/smokeping/${file} ; \ fi .endfor - @${MKDIR} ${PREFIX}/smokeping/var + @${MKDIR} ${PREFIX}/smokeping + @${CP} -Rp ${WRKSRC}/[hl]* ${PREFIX}/smokeping/ + @${MKDIR} ${PREFIX}/var/smokeping + @${CHOWN} smokeping:smokeping ${PREFIX}/var/smokeping @${MKDIR} ${PREFIX}/smokeping/htdocs/img @${CHOWN} www:www ${PREFIX}/smokeping/htdocs/img @if [ ! -f ${PREFIX}/etc/rc.d/smokeping.sh ]; then \ diff --git a/net/smokeping/files/smokeping.sh b/net/smokeping/files/smokeping.sh index 44e3bd0309f5..018a71bace7d 100644 --- a/net/smokeping/files/smokeping.sh +++ b/net/smokeping/files/smokeping.sh @@ -7,13 +7,19 @@ fi case "$1" in start) - [ -r ${PREFIX}/smokeping/etc/config ] && ${PREFIX}/bin/smokeping > /dev/null && echo -n ' smokeping' + [ -r ${PREFIX}/etc/smokeping/config ] && \ + su -f -m smokeping -c ${PREFIX}/bin/smokeping > /dev/null && \ + echo -n ' smokeping' ;; restart) - [ -r ${PREFIX}/smokeping/etc/config ] && ${PREFIX}/bin/smokeping --restart > /dev/null && echo -n ' smokeping' + [ -r ${PREFIX}/etc/smokeping/config ] && \ + su -f -m smokeping -c ${PREFIX}/bin/smokeping --restart > /dev/null && \ + echo -n ' smokeping' ;; stop) - [ -r /var/run/smokeping.pid ] && kill `cat /var/run/smokeping.pid` > /dev/null && echo -n ' smokeping' + [ -r ${PREFIX}/var/smokeping/smokeping.pid ] && \ + su -f -m smokeping -c kill `cat ${PREFIX}/var/smokeping/smokeping.pid` > /dev/null && \ + echo -n ' smokeping' ;; *) echo "Usage: `basename $0` {start|restart|stop}" >&2 diff --git a/net/smokeping/pkg-deinstall b/net/smokeping/pkg-deinstall index 65f707cb86d5..901e0c3182be 100644 --- a/net/smokeping/pkg-deinstall +++ b/net/smokeping/pkg-deinstall @@ -2,11 +2,11 @@ # $FreeBSD$ # -if [ -f /var/run/smokeping.pid ]; then +if [ -f ${PKG_PREFIX}/var/smokeping/smokeping.pid ]; then if [ -x ${PKG_PREFIX}/etc/rc.d/smokeping.sh ]; then ${PKG_PREFIX}/etc/rc.d/smokeping.sh stop > /dev/null fi - rm /var/run/smokeping.pid + rm ${PKG_PREFIX}/var/smokeping/smokeping.pid fi if [ "$2" != "POST-DEINSTALL" ]; then diff --git a/net/smokeping/pkg-install b/net/smokeping/pkg-install new file mode 100644 index 000000000000..ae0082364853 --- /dev/null +++ b/net/smokeping/pkg-install @@ -0,0 +1,118 @@ +#! /bin/sh + +ask() { + local question default answer + + question=$1 + default=$2 + if [ -z "${PACKAGE_BUILDING}" ]; then + read -p "${question} [${default}]? " answer + fi + if [ x${answer} = x ]; then + answer=${default} + fi + echo ${answer} +} + +yesno() { + local dflt question answer + + question=$1 + dflt=$2 + while :; do + answer=$(ask "${question}" "${dflt}") + case "${answer}" in + [Yy]*) return 0;; + [Nn]*) return 1;; + esac + echo "Please answer yes or no." + done +} + +make_account() { + local u g gcos homeopt home + + u=$1 + g=$2 + gcos=$3 + homeopt=${4:+"-d $4"} + + if pw group show "${g}" >/dev/null 2>&1; then + echo "You already have a group \"${g}\", so I will use it." + else + echo "You need a group \"${g}\"." + if which -s pw && yesno "Would you like me to create it" y; then + pw groupadd ${g} || exit + echo "Done." + else + echo "Please create it, and try again." + if ! grep -q "^${u}:" /etc/passwd; then + echo "While you're at it, please create a user \"${u}\" too," + echo "with a default group of \"${g}\"." + fi + exit 1 + fi + fi + + if pw user show "${u}" >/dev/null 2>&1; then + echo "You already have a user \"${u}\", so I will use it." + else + echo "You need a user \"${u}\"." + if which -s pw && yesno "Would you like me to create it" y; then + pw useradd ${u} -g ${g} -h - ${homeopt} \ + -s /nonexistent -c "${gcos}" || exit + echo "Done." + else + echo "Please create it, and try again." + exit 1 + fi + fi + + if [ x"$homeopt" = x ]; then + eval home=~${u} + if [ ! -d "${home}" ]; then + if yesno \ + "Would you like me to create ${u}'s home directory (${home})" y + then + (umask 77 && \ + mkdir -p ${home}) || exit + chown -R ${u}:${g} ${home} || exit + else + echo "Please create it, and try again." + exit 1 + fi + fi + fi +} + +if [ "$2" != "PRE-INSTALL" ]; then + exit 0 +fi + +USER=www +GROUP=${USER} +UID=80 +GID=${UID} + +if ! pw groupshow "${GROUP}" 2>/dev/null 1>&2; then + if pw groupadd ${GROUP} -g ${GID}; then + echo "Added group \"${GROUP}\"." + else + echo "Adding group \"${GROUP}\" failed..." + exit 1 + fi +fi + +if ! pw usershow "${USER}" 2>/dev/null 1>&2; then + if pw useradd ${USER} -u ${UID} -g ${GROUP} -h - \ + -s "/sbin/nologin" -d "/nonexistent" \ + -c "World Wide Web Owner"; \ + then + echo "Added user \"${USER}\"." + else + echo "Adding user \"${USER}\" failed..." + exit 1 + fi +fi + +make_account smokeping smokeping "SmokePing Daemon" "/nonexistent" diff --git a/net/smokeping/pkg-message b/net/smokeping/pkg-message index 77c6243373dc..0f5956de1b74 100644 --- a/net/smokeping/pkg-message +++ b/net/smokeping/pkg-message @@ -4,10 +4,10 @@ SmokePing has now been installed in %%PREFIX%%/smokeping/. NOTE: A set of sample configuration files have been installed: - %%PREFIX%%/smokeping/etc/config - %%PREFIX%%/smokeping/etc/smokemail - %%PREFIX%%/smokeping/etc/basepage.html - %%PREFIX%%/smokeping/etc/config-echoping + %%PREFIX%%/etc/smokeping/config + %%PREFIX%%/etc/smokeping/smokemail + %%PREFIX%%/etc/smokeping/basepage.html + %%PREFIX%%/etc/smokeping/config-echoping You need edit these to suit your requirements. Please refer to %%PREFIX%%/share/doc/smokeping/smokeping_install.txt and diff --git a/net/smokeping/pkg-plist b/net/smokeping/pkg-plist index 9bc8806023c3..78e227cba3f9 100644 --- a/net/smokeping/pkg-plist +++ b/net/smokeping/pkg-plist @@ -1,4 +1,17 @@ bin/smokeping +etc/rc.d/smokeping.sh +@unexec if cmp -s %D/etc/smokeping/basepage.html %D/etc/smokeping/basepage.html.dist; then rm -f %D/etc/smokeping/basepage.html; fi +etc/smokeping/basepage.html.dist +@exec [ -f %B/basepage.html ] || cp %B/%f %B/basepage.html +@unexec if cmp -s %D/etc/smokeping/config %D/etc/smokeping/config.dist; then rm -f %D/etc/smokeping/config; fi +etc/smokeping/config.dist +@exec [ -f %B/config ] || cp %B/%f %B/config +@unexec if cmp -s %D/etc/smokeping/smokemail %D/etc/smokeping/smokemail.dist; then rm -f %D/etc/smokeping/smokemail; fi +etc/smokeping/smokemail.dist +@exec [ -f %B/smokemail ] || cp %B/%f %B/smokemail +@unexec if cmp -s %D/etc/smokeping/config-echoping %D/etc/smokeping/config-echoping.dist; then rm -f %D/etc/smokeping/config-echoping; fi +etc/smokeping/config-echoping.dist +@exec [ -f %B/config-echoping ] || cp %B/%f %B/config-echoping share/doc/smokeping/CHANGES share/doc/smokeping/CONTRIBUTORS share/doc/smokeping/COPYING @@ -39,18 +52,6 @@ share/doc/smokeping/smokeping_config.html share/doc/smokeping/smokeping_config.txt share/doc/smokeping/smokeping_install.html share/doc/smokeping/smokeping_install.txt -@unexec if cmp -s %D/smokeping/etc/basepage.html %D/smokeping/etc/basepage.html.dist; then rm -f %D/smokeping/etc/basepage.html; fi -smokeping/etc/basepage.html.dist -@exec [ -f %B/basepage.html ] || cp %B/%f %B/basepage.html -@unexec if cmp -s %D/smokeping/etc/config %D/smokeping/etc/config.dist; then rm -f %D/smokeping/etc/config; fi -smokeping/etc/config.dist -@exec [ -f %B/config ] || cp %B/%f %B/config -@unexec if cmp -s %D/smokeping/etc/smokemail %D/smokeping/etc/smokemail.dist; then rm -f %D/smokeping/etc/smokemail; fi -smokeping/etc/smokemail.dist -@exec [ -f %B/smokemail ] || cp %B/%f %B/smokemail -@unexec if cmp -s %D/smokeping/etc/config-echoping %D/smokeping/etc/config-echoping.dist; then rm -f %D/smokeping/etc/config-echoping; fi -smokeping/etc/config-echoping.dist -@exec [ -f %B/config-echoping ] || cp %B/%f %B/config-echoping smokeping/htdocs/smokeping.cgi smokeping/lib/Smokeping.pm smokeping/lib/probes/FPing.pm @@ -65,15 +66,15 @@ smokeping/lib/probes/EchoPingSmtp.pm smokeping/lib/probes/basefork.pm smokeping/lib/probes/basevars.pm smokeping/lib/ISG/ParseConfig.pm -etc/rc.d/smokeping.sh +@unexec rmdir %D/etc/smokeping || true @exec mkdir -p %D/smokeping/htdocs/img; chown www:www %D/smokeping/htdocs/img @unexec rm -rf %D/smokeping/htdocs/img -@exec mkdir -p %D/smokeping/var -@unexec rmdir %D/smokeping/var || true -@unexec rmdir %D/smokeping/etc || true +@exec mkdir -p %D/var/smokeping +@exec chown smokeping:smokeping %D/var/smokeping +@unexec rmdir %D/var/smokeping 2>/dev/null || true @dirrm smokeping/htdocs @dirrm smokeping/lib/probes @dirrm smokeping/lib/ISG @dirrm smokeping/lib @dirrm share/doc/smokeping -@unexec rmdir %D/smokeping || true +@unexec rmdir %D/smokeping 2>/dev/null || true |