diff --git a/debian/config b/debian/config new file mode 100644 index 0000000..f46e822 --- /dev/null +++ b/debian/config @@ -0,0 +1,31 @@ +#!/bin/sh + +CONFIGFILE=/etc/metche.conf +set -e +. /usr/share/debconf/confmodule + +if [ -e $CONFIGFILE ]; then + . $CONFIGFILE || true + db_set metche/email $EMAIL_ADDRESS + 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/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/cron.d b/debian/cron.d new file mode 100644 index 0000000..214fc85 --- /dev/null +++ b/debian/cron.d @@ -0,0 +1 @@ +0-59/5 * * * * root test -x /usr/sbin/metche && /usr/sbin/metche cron diff --git a/debian/postinst b/debian/postinst new file mode 100644 index 0000000..cbd8409 --- /dev/null +++ b/debian/postinst @@ -0,0 +1,34 @@ +#!/bin/sh + +CONFIGFILE=/etc/metche.conf +set -e +. /usr/share/debconf/confmodule + +db_get metche/email +EMAIL_ADDRESS="$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 +if [ "$CHANGELOG_FILE" ]; then + 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 + 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 + +metche cron diff --git a/debian/templates b/debian/templates new file mode 100644 index 0000000..ddaee04 --- /dev/null +++ b/debian/templates @@ -0,0 +1,40 @@ +Template: metche/email +Type: string +Default: root +Description: Email address to which the reports will be sent. + By default, metche is run periodically by a cron job which returns + reports containing changes made to: + - the changelog files, + - the watched files, + - the list of installed debian packages. + This option indicates to which email address those reports will be + sent and typically corresponds to your collective mailing-list + address. + . + See https://poivron.org/dev/metche/ for an example. + . + Note: metche is also able to use GnuPG to encrypt the email it sends, + but does not by default. See the man page and the configuration file + for more details. + +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. + This option sets the path of the changelog file to be monitored. + +Template: metche/changelog/directory +Type: string +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.