Skip site navigation (1)Skip section navigation (2)
Date:      Sat, 30 Mar 2002 11:40:41 GMT
From:      Eyal Soha <esoha@attbi.com>
To:        FreeBSD-gnats-submit@FreeBSD.org
Subject:   ports/36543: New port: noip updater v1.6
Message-ID:  <200203301140.g2UBefk00980@attbi.com>

next in thread | raw e-mail | index | archive | help

>Number:         36543
>Category:       ports
>Synopsis:       New port: noip updater v1.6
>Confidential:   no
>Severity:       non-critical
>Priority:       low
>Responsible:    freebsd-ports
>State:          open
>Quarter:        
>Keywords:       
>Date-Required:
>Class:          change-request
>Submitter-Id:   current-users
>Arrival-Date:   Sat Mar 30 11:50:01 PST 2002
>Closed-Date:
>Last-Modified:
>Originator:     Eyal Soha <esoha@attbi.com>
>Release:        FreeBSD 4.5-RELEASE i386
>Organization:
>Environment:
System: FreeBSD eyal.attbi.com 4.5-RELEASE FreeBSD 4.5-RELEASE #0: Mon Jan 28 14:31:56 GMT 2002 murray@builder.freebsdmall.com:/usr/src/sys/compile/GENERIC i386


	
>Description:
This is a port of no-ip.com's noip updater.  The software periodically
sends your IP address to no-ip.com's server where they automatically
update your dynamic IP address.

I went through all the details of the porter's handbook and also ran
portlint already.  I fixed a couple bugs along the way, too.  This is
the first time I've written a port so I welcome any comments!

Eyal <esoha@attbi.com>

>How-To-Repeat:
>Fix:

# This is a shell archive.  Save it in a file, remove anything before
# this line, and then unpack it by entering "sh file".  Note, it may
# create directories; files and directories will be owned by you and
# have default permissions.
#
# This archive contains:
#
#	noip
#	noip/pkg-comment
#	noip/Makefile
#	noip/distinfo
#	noip/pkg-message
#	noip/pkg-descr
#	noip/files
#	noip/files/patch-no-ip.sh
#	noip/files/patch-noip.c
#	noip/files/noip.sh
#	noip/pkg-plist
#	noip/pkg-install
#	noip/pkg-deinstall
#
echo c - noip
mkdir -p noip > /dev/null 2>&1
echo x - noip/pkg-comment
sed 's/^X//' >noip/pkg-comment << 'END-of-noip/pkg-comment'
XNo-IP.com's dynamic DNS update client
END-of-noip/pkg-comment
echo x - noip/Makefile
sed 's/^X//' >noip/Makefile << 'END-of-noip/Makefile'
X# New ports collection makefile for:   No-IP Dynamic Update Client
X# Date created:        28 March 2002
X# Whom:                Eyal Soha <esoha@attbi.com>
X#
X# $FreeBSD$
X#
X
XPORTNAME=	noip
XPORTVERSION=	1.6
XCATEGORIES=	net
XMASTER_SITES=	http://www.no-ip.com/client/linux/
XDISTNAME=	noip_updater_v${PORTVERSION}
X
XMAINTAINER=	esoha@attbi.com
X
XALL_TARGET=	noip
X
Xpost-build:
X	${SED} "s|%%PREFIX%%|${PREFIX}|g" < ${FILESDIR}/noip.sh > ${WRKSRC}/noip.sh
X
Xpre-install:
X	@${SETENV} PKG_PREFIX=${PREFIX} ${SH} \
X		${PKGINSTALL} ${PKGNAME} PRE-INSTALL
X
Xdo-install:
X	${INSTALL_PROGRAM} ${WRKSRC}/noip ${PREFIX}/bin
X	${INSTALL_SCRIPT} ${WRKSRC}/noip.sh ${PREFIX}/etc/rc.d
X.if !defined(NOPORTDOCS)
X	${MKDIR} ${PREFIX}/share/doc/${PORTNAME}
X	${INSTALL_MAN} ${WRKSRC}/README.FIRST ${PREFIX}/share/doc/${PORTNAME}
X	${INSTALL_MAN} ${WRKSRC}/COPYING ${PREFIX}/share/doc/${PORTNAME}
X	${MKDIR} ${PREFIX}/share/examples/${PORTNAME}
X	${INSTALL_MAN} ${WRKSRC}/no-ip.conf.sample ${PREFIX}/share/examples/${PORTNAME}
X	${INSTALL_SCRIPT} ${WRKSRC}/no-ip.sh ${PREFIX}/share/examples/${PORTNAME}
X.endif
X	@${SED} "s|%%PREFIX%%|${PREFIX}|g" ${PKGMESSAGE} | ${SED} "s|%%WRKSRC%%|${WRKSRC}|g"
X
Xconf:
X	(cd ${PREFIX}/etc && ${PREFIX}/share/examples/noip/no-ip.sh)
X	${CHOWN} noip:noip ${PREFIX}/etc/no-ip.conf
X	${CHMOD} 0600 ${PREFIX}/etc/no-ip.conf
X
X.include <bsd.port.mk>
END-of-noip/Makefile
echo x - noip/distinfo
sed 's/^X//' >noip/distinfo << 'END-of-noip/distinfo'
XMD5 (noip_updater_v1.6.tar.gz) = 6503e2e7d8ea35c304744a318b400a09
END-of-noip/distinfo
echo x - noip/pkg-message
sed 's/^X//' >noip/pkg-message << 'END-of-noip/pkg-message'
X##################################################################
XYou need to generate the noip config file 'no-ip.conf' in
X%%PREFIX%%/etc/no-ip.conf.  To do this automatically, run:
X
X	make conf
X
XTo do it manually, copy
X%%PREFIX%%/share/examples/noip/no-ip.conf.sample to
X%%PREFIX%%/etc/no-ip.conf and edit it or use
X%%PREFIX%%/share/examples/noip/no-ip.sh to make no-ip.conf.  Then
Xchown to noip:noip and chmod to 0600.
X
XYou need to register with www.no-ip.com to use this port.
X##################################################################
END-of-noip/pkg-message
echo x - noip/pkg-descr
sed 's/^X//' >noip/pkg-descr << 'END-of-noip/pkg-descr'
XThis is a port of No-IP.com's dynamic DNS update client.  When
Xconfigured correctly, the client will check the local IP address at a
Xgiven time interval for any changes.  If the local IP address has
Xchanged it will notify the DNS servers at No-IP.com and update the IP
Xcorresponding to your No-IP/No-IP+ hostname.
X
XWWW: http://www.No-IP.com/
X
X- Eyal Soha
Xesoha@attbi.com
END-of-noip/pkg-descr
echo c - noip/files
mkdir -p noip/files > /dev/null 2>&1
echo x - noip/files/patch-no-ip.sh
sed 's/^X//' >noip/files/patch-no-ip.sh << 'END-of-noip/files/patch-no-ip.sh'
X--- no-ip.sh.orig	Wed Oct 10 16:35:12 2001
X+++ no-ip.sh	Fri Mar 29 01:55:11 2002
X@@ -1,3 +1,4 @@
X+#!/bin/sh
X #
X # configuration file builder script for no-ip
X #
X@@ -89,7 +90,7 @@
X #
X if [ "$NAT" = "N" ] 
X then
X-    devs=`tail +3 /proc/net/dev | awk -F: '{print $1}' | tr -d ' '|tr '\n' ' '`
X+    devs=`ifconfig -l inet`
X     DEV=foo
X     while [ "$DEV" = "foo" ]
X     do
END-of-noip/files/patch-no-ip.sh
echo x - noip/files/patch-noip.c
sed 's/^X//' >noip/files/patch-noip.c << 'END-of-noip/files/patch-noip.c'
X--- noip.c.bak	Sat Mar 30 17:59:58 2002
X+++ noip.c	Sat Mar 30 17:59:15 2002
X@@ -452,7 +452,8 @@
X 		    else
X 			getip(IPaddress);
X #ifdef DEBUG
X-		    ErrMsg("! LIA = %s, IP = %s",Last_IP_Addr, IPaddress);
X+		    if (debug)
X+			ErrMsg("! LIA = %s, IP = %s",Last_IP_Addr, IPaddress);
X #endif
X 		    if ((*IPaddress != 0) && 
X 				(strcmp(IPaddress, Last_IP_Addr) != 0)) {
END-of-noip/files/patch-noip.c
echo x - noip/files/noip.sh
sed 's/^X//' >noip/files/noip.sh << 'END-of-noip/files/noip.sh'
X#!/bin/sh
X
Xcase "$1" in
X    start)
X	if [ -x %%PREFIX%%/bin/noip -a -f %%PREFIX%%/etc/no-ip.conf ]; then
X            echo -n ' noip';
X            su -m noip -c '%%PREFIX%%/bin/noip' 2> /dev/null > /dev/null
X        fi
X    ;;
X    stop)
X        echo -n ' noip';
X	killall noip
X    ;;
X    *)
X	echo "Usage: `basename $0` {start|stop}" >&2
X	exit 1
X    ;;
Xesac
Xexit 0
END-of-noip/files/noip.sh
echo x - noip/pkg-plist
sed 's/^X//' >noip/pkg-plist << 'END-of-noip/pkg-plist'
Xbin/noip
Xetc/rc.d/noip.sh
X%%PORTDOCS%%share/doc/noip/README.FIRST
X%%PORTDOCS%%share/doc/noip/COPYING
X%%PORTDOCS%%share/examples/noip/no-ip.conf.sample
X%%PORTDOCS%%share/examples/noip/no-ip.sh
X%%PORTDOCS%%@dirrm share/doc/noip
X%%PORTDOCS%%@dirrm share/examples/noip
END-of-noip/pkg-plist
echo x - noip/pkg-install
sed 's/^X//' >noip/pkg-install << 'END-of-noip/pkg-install'
X#!/bin/sh
X
Xif [ "$2" != "PRE-INSTALL" ]; then
X    exit 0
Xfi
X
XPW=/usr/sbin/pw
XECHO=echo
XUSER=noip
XGROUP=${USER}
X
Xif ! ${PW} groupshow "${GROUP}" 2>/dev/null 1>&2; then
X	if ${PW} groupadd ${GROUP}; then
X		${ECHO} "Added group \"${GROUP}\"."
X	else
X                ${ECHO} "Adding group \"${GROUP}\" failed..."
X                exit 1
X        fi
Xfi
X
Xif ! ${PW} usershow "${USER}" 2>/dev/null 1>&2; then
X        if ${PW} useradd ${USER} -g ${GROUP} -h - \
X                -s "/sbin/nologin" -d "/nonexistent" \
X                -c "noip_updater pseudo-user"; \
X        then
X                ${ECHO} "Added user \"${USER}\"."
X        else
X                ${ECHO} "Adding user \"${USER}\" failed..."
X                exit 1
X        fi
Xfi
Xexit 0
END-of-noip/pkg-install
echo x - noip/pkg-deinstall
sed 's/^X//' >noip/pkg-deinstall << 'END-of-noip/pkg-deinstall'
X#!/bin/sh
X
Xif [ "$2" != "POST-DEINSTALL" ]; then
X    exit 0
Xfi
X
XPW=/usr/sbin/pw
XECHO=echo
XUSER=noip
XGROUP=${USER}
X
Xif [ -f ${PKG_PREFIX}/etc/no-ip.conf ]; then
X    ${ECHO} "To delete noip configuration permanently: rm ${PKG_PREFIX}/etc/no-ip.conf"
Xfi
Xif ${PW} usershow "${USER}" 2>/dev/null 1>&2; then
X    ${ECHO} "To delete noip user permanently: ${PW} userdel ${USER}"
Xfi
Xif ${PW} groupshow "${GROUP}" 2>/dev/null 1>&2; then
X    ${ECHO} "To delete noip group permanently: ${PW} groupdel ${GROUP}"
Xfi
Xexit 0
END-of-noip/pkg-deinstall
exit

>Release-Note:
>Audit-Trail:
>Unformatted:

To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-ports" in the body of the message




Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200203301140.g2UBefk00980>