From e6a2556ddea975a3f03db517a30d02d9d6620aca Mon Sep 17 00:00:00 2001 From: Rob Austein Date: Thu, 19 Sep 2013 22:17:09 +0000 Subject: Apache-version-agnosticism, part 1: fix autoconf, FreeBSD port skeleton, rcynic-cron. rpkigui-apache-confgen still needs work to support 2.4 syntax, but we should be tracking the Apache version number correctly for the version-dependent pathnames on FreeBSD. See #616. svn path=/trunk/; revision=5501 --- buildtools/build-freebsd-ports.py | 2 +- buildtools/freebsd-skeleton/rpki-ca/Makefile | 2 +- buildtools/freebsd-skeleton/rpki-rp/Makefile | 7 +- .../freebsd-skeleton/rpki-rp/files/pkg-install.in | 128 +++++++++++++++++++++ buildtools/freebsd-skeleton/rpki-rp/pkg-install | 128 --------------------- 5 files changed, 136 insertions(+), 131 deletions(-) create mode 100644 buildtools/freebsd-skeleton/rpki-rp/files/pkg-install.in delete mode 100644 buildtools/freebsd-skeleton/rpki-rp/pkg-install (limited to 'buildtools') diff --git a/buildtools/build-freebsd-ports.py b/buildtools/build-freebsd-ports.py index c3ca0eef..b560498c 100644 --- a/buildtools/build-freebsd-ports.py +++ b/buildtools/build-freebsd-ports.py @@ -114,7 +114,7 @@ etc/rcynic.conf.sample f.write('''\ @dirrm etc/rpki/trust-anchors @dirrmtry etc/rpki -@dirrm www/apache22/data/rcynic +@dirrm www/apache%%APACHE_VERSION%%/data/rcynic @cwd / @dirrm var/rcynic/data @dirrm var/rcynic/rpki-rtr/sockets diff --git a/buildtools/freebsd-skeleton/rpki-ca/Makefile b/buildtools/freebsd-skeleton/rpki-ca/Makefile index c953e037..350b3fb1 100644 --- a/buildtools/freebsd-skeleton/rpki-ca/Makefile +++ b/buildtools/freebsd-skeleton/rpki-ca/Makefile @@ -42,7 +42,7 @@ RUN_DEPENDS+= ${APACHE_PKGNAMEPREFIX}mod_wsgi>3:${PORTSDIR}/www/mod_wsgi3 # Try to use system OpenSSL if we can. CONFIGURE_ENV= CFLAGS="-I${LOCALBASE}/include" LDFLAGS="-L${LOCALBASE}/lib" -CONFIGURE_ARGS= --disable-target-installation --disable-rp-tools +CONFIGURE_ARGS= --disable-target-installation --disable-rp-tools APACHE_VERSION=${APACHE_VERSION} pre-install: PKG_PREFIX=${PREFIX} ${SH} ${PKGINSTALL} ${PKGNAME} PRE-INSTALL diff --git a/buildtools/freebsd-skeleton/rpki-rp/Makefile b/buildtools/freebsd-skeleton/rpki-rp/Makefile index 5511ba09..06531351 100644 --- a/buildtools/freebsd-skeleton/rpki-rp/Makefile +++ b/buildtools/freebsd-skeleton/rpki-rp/Makefile @@ -11,6 +11,11 @@ WWW= http://rpki.net/ GNU_CONFIGURE= yes USE_PYTHON= 2.7+ USE_GNOME= libxml2 libxslt +USE_APACHE_RUN= 22+ + +SUB_FILES= pkg-install +SUB_LIST= APACHE_VERSION=${APACHE_VERSION} +PLIST_SUB= APACHE_VERSION=${APACHE_VERSION} # For OpenSSL, not needed otherwise USE_PERL5_BUILD=yes @@ -28,7 +33,7 @@ RUN_DEPENDS+= rrdtool>0:${PORTSDIR}/databases/rrdtool # Just want relying party tools, try to use system OpenSSL if we can. -CONFIGURE_ARGS= --disable-ca-tools +CONFIGURE_ARGS= --disable-ca-tools APACHE_VERSION=${APACHE_VERSION} CONFIGURE_ENV= CFLAGS="-I${LOCALBASE}/include" LDFLAGS="-L${LOCALBASE}/lib" MAKE_JOBS_UNSAFE= yes diff --git a/buildtools/freebsd-skeleton/rpki-rp/files/pkg-install.in b/buildtools/freebsd-skeleton/rpki-rp/files/pkg-install.in new file mode 100644 index 00000000..730a85b9 --- /dev/null +++ b/buildtools/freebsd-skeleton/rpki-rp/files/pkg-install.in @@ -0,0 +1,128 @@ +#!/bin/sh - + +case $2 in + +PRE-INSTALL) + 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 + 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 + 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 + echo "Added user \"rcynic\"." + else + echo "Adding user \"rcynic\" failed..." + echo "Please create it, then try again." + exit 1 + fi + if /usr/sbin/pw groupshow "rpkirtr" 2>/dev/null + then + echo "You already have a group \"rpkirtr\", so I will use it." + elif /usr/sbin/pw groupadd rpkirtr + then + echo "Added group \"rpkirtr\"." + else + echo "Adding group \"rpkirtr\" failed..." + echo "Please create it, then try again." + exit 1 + fi + if /usr/sbin/pw usershow "rpkirtr" 2>/dev/null + then + echo "You already have a user \"rpkirtr\", so I will use it." + elif /usr/sbin/pw useradd rpkirtr -g rpkirtr -h - -d /nonexistant -s /usr/sbin/nologin -c "RPKI router server" + then + echo "Added user \"rpkirtr\"." + else + echo "Adding user \"rpkirtr\" failed..." + echo "Please create it, then try again." + exit 1 + fi + ;; + +POST-INSTALL) + if ! test -d /var/rcynic + then + echo "Creating /var/rcynic" + /usr/bin/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 + echo "Creating $dir" + /usr/bin/install -o rcynic -g rcynic -d /var/rcynic + fi + done + if ! test -d /var/rcynic/rpki-rtr/sockets + then + echo "Creating /var/rcynic/rpki-rtr/sockets" + /usr/bin/install -o rpkirtr -g rcynic -m 775 -d /var/rcynic/rpki-rtr/sockets + fi + if test ! -f /usr/local/etc/rcynic.conf + then + /bin/cp -p /usr/local/etc/rcynic.conf.sample /usr/local/etc/rcynic.conf + fi + htmldir=/usr/local/www/apache%%APACHE_VERSION%%/data/rcynic + if ! test -d $htmldir + then + echo "Creating $htmldir" + /usr/bin/install -o rcynic -g rcynic -d $htmldir + fi + if test "X`/usr/bin/crontab -l -u rcynic 2>/dev/null`" != "X" + then + echo "rcynic user already has a crontab, leaving it alone" + else + echo "Setting up rcynic's crontab to run rcynic-cron script" + /usr/bin/awk -v t=`/usr/bin/hexdump -n 2 -e '"%u\n"' /dev/random` ' + BEGIN {printf "MAILTO=root\n%u * * * *\texec /usr/local/bin/rcynic-cron\n", t % 60}' | + /usr/bin/crontab -u rcynic - + fi + echo "Setting up rpki-rtr listener under inetd" + 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 + 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 + 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 rpkirtr /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 + 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 rpkirtr /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." + exit 1 + fi + ;; + +*) + echo "No clue what this script is meant to do when invoked with arguments \"$*\". Punting." + exit 1 + ;; + +esac diff --git a/buildtools/freebsd-skeleton/rpki-rp/pkg-install b/buildtools/freebsd-skeleton/rpki-rp/pkg-install deleted file mode 100644 index 8c552016..00000000 --- a/buildtools/freebsd-skeleton/rpki-rp/pkg-install +++ /dev/null @@ -1,128 +0,0 @@ -#!/bin/sh - - -case $2 in - -PRE-INSTALL) - 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 - 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 - 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 - echo "Added user \"rcynic\"." - else - echo "Adding user \"rcynic\" failed..." - echo "Please create it, then try again." - exit 1 - fi - if /usr/sbin/pw groupshow "rpkirtr" 2>/dev/null - then - echo "You already have a group \"rpkirtr\", so I will use it." - elif /usr/sbin/pw groupadd rpkirtr - then - echo "Added group \"rpkirtr\"." - else - echo "Adding group \"rpkirtr\" failed..." - echo "Please create it, then try again." - exit 1 - fi - if /usr/sbin/pw usershow "rpkirtr" 2>/dev/null - then - echo "You already have a user \"rpkirtr\", so I will use it." - elif /usr/sbin/pw useradd rpkirtr -g rpkirtr -h - -d /nonexistant -s /usr/sbin/nologin -c "RPKI router server" - then - echo "Added user \"rpkirtr\"." - else - echo "Adding user \"rpkirtr\" failed..." - echo "Please create it, then try again." - exit 1 - fi - ;; - -POST-INSTALL) - if ! test -d /var/rcynic - then - echo "Creating /var/rcynic" - /usr/bin/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 - echo "Creating $dir" - /usr/bin/install -o rcynic -g rcynic -d /var/rcynic - fi - done - if ! test -d /var/rcynic/rpki-rtr/sockets - then - echo "Creating /var/rcynic/rpki-rtr/sockets" - /usr/bin/install -o rpkirtr -g rcynic -m 775 -d /var/rcynic/rpki-rtr/sockets - fi - if test ! -f /usr/local/etc/rcynic.conf - then - /bin/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 - echo "Creating $htmldir" - /usr/bin/install -o rcynic -g rcynic -d $htmldir - fi - if test "X`/usr/bin/crontab -l -u rcynic 2>/dev/null`" != "X" - then - echo "rcynic user already has a crontab, leaving it alone" - else - echo "Setting up rcynic's crontab to run rcynic-cron script" - /usr/bin/awk -v t=`/usr/bin/hexdump -n 2 -e '"%u\n"' /dev/random` ' - BEGIN {printf "MAILTO=root\n%u * * * *\texec /usr/local/bin/rcynic-cron\n", t % 60}' | - /usr/bin/crontab -u rcynic - - fi - echo "Setting up rpki-rtr listener under inetd" - 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 - 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 - 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 rpkirtr /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 - 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 rpkirtr /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." - exit 1 - fi - ;; - -*) - echo "No clue what this script is meant to do when invoked with arguments \"$*\". Punting." - exit 1 - ;; - -esac -- cgit v1.2.3