diff options
-rw-r--r-- | buildtools/build-freebsd-ports.py | 4 | ||||
-rw-r--r-- | buildtools/freebsd-skeleton/rpki-ca/Makefile | 7 | ||||
-rw-r--r-- | buildtools/freebsd-skeleton/rpki-ca/pkg-deinstall | 44 | ||||
-rw-r--r-- | buildtools/freebsd-skeleton/rpki-ca/pkg-install | 14 | ||||
-rw-r--r-- | buildtools/freebsd-skeleton/rpki-ca/pkg-upgrade | 18 | ||||
-rw-r--r-- | buildtools/freebsd-skeleton/rpki-rp/Makefile | 14 | ||||
-rw-r--r-- | buildtools/freebsd-skeleton/rpki-rp/pkg-deinstall | 6 | ||||
-rw-r--r-- | buildtools/freebsd-skeleton/rpki-rp/pkg-install | 48 | ||||
-rw-r--r-- | buildtools/freebsd-skeleton/rpki-rp/pkg-upgrade | 18 |
9 files changed, 151 insertions, 22 deletions
diff --git a/buildtools/build-freebsd-ports.py b/buildtools/build-freebsd-ports.py index d73f9aef..13649a6a 100644 --- a/buildtools/build-freebsd-ports.py +++ b/buildtools/build-freebsd-ports.py @@ -37,7 +37,7 @@ if not os.path.isdir(svndir): svnversion = subprocess.check_output(("svnversion", "-c", svndir)).strip().split(":")[-1] # Uncomment the next line when debugging to get past the "pristine source" check. -#svnversion = svnversion.translate(None, "M") +svnversion = svnversion.translate(None, "M") if not svnversion.isdigit(): sys.exit("Sources don't look pristine, not building (%r)" % svnversion) @@ -65,6 +65,8 @@ shutil.copytree(os.path.join(svndir, "buildtools", "freebsd-skeleton"), portsdir if os.path.exists(os.path.join(portsdir_old, tarball)): os.link(os.path.join(portsdir_old, tarball), os.path.join(portsdir, tarball)) +elif os.path.exists(os.path.join("/usr/ports/distfiles", tarball)): + shutil.copy(os.path.join("/usr/ports/distfiles", tarball), os.path.join(portsdir, tarball)) if os.path.isdir(portsdir_old): shutil.rmtree(portsdir_old) diff --git a/buildtools/freebsd-skeleton/rpki-ca/Makefile b/buildtools/freebsd-skeleton/rpki-ca/Makefile index 0ddc5f1d..722e0ede 100644 --- a/buildtools/freebsd-skeleton/rpki-ca/Makefile +++ b/buildtools/freebsd-skeleton/rpki-ca/Makefile @@ -6,6 +6,7 @@ DISTFILES= rpki-%(SVNBRANCH)s-r%(SVNVERSION)s.tar.xz WRKSRC= ${WRKDIR}/rpki-%(SVNBRANCH)s-r%(SVNVERSION)s MAINTAINER= sra@hactrn.net COMMENT= rpki.net RPKI CA tools +WWW= http://rpki.net/ GNU_CONFIGURE= yes USE_PYTHON= 2.7+ @@ -41,4 +42,10 @@ CONFIGURE_ENV= CFLAGS="-I${LOCALBASE}/include" LDFLAGS="-L${LOCALBASE}/lib" CONFIGURE_ARGS= --disable-target-installation --disable-rp-tools +pre-install: + PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL + +post-install: + PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL + .include <bsd.port.mk> diff --git a/buildtools/freebsd-skeleton/rpki-ca/pkg-deinstall b/buildtools/freebsd-skeleton/rpki-ca/pkg-deinstall index e06dff53..e06815e9 100644 --- a/buildtools/freebsd-skeleton/rpki-ca/pkg-deinstall +++ b/buildtools/freebsd-skeleton/rpki-ca/pkg-deinstall @@ -3,12 +3,54 @@ case $2 in DEINSTALL) - if cmp -s /usr/local/etc/rpki.conf.sample /usr/local/etc/rpki.conf; then + + # Clean up BPKI files. These are all stored in SQL anyway, no great loss. + + rm -f /usr/local/share/rpki/ca.cer + rm -f /usr/local/share/rpki/irbe.cer + rm -f /usr/local/share/rpki/irdbd.cer + rm -f /usr/local/share/rpki/pubd.cer + rm -f /usr/local/share/rpki/pubd.key + rm -f /usr/local/share/rpki/rpkid.cer + rm -f /usr/local/share/rpki/rpkid.key + + # If we were automatically dropping SQL databases, this would be + # where we'd want to record what databases to drop. + + # If we had cron jobs installed, this is where we'd get rid of + # them (or maybe before whacking the BPKI files). + + # Clean up what we did to Apache. + + /usr/local/libexec/rpkigui-apache-conf-gen --freebsd --remove --verbose + + # Clean up configuration file + + if cmp -s /usr/local/etc/rpki.conf.sample /usr/local/etc/rpki.conf + then rm -f /usr/local/etc/rpki.conf fi + rm -f /usr/local/etc/rpki.conf.sample + ;; POST-DEINSTALL) + + # FreeBSD has no equivalent to Debian "purge" operation, so + # there are some things we're deliberately leaving undone here: + # + # - We're not dropping SQL tables + # + # - We're not deleting rpki.conf if it was modified + # + # - We're not deleting apache.{cer,key} + # + # Not really sure what to do about these. To the extent that + # I understand the theory on FreeBSD (which seems to be less + # carefully worked out than on Debian, even though i've been + # using FreeBSD longer), we're just supposed to leave these + # for the user to clean up. + ;; *) diff --git a/buildtools/freebsd-skeleton/rpki-ca/pkg-install b/buildtools/freebsd-skeleton/rpki-ca/pkg-install index 092d5482..c6f62bf8 100644 --- a/buildtools/freebsd-skeleton/rpki-ca/pkg-install +++ b/buildtools/freebsd-skeleton/rpki-ca/pkg-install @@ -7,6 +7,8 @@ PRE-INSTALL) POST-INSTALL) + /usr/local/libexec/rpkigui-apache-conf-gen --freebsd --install --verbose + hostname=`hostname` handle=`hostname | sed 's/[.]/_/g'` /usr/local/sbin/rpki-confgen \ @@ -19,11 +21,21 @@ POST-INSTALL) --pwgen web_portal::secret-key \ --write-conf /usr/local/etc/rpki.conf.sample - if test ! -f /usr/local/etc/rpki.conf; then + if test ! -f /usr/local/etc/rpki.conf + then cp -p /usr/local/etc/rpki.conf.sample /usr/local/etc/rpki.conf fi install -o root -g wheel -d /usr/local/share/rpki/publication + + rpki-sql-setup + rpki-manage syncdb --noinput + rpki-manage migrate app + + rpkic initialize_server_bpki + + # We should be setting up a crontab here, but debug the rest of this first. + ;; *) diff --git a/buildtools/freebsd-skeleton/rpki-ca/pkg-upgrade b/buildtools/freebsd-skeleton/rpki-ca/pkg-upgrade new file mode 100644 index 00000000..f569a3d6 --- /dev/null +++ b/buildtools/freebsd-skeleton/rpki-ca/pkg-upgrade @@ -0,0 +1,18 @@ +#!/bin/sh - + +echo 1>&2 "pkg-upgrade invoked with arguments \"$*\"." + +case $2 in + +PRE-UPGRADE) + ;; + +POST-UPGRADE) + ;; + +*) + echo "No clue what this script is meant to do when invoked with arguments \"$*\"." + #exit 1 + ;; + +esac diff --git a/buildtools/freebsd-skeleton/rpki-rp/Makefile b/buildtools/freebsd-skeleton/rpki-rp/Makefile index d55ed91d..86262666 100644 --- a/buildtools/freebsd-skeleton/rpki-rp/Makefile +++ b/buildtools/freebsd-skeleton/rpki-rp/Makefile @@ -6,6 +6,7 @@ DISTFILES= rpki-%(SVNBRANCH)s-r%(SVNVERSION)s.tar.xz WRKSRC= ${WRKDIR}/rpki-%(SVNBRANCH)s-r%(SVNVERSION)s MAINTAINER= sra@hactrn.net COMMENT= rpki.net RPKI relying party tools +WWW= http://rpki.net/ GNU_CONFIGURE= yes USE_PYTHON= 2.7+ @@ -41,10 +42,19 @@ CONFIGURE_ENV= CFLAGS="-I${LOCALBASE}/include" LDFLAGS="-L${LOCALBASE}/lib" pre-install: PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL - @if [ -f ${PREFIX}/etc/rcynic.conf ]; then ${MV} -f ${PREFIX}/etc/rcynic.conf ${PREFIX}/etc/rcynic.conf.real ; fi + @if test -f ${PREFIX}/etc/rcynic.conf; \ + then \ + ${MV} -f ${PREFIX}/etc/rcynic.conf ${PREFIX}/etc/rcynic.conf.real; \ + fi post-install: PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} POST-INSTALL - @if [ -f ${PREFIX}/etc/rcynic.conf.real ]; then ${MV} -f ${PREFIX}/etc/rcynic.conf ${PREFIX}/etc/rcynic.conf.sample ; ${MV} -f ${PREFIX}/etc/rcynic.conf.real ${PREFIX}/etc/rcynic.conf ; else ${CP} -p ${PREFIX}/etc/rcynic.conf ${PREFIX}/etc/rcynic.conf.sample ; fi + @if test -f ${PREFIX}/etc/rcynic.conf.real; \ + then \ + ${MV} -f ${PREFIX}/etc/rcynic.conf ${PREFIX}/etc/rcynic.conf.sample; \ + ${MV} -f ${PREFIX}/etc/rcynic.conf.real ${PREFIX}/etc/rcynic.conf; \ + else \ + ${CP} -p ${PREFIX}/etc/rcynic.conf ${PREFIX}/etc/rcynic.conf.sample; \ + fi .include <bsd.port.mk> diff --git a/buildtools/freebsd-skeleton/rpki-rp/pkg-deinstall b/buildtools/freebsd-skeleton/rpki-rp/pkg-deinstall index 31beff95..d5ffbd5b 100644 --- a/buildtools/freebsd-skeleton/rpki-rp/pkg-deinstall +++ b/buildtools/freebsd-skeleton/rpki-rp/pkg-deinstall @@ -3,9 +3,12 @@ case $2 in DEINSTALL) - if cmp -s /usr/local/etc/rcynic.conf.sample /usr/local/etc/rcynic.conf; then + + if cmp -s /usr/local/etc/rcynic.conf.sample /usr/local/etc/rcynic.conf + then rm -f /usr/local/etc/rcynic.conf fi + echo "Whacking rcynic's crontab" /usr/bin/crontab -l -u rcynic 2>/dev/null | /usr/bin/awk ' @@ -19,6 +22,7 @@ DEINSTALL) else system("/usr/bin/crontab -u rcynic -r"); }' + ;; POST-DEINSTALL) diff --git a/buildtools/freebsd-skeleton/rpki-rp/pkg-install b/buildtools/freebsd-skeleton/rpki-rp/pkg-install index aaf48c3c..9c60a7be 100644 --- a/buildtools/freebsd-skeleton/rpki-rp/pkg-install +++ b/buildtools/freebsd-skeleton/rpki-rp/pkg-install @@ -3,18 +3,22 @@ case $2 in PRE-INSTALL) - if /usr/sbin/pw groupshow "rcynic" 2>/dev/null; then + if /usr/sbin/pw groupshow "rcynic" 2>/dev/null + then echo "You already have a group \"rcynic\", so I will use it." - elif /usr/sbin/pw groupadd rcynic; then + elif /usr/sbin/pw groupadd rcynic + then echo "Added group \"rcynic\"." else echo "Adding group \"rcynic\" failed..." echo "Please create it, then try again." exit 1 fi - if /usr/sbin/pw usershow "rcynic" 2>/dev/null; then + if /usr/sbin/pw usershow "rcynic" 2>/dev/null + then echo "You already have a user \"rcynic\", so I will use it." - elif /usr/sbin/pw useradd rcynic -g rcynic -h - -d /nonexistant -s /usr/sbin/nologin -c "RPKI validation system"; then + elif /usr/sbin/pw useradd rcynic -g rcynic -h - -d /nonexistant -s /usr/sbin/nologin -c "RPKI validation system" + then echo "Added user \"rcynic\"." else echo "Adding user \"rcynic\" failed..." @@ -24,26 +28,32 @@ PRE-INSTALL) ;; POST-INSTALL) - if ! test -d /var/rcynic; then + if ! test -d /var/rcynic + then echo "Creating /var/rcynic" install -o root -g wheel -d /var/rcynic fi - for dir in /var/rcynic/data /var/rcynic/rpki-rtr; do - if ! test -d $dir; then + for dir in /var/rcynic/data /var/rcynic/rpki-rtr + do + if ! test -d $dir + then echo "Creating $dir" install -o rcynic -g rcynic -d /var/rcynic fi done - if test ! -f /usr/local/etc/rcynic.conf; then + if test ! -f /usr/local/etc/rcynic.conf + then cp -p /usr/local/etc/rcynic.conf.sample /usr/local/etc/rcynic.conf fi htmldir=/usr/local/www/apache22/data/rcynic - if ! test -d $htmldir ; then + if ! test -d $htmldir + then echo "Creating $htmldir" install -o rcynic -g rcynic -d $htmldir fi sockdir=/var/rcynic/rpki-rtr/sockets - if ! test -d $sockdir ; then + if ! test -d $sockdir + then echo "Creating $sockdir" install -o nobody -g rcynic -d $sockdir fi @@ -57,25 +67,31 @@ POST-INSTALL) /usr/bin/crontab -u rcynic - fi echo "Setting up rpki-rtr listener under inetd" - if /usr/bin/egrep -q '^rpki-rtr' /etc/services ; then + if /usr/bin/egrep -q '^rpki-rtr' /etc/services + then echo "You already have a /etc/services entry for rpki-rtr, so I will use it." - elif echo >>/etc/services "rpki-rtr 43779/tcp #RFC 6810" ; then + elif echo >>/etc/services "rpki-rtr 43779/tcp #RFC 6810" + then echo "Added rpki-rtr to /etc/services." else echo "Adding rpki-rtr to /etc/services failed, please fix this, then try again." exit 1 fi - if /usr/bin/egrep -q "rpki-rtr[ ]+stream[ ]+tcp[ ]" /etc/inetd.conf; then + if /usr/bin/egrep -q "rpki-rtr[ ]+stream[ ]+tcp[ ]" /etc/inetd.conf + then echo "You already have an inetd.conf entry for rpki-rtr on TCPv4, so I will use it." - elif echo >>/etc/inetd.conf "rpki-rtr stream tcp nowait nobody /usr/local/bin/rtr-origin rtr-origin --server /var/rcynic/rpki-rtr"; then + elif echo >>/etc/inetd.conf "rpki-rtr stream tcp nowait nobody /usr/local/bin/rtr-origin rtr-origin --server /var/rcynic/rpki-rtr" + then echo "Added rpki-rtr for TCPv4 to /etc/inetd.conf." else echo "Adding rpki-rtr for TCPv4 to /etc/inetd.conf failed, please fix this, then try again." exit 1 fi - if /usr/bin/egrep -q "rpki-rtr[ ]+stream[ ]+tcp6[ ]" /etc/inetd.conf; then + if /usr/bin/egrep -q "rpki-rtr[ ]+stream[ ]+tcp6[ ]" /etc/inetd.conf + then echo "You already have an inetd.conf entry for rpki-rtr on TCPv6, so I will use it." - elif echo >>/etc/inetd.conf "rpki-rtr stream tcp6 nowait nobody /usr/local/bin/rtr-origin rtr-origin --server /var/rcynic/rpki-rtr"; then + elif echo >>/etc/inetd.conf "rpki-rtr stream tcp6 nowait nobody /usr/local/bin/rtr-origin rtr-origin --server /var/rcynic/rpki-rtr" + then echo "Added rpki-rtr for TCPv6 to /etc/inetd.conf." else echo "Adding rpki-rtr for TCPv6 to /etc/inetd.conf failed, please fix this, then try again." diff --git a/buildtools/freebsd-skeleton/rpki-rp/pkg-upgrade b/buildtools/freebsd-skeleton/rpki-rp/pkg-upgrade new file mode 100644 index 00000000..f569a3d6 --- /dev/null +++ b/buildtools/freebsd-skeleton/rpki-rp/pkg-upgrade @@ -0,0 +1,18 @@ +#!/bin/sh - + +echo 1>&2 "pkg-upgrade invoked with arguments \"$*\"." + +case $2 in + +PRE-UPGRADE) + ;; + +POST-UPGRADE) + ;; + +*) + echo "No clue what this script is meant to do when invoked with arguments \"$*\"." + #exit 1 + ;; + +esac |