From 6eb8b51e9fcd8b79eb0af5f0e673c945731e15b5 Mon Sep 17 00:00:00 2001 From: Jose Dapena Paz Date: Wed, 17 Jun 2009 17:43:35 +0200 Subject: [PATCH] Osso-backup support: instead of backing up the .modest folder, backup a tar.gz (fixes NB#117612). * src/hildon2/modest-prebackup.sh, src/hildon2/modest-restore.sh: these scripts create a tarball for the modest folder, to properly recreate the empty folders, and also exclude not needed files (local folder summaries). * src/hildon2/modest.conf: now we include in backup the tarball file with .modest contents instead of the folder itself. * configure.ac, src/hildon2/Makefile.am: install backup scripts properly. --- configure.ac | 4 ++++ src/hildon2/Makefile.am | 4 ++++ src/hildon2/modest-prebackup.sh | 8 ++++++++ src/hildon2/modest-restore.sh | 19 +++++++++++++++++++ src/hildon2/modest.conf | 2 +- 5 files changed, 36 insertions(+), 1 deletion(-) create mode 100644 src/hildon2/modest-prebackup.sh create mode 100644 src/hildon2/modest-restore.sh diff --git a/configure.ac b/configure.ac index a0662b0..8ee55e2 100644 --- a/configure.ac +++ b/configure.ac @@ -549,6 +549,8 @@ if test "x$with_platform" == "xmaemo"; then serviceentrydir=`$PKG_CONFIG dbus-glib-1 --variable=prefix`/share/dbus-1/services localedir=`$PKG_CONFIG osso-af-settings --variable=localedir` backupsettingsdir=/etc/osso-backup/applications + prebackupdir=/etc/osso-backup/pre-backup.d/ + restoredir=/etc/osso-backup/restore.d/always/ ossocudscriptsdir=/etc/osso-cud-scripts pixmapdir=`$PKG_CONFIG osso-af-settings --variable=hildonpixmapdir` icon_26x26dir=$datadir/icons/hicolor/26x26/hildon @@ -566,6 +568,8 @@ if test "x$with_platform" == "xmaemo"; then AC_SUBST(desktopentrydir) AC_SUBST(serviceentrydir) AC_SUBST(backupsettingsdir) + AC_SUBST(prebackupdir) + AC_SUBST(restoredir) AC_SUBST(ossocudscriptsdir) AC_SUBST(localedir) AC_SUBST(pixmapdir) diff --git a/src/hildon2/Makefile.am b/src/hildon2/Makefile.am index 63ad9b8..41f782b 100644 --- a/src/hildon2/Makefile.am +++ b/src/hildon2/Makefile.am @@ -130,6 +130,8 @@ ui_DATA = $(UI_FILES) serviceentry_DATA = com.nokia.modest.service desktopentry_DATA = modest.desktop backupsettings_DATA = modest.conf +prebackup_SCRIPTS = modest-prebackup.sh +restore_SCRIPTS = modest-restore.sh ossocudscripts_SCRIPTS = modest-clean.sh EXTRA_DIST=\ @@ -138,4 +140,6 @@ EXTRA_DIST=\ $(serviceentry_DATA) \ $(desktopentry_DATA) \ $(backupsettings_DATA) \ + $(prebackup_SCRIPTS) \ + $(restore_SCRIPTS) \ $(ossocudscripts_SCRIPTS) \ No newline at end of file diff --git a/src/hildon2/modest-prebackup.sh b/src/hildon2/modest-prebackup.sh new file mode 100644 index 0000000..5536a50 --- /dev/null +++ b/src/hildon2/modest-prebackup.sh @@ -0,0 +1,8 @@ +#!/bin/sh + +rm -rf $HOME/.modest-backup.tar.gz + +echo "$*" | grep -q "emails" || exit 0 + +cd $HOME/ +tar czvf .modest-backup.tar.gz --exclude="*.ev-summary.mmap" --exclude=".modest/images/*" .modest diff --git a/src/hildon2/modest-restore.sh b/src/hildon2/modest-restore.sh new file mode 100644 index 0000000..b762bfc --- /dev/null +++ b/src/hildon2/modest-restore.sh @@ -0,0 +1,19 @@ +#!/bin/sh +FILE="$HOME/.modest-backup.tar.gz" + +if [ ! -f "$FILE" ] +then +#no backup file. Return success +exit 0 +fi + +if [ ! -s "$FILE" ] +then +#empty backup file. Return success +exit 0 +fi + +cd $HOME +tar xzvf .modest-backup.tar.gz +rm -rf .modest-backup.tar.gz +exit 0 diff --git a/src/hildon2/modest.conf b/src/hildon2/modest.conf index d967f91..7b5fd5f 100644 --- a/src/hildon2/modest.conf +++ b/src/hildon2/modest.conf @@ -1,6 +1,6 @@ - /home/user/.modest + /home/user/.modest-backup.tar.gz /var/lib/gconf/apps/modest -- 1.7.9.5