Projekt

Obecné

Profil

Stáhnout (1.27 KB) Statistiky
| Větev: | Tag: | Revize:
1cb0a3be Ondřej Fibich
#!/bin/bash
# FreenetIS-monitoring DEB: actions after installing of package

set -e
. /usr/share/debconf/confmodule

NAME=freenetis-monitoring
CONFIGFILE=/etc/freenetis/freenetis-monitoring.conf

# Quit if config file is missing.
if [ ! -e $CONFIGFILE ]; then
echo "$CONFIGFILE not founded!"
exit 1
fi

url_regex='(https?|ftp|file)://[-A-Za-z0-9\+&@#/%?=~_|!:,.;]*[-A-Za-z0-9\+&@#/%=~_|]'

# Substitute in the values from the debconf db.
# There are obvious optimizations possible here.
# The cp before the sed ensures we do not mess up
# the config file’s ownership and permissions.

db_get freenetis-monitoring/path_freenetis
PATH_FN="$RET"

# check path
if [ -z "$PATH_FN" ]; then
echo "Empty path to FreenetIS instance, configuration failed!"
exit 3
fi

cp -a -f $CONFIGFILE $CONFIGFILE.tmp

# If the admin deleted or commented some variables but then set
# them via debconf, (re-)add them to the conffile.

test -z "$PATH_FN" || grep -Eq '^ *PATH_FN=' $CONFIGFILE || echo "PATH_FN=" >> $CONFIGFILE
PATH_FN_ESCAPED="${PATH_FN//\//\\/}"
sed -e "s/^ *PATH_FN=.*/PATH_FN=\"$PATH_FN_ESCAPED\"/" < $CONFIGFILE > $CONFIGFILE.tmp

mv -f $CONFIGFILE.tmp $CONFIGFILE

# Make post install things

# 1) Startup at boot

# set on fire after boot
update-rc.d freenetis-monitoring defaults

exit 0