diff --git a/debian/metche.config b/debian/metche.config index 24e6e12..38bdf8d 100755 --- a/debian/metche.config +++ b/debian/metche.config @@ -4,20 +4,27 @@ set -e . /usr/share/debconf/confmodule -db_fset metche/email seen false -db_fset metche/changelog seen false -db_fset metche/backups seen false - if [ -e $CONFIGFILE ]; then . $CONFIGFILE || true - # Stocke les valeurs du fichier de configuration - # dans la base de données de debconf db_set metche/email $EMAIL_ADDRESS - db_set metche/changelog $CHANGELOG_FILE - db_set metche/backups $BACKUP_DIR + if [ "$CHANGELOG_FILE" ]; then + db_set metche/changelog/file $CHANGELOG_FILE + fi + if [ "$CHANGELOG_DIR" ]; then + db_set metche/changelog/directory $CHANGELOG_DIR + fi fi -db_input medium metche/email || true -db_input medium metche/changelog || true -db_input medium metche/backups || true +db_input medium metche/changelog/type || true db_go || true +db_get metche/changelog/type +case "$RET" in +"Single changelog file") + db_input medium metche/changelog/file || true + db_go || true + ;; +"Multiple changelog files") + db_input medium metche/changelog/directory || true + db_go || true + ;; +esac diff --git a/debian/metche.postinst b/debian/metche.postinst index 30f7a2f..8542aa0 100644 --- a/debian/metche.postinst +++ b/debian/metche.postinst @@ -6,14 +6,29 @@ db_get metche/email EMAIL_ADDRESS="$RET" -db_get metche/changelog -CHANGELOG_FILE="$RET" -db_get metche/backups -BACKUP_DIR="$RET" +db_get metche/changelog/type +case "$RET" in +"Single changelog file") + db_get metche/changelog/file + CHANGELOG_FILE="$RET" + ;; +"Multiple changelog files") + db_get metche/changelog/directory + CHANGELOG_DIR="$RET" + ;; +esac cp -a -f $CONFIGFILE $CONFIGFILE.tmp -sed -e "s#^ *EMAIL_ADDRESS=.*#EMAIL_ADDRESS=\"$EMAIL_ADDRESS\"#" \ - -e "s#^ *CHANGELOG_FILE=.*#CHANGELOG_FILE=\"$CHANGELOG_FILE\"#" \ - -e "s#^ *BACKUP_DIR=.*#BACKUP_DIR=\"$BACKUP_DIR\"#" \ - < $CONFIGFILE > $CONFIGFILE.tmp +if [ "$CHANGELOG_FILE" ]; then + echo "single $RET" + sed -e "s/^ *EMAIL_ADDRESS=.*/EMAIL_ADDRESS=\"$EMAIL_ADDRESS\"/" \ + -e "s@^[# ]*CHANGELOG_FILE=.*@CHANGELOG_FILE=\"$CHANGELOG_FILE\"@" \ + -e "s@^[# ]*CHANGELOG_DIR@#CHANGELOG_DIR@" < $CONFIGFILE > $CONFIGFILE.tmp +fi +if [ "$CHANGELOG_DIR" ]; then + echo "multiple $RET" + sed -e "s/^ *EMAIL_ADDRESS=.*/EMAIL_ADDRESS=\"$EMAIL_ADDRESS\"/" \ + -e "s@^[# ]*CHANGELOG_DIR=.*@CHANGELOG_DIR=\"$CHANGELOG_DIR\"@" \ + -e "s@^[# ]*CHANGELOG_FILE@#CHANGELOG_FILE@" < $CONFIGFILE > $CONFIGFILE.tmp +fi mv -f $CONFIGFILE.tmp $CONFIGFILE diff --git a/debian/metche.templates b/debian/metche.templates index 2069f10..9608475 100644 --- a/debian/metche.templates +++ b/debian/metche.templates @@ -17,21 +17,24 @@ but does not by default. See the man page and the configuration file for more details. -Template: metche/changelog +Template: metche/changelog/type +Type: select +Choices: Single changelog file, Multiple changelog files +Description: Changelog monitoring type. + Metche monitors changelog files written by *you* and which should + comment the changes you made to the system. You can choose between + two different types of monitoring: + - Single changelog file monitoring or + - Multiple changelogs file monitoring, in which each "Changelog" + file in a sub-directory of a given directory will be monitored. + +Template: metche/changelog/file Type: string Description: Changelog file to be monitored. - Metche can monitor changelog files written by *you* and which should - comment the changes you made to the system. This option can be used - to activate the monitoring of a single changelog file. - . - Note that you can also change metche's configuration file for it to - monitor a set of changelog files stored in a changelog directory - instead of a single file. + This option sets the path of the changelog file to be monitored. -Template: metche/backups +Template: metche/changelog/directory Type: string -Default: /var/lib/metche -Description: Directory containing the backups. - This option corresponds to the directory in which metche will store - the backups of the watched directories. Make sure that this backup - place is at least as secured as the source. +Description: Changelog directory to be monitored. + This option sets the path of the changelog directory. Each + "Changelog" file should be in a sub-directory of this directory.