summaryrefslogtreecommitdiff
path: root/tools
diff options
context:
space:
mode:
authorHarm Weites <harm@weites.com>2014-08-09 10:27:28 +0000
committerHarm Weites <harm@weites.com>2014-08-09 10:27:28 +0000
commitd2d12dda2ddd576504adc32f71944eab72d6481a (patch)
tree0098adf4eba63c858c3abc05b5492ae058e8cbe9 /tools
parentc08262be060f6a4e89c94f81f83d7e884b66a5cf (diff)
downloadvyos-cloud-init-d2d12dda2ddd576504adc32f71944eab72d6481a.tar.gz
vyos-cloud-init-d2d12dda2ddd576504adc32f71944eab72d6481a.zip
new: Buildscript for installing on FreeBSD. This should do until a
proper port is created.
Diffstat (limited to 'tools')
-rwxr-xr-xtools/build-on-freebsd40
1 files changed, 40 insertions, 0 deletions
diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd
new file mode 100755
index 00000000..03cba7fc
--- /dev/null
+++ b/tools/build-on-freebsd
@@ -0,0 +1,40 @@
+#!/bin/sh
+# Since there is no official FreeBSD port yet, we need some way of building and
+# installing cloud-init. This script takes care of building and installing. It
+# will optionally make a first run at the end.
+
+# Check dependencies:
+[ ! -f /tmp/c-i.dependencieschecked ] && pkg install py27-cheetah py27-Jinja2 py27-prettytable py27-oauth py27-serial py27-configobj py27-yaml py27-argparse py27-requests py27-six
+touch /tmp/c-i.dependencieschecked
+
+# Required but unavailable port/pkg: py27-jsonpatch
+# Luckily, the install step will take care of this by installing it from pypi...
+
+# Build the code and install in /usr/local/:
+python setup.py build
+python setup.py install -O1 --skip-build --prefix /usr/local/ --init-system sysvinit_freebsd
+
+# Move the configdir to /usr/local/ and use freebsd.cfg:
+[ -d /usr/local/etc/cloud ] && rm -rf /usr/local/etc/cloud
+mv /etc/cloud /usr/local/etc/
+mv /usr/local/etc/cloud/cloud.freebsd.cfg /usr/local/etc/cloud/cloud.cfg
+
+# Enable cloud-init in /etc/rc.conf:
+sed -i.bak -e "/cloudinit_enable=.*/d" /etc/rc.conf
+echo 'cloudinit_enable="YES"' >> /etc/rc.conf
+
+echo "Installation completed."
+
+if [ "$1" = "run" ]
+then
+ echo "Ok, now let's see if it works."
+
+ # Remove old metadata
+ rm -rf /var/lib/cloud
+
+ # Just log everything, quick&dirty
+ rm /usr/local/etc/cloud/cloud.cfg.d/05_logging.cfg
+
+ # Start:
+ /usr/local/etc/rc.d/cloudinit start
+fi