#!/bin/bash # This scripts provides a simple way to add # /net/share/* folders that contains a html page # to server main page (http://server/). # Variables TPL_FILE="/usr/share/lliurex-share-sites-on-httpd/templates/httpLink.tpl" LINK_URL="" LINK_TEXT="" LINK_DESCRIPTION="" PATH_SITE="" PATH_TO_FIND="/net/share/" HTTPD_BINARY="/usr/sbin/llxcfg-httpd -u enabledir " # Functions _enableSitesForDirectories(){ for f in $(find "$PATH_TO_FIND" -name "index.htm*" ); do PATH_ABS=$(readlink -f $(dirname $f)) PATH_NAME=$(basename $(readlink -f $(dirname $f))) $HTTPD_BINARY $PATH_ABS $PATH_NAME LINK_URL="http://$PATH_NAME" LINK_TEXT="$PATH_NAME" LINK_DESCRIPTION="La carpeta $PATH_NAME" export LINK_URL LINK_TEXT LINK_DESCRIPTION cat "$TPL_FILE" | llxcfg-template - > /usr/share/llxcfg-httpd/httpd/srv/links/${PATH_NAME}.links cp /usr/share/llxcfg-httpd/httpd/srv/links/${PATH_NAME}.link /usr/share/llxcfg-httpd/httpd/srv/links/${PATH_NAME}.link.es done } # Main s _enableSitesForDirectories exit 0