A NOTE has been added to this issue. ====================================================================== http://www.dbmail.org/mantis/view.php?id=542 ====================================================================== Reported By: lkneschke Assigned To: paul ====================================================================== Project: DBMail Issue ID: 542 Category: installation scripts Reproducibility: always Severity: minor Priority: normal Status: acknowledged target: ====================================================================== Date Submitted: 19-Mar-07 08:00 CET Last Modified: 19-Mar-07 10:37 CET ====================================================================== Summary: postinst script for dbmail-mysql Description: This patch modifies the dbmail.conf as needed, when the dbmail-mysql package got installed. [EMAIL PROTECTED]:~/src/dbmail-2.2/debian# svn diff dbmail-mysql.postinst Index: dbmail-mysql.postinst =================================================================== --- dbmail-mysql.postinst (revision 2472) +++ dbmail-mysql.postinst (working copy) @@ -32,6 +32,45 @@ upgrade) ;; configure) + + . /usr/share/debconf/confmodule + db_get dbmail/do_debconf || true; DO_DEBCONF=$RET + + if [ "$DO_DEBCONF" = "true" ]; then + # fetch debconf values + db_get dbmail/dbmail/host || true; DB_HOST=$RET + db_get dbmail/dbmail/db || true; DB_DATABASE=$RET + db_get dbmail/dbmail/user || true; DB_USER=$RET + db_get dbmail/dbmail/pass || true; DB_PASS=$RET + + if [ -z "$DB_PASS" ]; then + if [ -x /usr/bin/pwgen ]; then + DB_PASS=`pwgen -n` + db_set dbmail/dbmail/pass "$DB_PASS" + fi + fi + fi + + # protect the config-file + oldmask=`umask` + umask 026 + + if [ "$DO_DEBCONF" = "true" ] && [ -e "$CONFIG" ]; then + # edit the configs + sed -i -e "s,\(^host\W*=\)\(.*\$\),\1 $DB_HOST,i" \ + -e "s,\(^user\W*=\)\(.*\$\),\1 $DB_USER,i" \ + -e "s/\(^pass\W*=\)\(.*\$\)/\1 $DB_PASS/i" \ + -e "s,\(^db\W*=\)\(.*\$\),\1 $DB_DATABASE,i" \ + -e "s,\(^driver\W*=\)\(.*\$\),\1 mysql,i" \ + $CONFIG + + umask $oldmask + + fi + + db_stop + chmod 0600 $CONFIG + ;; abort-upgrade) ;;
====================================================================== ---------------------------------------------------------------------- paul - 19-Mar-07 09:06 ---------------------------------------------------------------------- Lars, This won't roll. The postinst files for postgres and mysql should never touch the dbmail.conf file. That was a delibirate decision. It is perfectly valid to install dbmail-pgsql on a running dbmail-mysql or dbmail-sqlite system and vice versa. You don't want a silent change of the production backend under those circumstances. ---------------------------------------------------------------------- lkneschke - 19-Mar-07 09:41 ---------------------------------------------------------------------- Hello Paul! Ok, but how can we fix it? :-) Having everything configurable from debconf just not the database backend looks a little bit incomplete for me? Should we move the debconf settings to dbmail.postinst(aka Please select database backend)? My points of view. I want to have preconfiguration of debian packages working. This is currently not possible, because you still need to edit the dbmail.conf file. If i decide to use debconf, i would expect it changing the database backend. Because i would install dbmail-mysql or dbmail-postgresql. If someone likes to have both database backends available, then he would not use debconf anyway. Just points... :-) Lars ---------------------------------------------------------------------- paul - 19-Mar-07 10:13 ---------------------------------------------------------------------- It's a bit like Peter Eisenbach (who sponsered the upload) said: too much debconf love going on. The consensus seems to be: debconf is not meant to provide a fullfledged system configuration tool. It should provide a mechanism for setting up a configuration where a sane default is not possible. Also, the debian packages currently *do* provide a working setup out-of-the-box with database autocreation albeit of the sqlite variety. It is only when you want to switch to mysql or postgresql that you need to install an additional package and edit dbmail.conf. Finally, let's please keep debian related issues out of the dbmail tracker. They belong to bugs.debian.org. ---------------------------------------------------------------------- lkneschke - 19-Mar-07 10:37 ---------------------------------------------------------------------- Ok. I'll keep building my own packages. :-) Feel free to close this bugreport. Issue History Date Modified Username Field Change ====================================================================== 19-Mar-07 08:00 lkneschke New Issue 19-Mar-07 09:06 paul Note Added: 0001921 19-Mar-07 09:06 paul Assigned To => paul 19-Mar-07 09:06 paul Status new => acknowledged 19-Mar-07 09:06 paul Resolution open => won't fix 19-Mar-07 09:41 lkneschke Note Added: 0001922 19-Mar-07 10:13 paul Note Added: 0001923 19-Mar-07 10:37 lkneschke Note Added: 0001924 ====================================================================== _______________________________________________ Dbmail-dev mailing list Dbmail-dev@dbmail.org http://twister.fastxs.net/mailman/listinfo/dbmail-dev