diff options
-rwxr-xr-x | setup.py | 57 | ||||
-rwxr-xr-x | tools/build-on-freebsd | 19 |
2 files changed, 37 insertions, 39 deletions
@@ -77,6 +77,14 @@ INITSYS_ROOTS = { } INITSYS_TYPES = sorted(list(INITSYS_ROOTS.keys())) +# Install everything in the right location and take care of Linux (default) and +# FreeBSD systems. +USR = "/usr" +ETC = "/etc" +if os.uname()[0] == 'FreeBSD': + USR = "/usr/local" + ETC = "/usr/local/etc" + def get_version(): cmd = ['tools/read-version'] @@ -90,41 +98,6 @@ def read_requires(): return str(deps).splitlines() -# Install everything in the right location and take care of Linux (default) and -# FreeBSD systems. -def read_datafiles(): - sysname = os.uname()[0] - if sysname == 'FreeBSD': - return [ - ('/usr/local/etc/cloud', glob('config/*.cfg')), - ('/usr/local/etc/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')), - ('/usr/local/etc/cloud/templates', glob('templates/*')), - ('/usr/local/lib/cloud-init', - ['tools/uncloud-init', 'tools/write-ssh-key-fingerprints']), - ('/usr/local/share/doc/cloud-init', - [f for f in glob('doc/*') if is_f(f)]), - ('/usr/local/share/doc/cloud-init/examples', - [f for f in glob('doc/examples/*') if is_f(f)]), - ('/usr/local/share/doc/cloud-init/examples/seed', - [f for f in glob('doc/examples/seed/*') if is_f(f)]), - ] - else: - return [ - ('/etc/cloud', glob('config/*.cfg')), - ('/etc/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')), - ('/etc/cloud/templates', glob('templates/*')), - ('/usr/share/cloud-init', []), - ('/usr/lib/cloud-init', - ['tools/uncloud-init', 'tools/write-ssh-key-fingerprints']), - ('/usr/share/doc/cloud-init', - [f for f in glob('doc/*') if is_f(f)]), - ('/usr/share/doc/cloud-init/examples', - [f for f in glob('doc/examples/*') if is_f(f)]), - ('/usr/share/doc/cloud-init/examples/seed', - [f for f in glob('doc/examples/seed/*') if is_f(f)]), - ] - - # TODO: Is there a better way to do this?? class InitsysInstallData(install): init_system = None @@ -173,7 +146,19 @@ setuptools.setup(name='cloud-init', 'tools/cloud-init-per', ], license='GPLv3', - data_files=read_datafiles(), + data_files=[(ETC '/cloud', glob('config/*.cfg')), + (ETC '/cloud/cloud.cfg.d', glob('config/cloud.cfg.d/*')), + (ETC '/cloud/templates', glob('templates/*')), + (USR '/lib/cloud-init', + ['tools/uncloud-init', + 'tools/write-ssh-key-fingerprints']), + (USR '/share/doc/cloud-init', + [f for f in glob('doc/*') if is_f(f)]), + (USR '/share/doc/cloud-init/examples', + [f for f in glob('doc/examples/*') if is_f(f)]), + (USR '/share/doc/cloud-init/examples/seed', + [f for f in glob('doc/examples/seed/*') if is_f(f)]), + ], install_requires=read_requires(), cmdclass={ # Use a subclass for install that handles diff --git a/tools/build-on-freebsd b/tools/build-on-freebsd index 6a3f38ec..66b95d68 100755 --- a/tools/build-on-freebsd +++ b/tools/build-on-freebsd @@ -3,8 +3,22 @@ # installing cloud-init. This script takes care of building and installing. It # will optionally make a first run at the end. +fail() { echo "FAILED:" "$@" 1>&2; exit 1; } + # Check dependencies: -[ ! -f /tmp/c-i.dependencieschecked ] && pkg install python py27-cheetah py27-Jinja2 py27-prettytable py27-oauth py27-serial py27-configobj py27-yaml py27-argparse py27-requests py27-six py27-boto gpart sudo dmidecode +depscheck=/tmp/c-i.dependencieschecked +pkgs=" + dmidecode + py27-argparse + py27-boto gpart sudo + py27-configobj py27-yaml + py27-Jinja2 + py27-oauth py27-serial + py27-prettytable + py27-requests py27-six + python py27-cheetah +" +[ -f "$depschecked" ] || pkg install ${pkgs} || fail "install packages" touch /tmp/c-i.dependencieschecked # Required but unavailable port/pkg: py27-jsonpatch py27-jsonpointer @@ -23,8 +37,7 @@ echo 'cloudinit_enable="YES"' >> /etc/rc.conf echo "Installation completed." -if [ "$1" = "run" ] -then +if [ "$1" = "run" ]; then echo "Ok, now let's see if it works." # Backup SSH keys |