#!/bin/sh # # example start script to run a local cryptobox webserver # # We set some parameters to make it possible to run it without an # existing cryptobox installation. # # Change your local settings in "cryptobox-local.conf" - if this file # does not exist, then "cryptobox.conf" is used. # # Use the environment variable PORT to override the default port # (8080). # # BEWARE: the super.tab entry must be named "CryptoBoxRootActionsLocal" # instead of "CryptoBoxRootActions" (useful for development) # BIN_DIR=$(dirname "$0") BIN_DIR=$(cd "$BIN_DIR"; pwd) PREFERRED_CONF_FILE=$BIN_DIR/cryptobox-local.conf FALLBACK_CONF_FILE=$BIN_DIR/cryptobox-unittests.conf ## disable ssl detection #export HTTPS=1 disable_filecheck() { sed -i "s/^OVERRIDE_FILECHECK = .*$/OVERRIDE_FILECHECK = True/" "$BIN_DIR/CryptoBoxRootActions" } enable_filecheck() { sed -i "s/^OVERRIDE_FILECHECK = .*$/OVERRIDE_FILECHECK = False/" "$BIN_DIR/CryptoBoxRootActions" } ## add the local python directory to the search path export PYTHONPATH="$BIN_DIR/../src" ## determine the configuration file CONFIG_FILE=$FALLBACK_CONF_FILE if [ -r "$PREFERRED_CONF_FILE" ] ; then CONFIG_FILE=$PREFERRED_CONF_FILE fi echo "used config: $CONFIG_FILE" ## create necessary directories mkdir -p "$BIN_DIR/../ttt/mnt" mkdir -p "$BIN_DIR/../ttt/settings" cd "$BIN_DIR" # disable strict security checks of CryptoBoxRootActions disable_filecheck ## run the webserver "$BIN_DIR/CryptoBoxWebserver" --config="$CONFIG_FILE" \ --port=${PORT:-8080} \ --pidfile=/tmp/cryptoboxwebserver.pid \ --logfile=/tmp/cryptoboxwebserver.log \ --datadir="$BIN_DIR/../www-data" "$@" # enable strict security checks of CryptoBoxRootActions again enable_filecheck