#!/bin/sh usage() { cat < -- Root directory of installation (default: /etc/openvpn/eurephia) --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 | -p -- Build the eurephia plug-in for OpenVPN --openvpn-src | -s -- OpenVPN source directory (needed when building plug-in) --fw-iptables | -- Build iptables firewall module --db-sqlite3 | -- Build SQLite3 database module --sqlite3-prefix | -sp -- Root directory of SQLite3 eurephia database (default: /etc/openvpn) --eurephiadm | -A -- Build command line admin utility --eurephiadm-fw -- Include the firewall info even without any firewall interface being built EOF } PARAMS="" DB="" FW="" ADMIN=""; OPENVPN_SRC_DIR="" PREFIX="/etc/openvpn/eurephia" SQLITE3PREFIX="/etc/openvpn" PLUGIN="" while [ ! -z "$1" ]; do case $1 in -h|--help) usage exit 0 ;; --prefix) PREFIX="$2"; 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" ;; -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-prefix) SQLITE3PREFIX="$2" shift ;; --eurephiadm|-A) PARAMS="${PARAMS} -DEUREPHIADM=ON" ADMIN="${ADMIN}eurephiadm " ;; --eurephiadm-fw) PARAMS="${PARAMS} -DFIREWALL=ON" ;; *) 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} 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}" 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 <