Osso-backup support: instead of backing up the .modest folder, backup a tar.gz (fixes...
authorJose Dapena Paz <jdapena@igalia.com>
Wed, 17 Jun 2009 15:43:35 +0000 (17:43 +0200)
committerJose Dapena Paz <jdapena@igalia.com>
Wed, 17 Jun 2009 16:40:18 +0000 (18:40 +0200)
* 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
src/hildon2/Makefile.am
src/hildon2/modest-prebackup.sh [new file with mode: 0644]
src/hildon2/modest-restore.sh [new file with mode: 0644]
src/hildon2/modest.conf

index a0662b0..8ee55e2 100644 (file)
@@ -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
    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
    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(desktopentrydir)
    AC_SUBST(serviceentrydir)
    AC_SUBST(backupsettingsdir)
+   AC_SUBST(prebackupdir)
+   AC_SUBST(restoredir)
    AC_SUBST(ossocudscriptsdir)
    AC_SUBST(localedir)
    AC_SUBST(pixmapdir)
    AC_SUBST(ossocudscriptsdir)
    AC_SUBST(localedir)
    AC_SUBST(pixmapdir)
index 63ad9b8..41f782b 100644 (file)
@@ -130,6 +130,8 @@ ui_DATA = $(UI_FILES)
 serviceentry_DATA   = com.nokia.modest.service
 desktopentry_DATA   = modest.desktop
 backupsettings_DATA = modest.conf
 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=\
 ossocudscripts_SCRIPTS = modest-clean.sh
 
 EXTRA_DIST=\
@@ -138,4 +140,6 @@ EXTRA_DIST=\
        $(serviceentry_DATA) \
        $(desktopentry_DATA) \
        $(backupsettings_DATA) \
        $(serviceentry_DATA) \
        $(desktopentry_DATA) \
        $(backupsettings_DATA) \
+       $(prebackup_SCRIPTS) \
+       $(restore_SCRIPTS) \
        $(ossocudscripts_SCRIPTS)
\ No newline at end of file
        $(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 (file)
index 0000000..5536a50
--- /dev/null
@@ -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 (file)
index 0000000..b762bfc
--- /dev/null
@@ -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
index d967f91..7b5fd5f 100644 (file)
@@ -1,6 +1,6 @@
 <backup-configuration>
   <locations>
 <backup-configuration>
   <locations>
-    <location type="dir" category="emails" auto="true">/home/user/.modest</location>
+    <location type="file" category="emails" auto="true">/home/user/.modest-backup.tar.gz</location>
     <location type="dir" category="emails" auto="true">/var/lib/gconf/apps/modest</location>
   </locations>
 </backup-configuration>
     <location type="dir" category="emails" auto="true">/var/lib/gconf/apps/modest</location>
   </locations>
 </backup-configuration>