diff options
-rw-r--r-- | buildtools/build-freebsd-ports.py | 20 | ||||
-rw-r--r-- | buildtools/freebsd-skeleton/rpki-ca/pkg-deinstall | 19 | ||||
-rw-r--r-- | buildtools/freebsd-skeleton/rpki-ca/pkg-install | 34 | ||||
-rw-r--r-- | buildtools/freebsd-skeleton/rpki-rp/pkg-deinstall | 3 | ||||
-rw-r--r-- | buildtools/freebsd-skeleton/rpki-rp/pkg-install | 13 |
5 files changed, 69 insertions, 20 deletions
diff --git a/buildtools/build-freebsd-ports.py b/buildtools/build-freebsd-ports.py index 1a324779..d73f9aef 100644 --- a/buildtools/build-freebsd-ports.py +++ b/buildtools/build-freebsd-ports.py @@ -105,9 +105,7 @@ bin/rcynic-text bin/rtr-origin bin/scan_roas bin/validation_status -@unexec if cmp -s %D/etc/rcynic.conf.sample %D/etc/rcynic.conf; then rm -f %D/etc/rcynic.conf; fi etc/rcynic.conf.sample -@exec if [ ! -f %D/etc/rcynic.conf ] ; then cp -p %D/%F %D/etc/rcynic.conf; fi ''') for trust_anchor in sorted(trust_anchors): @@ -118,10 +116,7 @@ etc/rcynic.conf.sample @dirrmtry etc/rpki @dirrm www/apache22/data/rcynic @cwd / -@exec install -d -o root -g wheel %D/var/rcynic -@exec install -d -o rcynic -g rcynic %D/var/rcynic/data @dirrm var/rcynic/data -@exec install -d -o rcynic -g rcynic %D/var/rcynic/rpki-rtr @dirrm var/rcynic/rpki-rtr/sockets @dirrm var/rcynic/rpki-rtr @dirrm var/rcynic @@ -158,23 +153,8 @@ with open(os.path.join(base_ca, "pkg-plist"), "w") as f: f.write("@cwd /\n") usr_local = False - if not dirnames and not filenames: - f.write("@exec mkdir -p %%D/%s\n" % dn) - for fn in filenames: - if dn == "etc" and fn == "rpki.conf.sample": - f.write("@unexec if cmp -s %D/etc/rpki.conf.sample %D/etc/rpki.conf; then rm -f %D/etc/rpki.conf; fi\n") f.write(os.path.join(dn, fn) + "\n") - if dn == "etc" and fn == "rpki.conf.sample": - f.write("@exec %D/sbin/rpki-confgen" - " --read-xml %D/etc/rpki/rpki-confgen.xml" - " --autoconf" - " --set myrpki::handle=`/bin/hostname -f | /usr/bin/sed 's/[.]/_/g'`" - " --set myrpki::rpkid_server_host=`/bin/hostname -f`" - " --set myrpki::pubd_server_host=`/bin/hostname -f`" - " --set web_portal::secret-key=`%D/bin/python -c 'import random, string; print \"\".join(random.choice(string.uppercase + string.lowercase + string.digits) for _ in xrange(50))'`" - " --write-conf %D/etc/rpki.conf.sample\n") - f.write("@exec if [ ! -f %D/etc/rpki.conf ] ; then cp -p %D/etc/rpki.conf.sample %D/etc/rpki.conf; fi\n") if dn and dn not in dont_remove: f.write("@dirrm %s\n" % dn) diff --git a/buildtools/freebsd-skeleton/rpki-ca/pkg-deinstall b/buildtools/freebsd-skeleton/rpki-ca/pkg-deinstall new file mode 100644 index 00000000..e06dff53 --- /dev/null +++ b/buildtools/freebsd-skeleton/rpki-ca/pkg-deinstall @@ -0,0 +1,19 @@ +#!/bin/sh - + +case $2 in + +DEINSTALL) + if cmp -s /usr/local/etc/rpki.conf.sample /usr/local/etc/rpki.conf; then + rm -f /usr/local/etc/rpki.conf + fi + ;; + +POST-DEINSTALL) + ;; + +*) + 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-ca/pkg-install b/buildtools/freebsd-skeleton/rpki-ca/pkg-install new file mode 100644 index 00000000..092d5482 --- /dev/null +++ b/buildtools/freebsd-skeleton/rpki-ca/pkg-install @@ -0,0 +1,34 @@ +#!/bin/sh - + +case $2 in + +PRE-INSTALL) + ;; + +POST-INSTALL) + + hostname=`hostname` + handle=`hostname | sed 's/[.]/_/g'` + /usr/local/sbin/rpki-confgen \ + --read-xml /usr/local/etc/rpki/rpki-confgen.xml \ + --autoconf \ + --set myrpki::handle="$handle" \ + --set myrpki::rpkid_server_host="$hostname" \ + --set myrpki::pubd_server_host="$hostname" \ + --pwgen myrpki::shared_sql_password \ + --pwgen web_portal::secret-key \ + --write-conf /usr/local/etc/rpki.conf.sample + + 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 + ;; + +*) + 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-deinstall b/buildtools/freebsd-skeleton/rpki-rp/pkg-deinstall index 2e87170b..31beff95 100644 --- a/buildtools/freebsd-skeleton/rpki-rp/pkg-deinstall +++ b/buildtools/freebsd-skeleton/rpki-rp/pkg-deinstall @@ -3,6 +3,9 @@ case $2 in DEINSTALL) + 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 ' diff --git a/buildtools/freebsd-skeleton/rpki-rp/pkg-install b/buildtools/freebsd-skeleton/rpki-rp/pkg-install index 820e4db3..aaf48c3c 100644 --- a/buildtools/freebsd-skeleton/rpki-rp/pkg-install +++ b/buildtools/freebsd-skeleton/rpki-rp/pkg-install @@ -24,6 +24,19 @@ PRE-INSTALL) ;; POST-INSTALL) + 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 + echo "Creating $dir" + install -o rcynic -g rcynic -d /var/rcynic + fi + done + 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 echo "Creating $htmldir" |