#!/bin/sh DEST_PATH="/etc/dansguardian" CONF_PATH="guard/config" TEMPLATES_DIR="templates" VAR_LIST="PROXY_HTTP_PORT PROXY_HOST GUARD_PORT GUARD_HOST" . /usr/share/llxcfg-guard/llxcfg-guard-common llxcfg-systemvars add GUARD_CURRENT_PROFILE="$GUARD_CURRENT_PROFILE" set_naughty_limit eval "$(llxcfg-showvars $VAR_LIST)" [ "$PROXY_HTTP_PORT" -a "$PROXY_HOST" -a "$GUARD_PORT" ] || exit 1 # generate default LliureX configuration for dansguardian for f in $(llxcfg-config list "$CONF_PATH") ; do llxcfg-config read "$CONF_PATH/$f" | skel-install -t "$DEST_PATH/$f" done # install profile-specific configuration for dansguardian (if exists) if [ -d "$GUARD_CURRENT_PROFILE/config" ] ; then for f in $(find "$GUARD_CURRENT_PROFILE/config" -maxdepth 1 -mindepth 1 -xtype f) ; do F="$(basename "$f")" skel-install -t "$f" "$DEST_PATH/$F" done fi # update current logged users llxcfg-user-guard update-all >/dev/null 2>/dev/null || true # configure html default template for banned urls LANG_PATH="languages" FULL_PATH="$DEST_PATH/$LANG_PATH" LIST_FILES="$(ls $FULL_PATH)" LINK_FILE="custom.html" HTML_CONFFILE="guard/html/$LINK_FILE" for i in $LIST_FILES; do if [ -d "$FULL_PATH/$i" ]; then llxcfg-config read "$HTML_CONFFILE" |skel-install -t $FULL_PATH/$i/$LINK_FILE fi done # special lists files SOURCE_DIR="$GUARD_CURRENT_PROFILE/$TEMPLATES_DIR" if [ -d "$SOURCE_DIR" ] ; then for f in $(find "$SOURCE_DIR" -maxdepth 1 -mindepth 1 -xtype f -printf "%P\n") ; do skel-install -t "$SOURCE_DIR/$f" "$DEST_PATH/$TEMPLATES_DIR/$f" done fi exit 0