#!/bin/sh PREFIX="/usr/local" BINDIR="${PREFIX}/bin" BINDIR_SET=0 PLUGINDIR="${PREFIX}/lib/eurephia" PLUGINDIR_SET=0 XSLTPATH="${PREFIX}/share/eurephia/xslt" XSLTPATH_SET=0 EUREPHIADM_XSLT="${XSLTPATH}/eurephiadm" EUREPHIADM_XSLT_SET=0 SQLITE3PREFIX="/etc/openvpn" usage() { cat < -- Root directory of installation (default: ${PREFIX}) --bin-dir -- Directory where to place binaries (default: ${BINDIR}) --xslt-path | -X -- Default XSLT path (default: ${XSLTPATH}) ** Debug options --debug | -D -- Enable verbose debug logging --show-secrets | -S -- Log passwords as clear text in log files | (only available when debug is enabled) ** Plug-in options --plug-in | -p -- Build the eurephia plug-in for OpenVPN --plug-in-dir | -P -- Destination path for the plug-ins and other modules (default: ${PLUGINDIR}) --openvpn-src | -s -- OpenVPN source directory (needed when building plug-in) --fw-iptables | -- Build iptables firewall module ** Database options --db-sqlite3 | -- Build SQLite3 database module --sqlite3-path | -sp -- Root directory of SQLite3 eurephia database file (default: ${SQLITE3PREFIX}) ** Administration utility options --eurephiadm | -A -- Build command line admin utility --eurephiadm-fw -- Include the firewall info even without any firewall interface being built --eurephiadm-xslt -- eurephiadm XSLT root path (default: ${EUREPHIADM_XSLT}) EOF } PARAMS="" DB="" FW="" ADMIN=""; OPENVPN_SRC_DIR="" PLUGIN="" while [ ! -z "$1" ]; do case $1 in -h|--help) usage exit 0 ;; --prefix) PREFIX="$2"; shift if [ "${BINDIR_SET}" = "0" ]; then BINDIR="${PREFIX}/bin"; fi if [ "${PLUGINDIR_SET}" = "0" ]; then PLUGINDIR="${PREFIX}/lib/eurephia" fi if [ "${XSLTPATH_SET}" = "0" ]; then XSLTPATH="${PREFIX}/share/eurephia/xslt" if [ "${EUREPHIADM_XSLT_SET}" = "0" ]; then EUREPHIADM_XSLT="${XSLTPATH}/eurephiadm" fi fi ;; --bin-dir) BINDIR="$2" BINDIR_SET=1 shift ;; -X|--xslt-path) XSLTPATH="$2" if [ "${EUREPHIADM_XSLT_SET}" = "0" ]; then EUREPHIADM_XSLT="${XSLTPATH}/eurephiadm" fi shift ;; -D|--debug) PARAMS="${PARAMS} -DDEBUG=ON" DEBUG_WARN=1 ;; -S|--show-secrets) PARAMS="${PARAMS} -DSHOW_SECRETS=ON" SECRETS_WARN=1 ;; -p|--plug-in) PARAMS="${PARAMS} -DPLUGIN=ON" PLUGIN="eurephia-auth" ;; -P|--plug-in-dir) PLUGINDIR="$2" PLUGINDIR_SET=1 shift ;; -s|--openvpn-src) OPENVPN_SRC_DIR="$2" PARAMS="${PARAMS} -DOPENVPN_SRC:STRING=$2" shift ;; --fw-iptables) PARAMS="${PARAMS} -DFW_IPTABLES=ON" FW="iptables " ;; --db-sqlite3) PARAMS="${PARAMS} -DSQLITE3=ON" DB="SQLite3 " ;; --sp|--sqlite3-path) SQLITE3PREFIX="$2" shift ;; --eurephiadm|-A) PARAMS="${PARAMS} -DEUREPHIADM=ON" ADMIN="${ADMIN}eurephiadm " ;; --eurephiadm-fw) PARAMS="${PARAMS} -DFIREWALL=ON" ;; --eurephiadm-xslt) EUREPHIADM_XSLT="$2" EUREPHIADM_XSLT_SET=1 shift ;; *) echo "Unkown option: $1" exit 2 ;; esac shift done if [ -z "$(which cmake)" ]; then echo "To build eurephia, you need to install cmake (at least version 2.6)" exit 1; fi if [ ! -z "${PLUGIN}" -a -z "${OPENVPN_SRC_DIR}" ]; then echo "You need to give the --openvpn-src option when building the eurephia plug-in" exit 1; fi if [ -z "${DB}" ]; then echo "You need to activate at least one database driver" exit 1; fi if [ ${DB} = "SQLite3" ]; then PARAMS="${PARAMS} -DSQLITE3PREFIX:STIRNG=${SQLITE3PREFIX}" fi rm -f CMakeCache.txt cmake . ${PARAMS} -DPREFIX:STRING=${PREFIX} -DCMAKE_INSTALL_PREFIX:STRING=${PREFIX} \ -DPLUGINDIR:STRING=${PLUGINDIR} -DBINDIR:STRING=${BINDIR} \ -DEUREPHIADM_XSLT_PATH:STRING=${EUREPHIADM_XSLT} -DXSLTROOT:STRING=${XSLTPATH} echo $PARAMS ec=$? if [ $ec = 0 ]; then echo echo echo "eurephia will be built with support for: " echo echo " Database: ${DB}" echo " Firewall: ${FW:-"None"}" echo " OpenVPN plug-in: ${PLUGIN:-"No plug-ins requested"}" echo " Admin tools: ${ADMIN:-"None"}" echo echo " Install prefix: ${PREFIX}" echo " Binaries dir: ${BINDIR}" echo " Plug-in path: ${PLUGINDIR}" if [ ! -z "${ADMIN}" ]; then echo " XSLT base path: ${XSLTPATH}" echo " eurephiadm XSLT path: ${EUREPHIADM_XSLT}" fi if [ ${DB} = "SQLite3" ]; then echo " SQLite3 database path: ${SQLITE3PREFIX}" fi echo echo if [ "$DEBUG_WARN" = 1 ]; then echo echo " ******* DEBUG is enabled. This might be a security issue *******" echo if [ "$SECRETS_WARN" = 1 ]; then echo echo " ******* SHOW_SECRETS is enabled. THIS WILL LOG PASSWORDS IN CLEAR TEXT IN LOG FILES *******" echo fi fi # Update Makefile with distclean and uninstall rules cat >> Makefile <> Makefile <> Makefile <