diff --git a/roles/shellserver/userland-software/account.sls b/roles/shellserver/userland-software/account.sls --- a/roles/shellserver/userland-software/account.sls +++ b/roles/shellserver/userland-software/account.sls @@ -32,3 +32,5 @@ - name: {{ dirs.etc }}/sudoers.d/builder - source: salt://roles/shellserver/userland-software/files/builder.sudoers - template: jinja + - context: + bindir: {{ dirs.bin }} diff --git a/roles/shellserver/userland-software/files/build-wraith b/roles/shellserver/userland-software/files/build-wraith new file mode 100644 --- /dev/null +++ b/roles/shellserver/userland-software/files/build-wraith @@ -0,0 +1,37 @@ +#!/bin/sh + +# ------------------------------------------------------------- +# Build wraith +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# Project: Eglide +# Created: 2017-02-23 +# License: Trivial work, not eligible to copyright +# ------------------------------------------------------------- + +TCL_VERSION=8.6 + +# ------------------------------------------------------------- +# Configure step +# +# This is the tricky part, as we need to provide path to TCL +# header and library files, heavily OS/distro/arch dependant. +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +OPENSSL_FLAGS=--with-openssl=/opt/openssl-legacy + +if [ -f /etc/debian_version ]; then + ARCH=`dpkg-architecture -qDEB_HOST_MULTIARCH` + ./configure --with-tclinc=/usr/include/tcl${TCL_VERSION}/tcl.h --with-tcllib=/usr/lib/$ARCH/libtcl${TCL_VERSION}.so --with-tcl=/usr/lib/$ARCH/tcl${TCL_VERSION} $OPENSSL_FLAGS +elif [ `uname` = "FreeBSD" ]; then + TCL_VERSION_LIB=`echo $TCL_VERSION | tr -d .` + ./configure --with-tclinc=/usr/local/include/tcl${TCL_VERSION}/tcl.h -with-tcllib=/usr/local/lib/libtcl${TCL_VERSION_LIB}.so --with-tcl=/usr/local/lib/tcl${TCL_VERSION} $OPENSSL_FLAGS +else + ./configure $OPENSSL_FLAGS +fi + +# ------------------------------------------------------------- +# Build, install +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + +make +sudo cp wraith {{ bindir }} diff --git a/roles/shellserver/userland-software/files/builder.sudoers b/roles/shellserver/userland-software/files/builder.sudoers --- a/roles/shellserver/userland-software/files/builder.sudoers +++ b/roles/shellserver/userland-software/files/builder.sudoers @@ -15,3 +15,4 @@ # %deployment ALL=(builder) NOPASSWD: ALL +%deployment ALL= NOPASSWD: /bin/cp wraith {{ bindir }} diff --git a/roles/shellserver/userland-software/irc.sls b/roles/shellserver/userland-software/irc.sls --- a/roles/shellserver/userland-software/irc.sls +++ b/roles/shellserver/userland-software/irc.sls @@ -38,6 +38,9 @@ # Bots # ------------------------------------------------------------- +include: + - .wraith + eggdrop_installer: file.managed: - name: /usr/local/bin/install-eggdrop diff --git a/roles/shellserver/userland-software/wraith.sls b/roles/shellserver/userland-software/wraith.sls new file mode 100644 --- /dev/null +++ b/roles/shellserver/userland-software/wraith.sls @@ -0,0 +1,49 @@ +# ------------------------------------------------------------- +# Salt — Deploy Wraith +# - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +# Project: Eglide +# Created: 2017-02-23 +# License: Trivial work, not eligible to copyright +# ------------------------------------------------------------- + +{% from "map.jinja" import dirs with context %} + +# ------------------------------------------------------------- +# Dependencies +# ------------------------------------------------------------- + +include: + - roles/shellserver/userland-software/openssl-legacy + +# ------------------------------------------------------------- +# Source code +# ------------------------------------------------------------- + +wraith_repo: + file.directory: + - name: /opt/wraith + - user: builder + - group: deployment + - dir_mode: 755 + git.latest: + - name: https://github.com/eglide/wraith.git + - branch: production + - submodules: True + - target: /opt/wraith + - user: builder + - unless: test -f /opt/wraith/LOCKED + +# ------------------------------------------------------------- +# Build +# ------------------------------------------------------------- + +wraith_build: + cmd.script: + - source: salt://roles/shellserver/userland-software/files/build-wraith + - template: jinja + - context: + bindir: {{ dirs.bin }} + - cwd: /opt/wraith + - runas: builder + - require: + - git: wraith_repo