diff options
author | paul <paul@7b491191-dbf0-0310-aff6-d879d4d69008> | 2007-03-10 22:20:17 +0000 |
---|---|---|
committer | paul <paul@7b491191-dbf0-0310-aff6-d879d4d69008> | 2007-03-10 22:20:17 +0000 |
commit | aebb27dd2aed4896b5b42971460b5c6e721a0387 (patch) | |
tree | f6ff4ec34d123a1d9f4f9c8d4894d5cd8ef21733 | |
parent | 52331240c9fead3baa5565d5d91eddaadd3ae35d (diff) |
merging git tree
git-svn-id: https://svn.ic-s.nl/svn/dbmail/branches/dbmail_2_2_branch@2457 7b491191-dbf0-0310-aff6-d879d4d69008
-rw-r--r-- | ChangeLog | 9 | ||||
-rwxr-xr-x | contrib/sql2sql/mysql2pgsql.sh | 49 | ||||
-rw-r--r-- | dbmail-mailbox.c | 2 | ||||
-rw-r--r-- | debian/changelog | 6 | ||||
-rw-r--r-- | debian/dbmail.init | 1 | ||||
-rw-r--r-- | debian/dbmail.postinst | 14 |
6 files changed, 52 insertions, 29 deletions
@@ -1,3 +1,12 @@ +2007-03-10 Paul J Stevens <paul@nfg.nl> + + * debian/dbmail.postinst: + avoid slash in sed s commands + * debian/changelog, debian/dbmail.postinst: + 2.2.4 rc1 packages + * dbmail-mailbox.c: + fix for export problem #590 + 2007-03-09 Paul J Stevens <paul@nfg.nl> * debian/po/ml.po, debian/po/pt.po, debian/po/ta.po: diff --git a/contrib/sql2sql/mysql2pgsql.sh b/contrib/sql2sql/mysql2pgsql.sh index 202577e7..ffbb891a 100755 --- a/contrib/sql2sql/mysql2pgsql.sh +++ b/contrib/sql2sql/mysql2pgsql.sh @@ -6,7 +6,7 @@ PGDD="../../sql/postgresql/create_tables.pgsql" TMPDIR="/opt/tmp" -tables=" +export tables=" dbmail_users dbmail_mailboxes dbmail_physmessage @@ -35,26 +35,27 @@ dbmail_usermap export_mysql() { - t="$1" - dumpfile=$TMPDIR/$t.mysqldata + dumpfile=$TMPDIR/dbmail.mysqldata [ -e "$dumpfile" ] && return 1 - echo -n "export from mysql [$t] ..." - mysqldump --skip-opt --compatible=postgresql -q -t -c $MYDB $t > $dumpfile + echo -n "export from mysql ..." + mysqldump --skip-opt --single-transaction --hex-blob --compatible=postgresql -q -t -c $MYDB $tables > $dumpfile echo "done" } + +init_pgsql() +{ + dropdb dbmail >/dev/null 2>&1 + createdb dbmail >/dev/null 2>&1 + psql dbmail < ../../sql/postgresql/create_tables.pgsql >/dev/null 2>&1 || { echo "create db failed. abort."; exit 1; } + echo "delete from dbmail_users;"|psql dbmail + +} import_pgsql() { - t="$1" - dumpfile=$TMPDIR/$t.mysqldata - if [ "$t" = "dbmail_users" ]; then - dropdb dbmail >/dev/null 2>&1 - createdb dbmail >/dev/null 2>&1 - psql dbmail < ../../sql/postgresql/create_tables.pgsql >/dev/null 2>&1 || { echo "create db failed. abort."; exit 1; } - echo "delete from dbmail_users;"|psql dbmail - fi - echo -n "import into pgsql [$t] ..." - ( echo "BEGIN;"; cat $dumpfile; echo "END;" ) | psql dbmail >/dev/null 2>&1 + dumpfile=$TMPDIR/dbmail.mysqldata + echo -n "import into pgsql ..." + cat $dumpfile | psql -q dbmail echo "done." return $? } @@ -84,17 +85,25 @@ SELECT setval('dbmail_sievescripts_idnr_seq', max(id)) FROM dbmail_sievescripts; SELECT setval('dbmail_envelope_idnr_seq', max(id)) FROM dbmail_envelope; END; EOQ - psql dbmail < $qfile + psql -q dbmail < $qfile rm -f $qfile } +pgsql_owner() +{ + for t in `echo '\d'|psql dbmail|grep root|awk '{print $3}'`; do + echo "alter table $t owner to dbmail;"|psql -q dbmail + done +} + main() { install -d -m 7777 $TMPDIR || { echo "unable to access $TMPDIR"; exit 1; } - for t in $tables; do - export_mysql $t || { echo "table already exported. successful import assumed. skipping $t."; continue; } - import_pgsql $t || { echo "import failed at table $t. abort."; exit 1; } - done + #export_mysql || { echo "Export failed"; exit 1; } + init_pgsql + import_pgsql || { echo "Import failed"; exit 1; } + pgsql_sequences + pgsql_owner } diff --git a/dbmail-mailbox.c b/dbmail-mailbox.c index 73e77ff8..369048a5 100644 --- a/dbmail-mailbox.c +++ b/dbmail-mailbox.c @@ -296,7 +296,7 @@ int dbmail_mailbox_dump(struct DbmailMailbox *self, FILE *file) count++; dbmail_message_free(message); } - g_string_prepend(t, db_get_result(i,1)); + g_string_printf(t,"%s", db_get_result(i,1)); } else { g_string_append(t, db_get_result(i,1)); } diff --git a/debian/changelog b/debian/changelog index 6f6eedd2..943421ef 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,3 +1,9 @@ +dbmail (2.2.4-0rc1) unstable; urgency=low + + * rc package + + -- Paul J Stevens <paul@nfg.nl> Sat, 10 Mar 2007 12:27:21 +0100 + dbmail (2.2.3-1) unstable; urgency=low [ Paul J Stevens ] diff --git a/debian/dbmail.init b/debian/dbmail.init index 40cfc791..6516d934 100644 --- a/debian/dbmail.init +++ b/debian/dbmail.init @@ -74,7 +74,6 @@ service_stop() { pids=`pidof ${_name}` if [ -n "$pids" ]; then - echo "=[$pids]=" log_failure_msg "failed" return 1 fi diff --git a/debian/dbmail.postinst b/debian/dbmail.postinst index aaaf321d..2f7551f2 100644 --- a/debian/dbmail.postinst +++ b/debian/dbmail.postinst @@ -119,18 +119,18 @@ case "$1" in if [ "$DO_DEBCONF" = "true" ] && [ -e "$CONFIG" ] && [ -e "$DEBIAN_CONFIG" ]; then # edit the configs - sed -i -re "s/\(^host\W*=\)\(.*\$\)/\1 $DB_HOST/i" \ - -e "s/\(^user\W*=\)\(.*\$\)/\1 $DB_USER/i" \ + 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/\(^#postmaster\W*=\)\(.*\$\)/\1 $POSTMASTER/i" \ - -e "s/\(^postmaster\W*=\)\(.*\$\)/\1 $POSTMASTER/i" \ - -e "s/\(^EFFECTIVE_USER\W*=\)\(.*\$\)/\1 dbmail/i" \ - -e "s/\(^EFFECTIVE_GROUP\W*=\)\(.*\$\)/\1 dbmail/i" \ + -e "s,\(^#postmaster\W*=\)\(.*\$\),\1 $POSTMASTER,i" \ + -e "s,\(^postmaster\W*=\)\(.*\$\),\1 $POSTMASTER,i" \ + -e "s,\(^EFFECTIVE_USER\W*=\)\(.*\$\),\1 dbmail,i" \ + -e "s,\(^EFFECTIVE_GROUP\W*=\)\(.*\$\),\1 dbmail,i" \ $CONFIG if [ "$AUTHDRIVER" = "ldap" ]; then - sed -i -re "s/\(^BASE_DN\W*=\)\(.*\$\)/\1 $LDAP_BASE_DN/i" \ + sed -i -e "s/\(^BASE_DN\W*=\)\(.*\$\)/\1 $LDAP_BASE_DN/i" \ -e "s/\(^HOSTNAME\W*=\)\(.*\$\)/\1 $LDAP_HOST/i" \ -e "s/\(^BIND_PW\W*=\)\(.*\$\)/\1 $LDAP_BIND_PW/i" \ -e "s/\(^BIND_DN\W*=\)\(.*\$\)/\1 $LDAP_BIND_DN/i" \ |