Re: [Tails-dev] Bookmarks persistence - help needed

Delete this message

Reply to this message
Author: Alessandro Grassi
Date:  
To: tails-dev
Subject: Re: [Tails-dev] Bookmarks persistence - help needed
> Instead of using the 'link' option of the persistence framework, how
> about using another directory, then? This would result in the following
> approach:
>
>  * At build time:
>    - create an Iceweasel profile,
>    - create an empty `~/.mozilla/bookmarks` directory,
>    - remove `places.sqlite` from the Iceweasel profile,
>    - add a symlink `~/.mozilla/default/places.sqlite` pointing
>      to `~/.mozilla/bookmarks/places.sqlite`.
>  * When bookmarks persistence is activated:
>    - add `~/.mozilla/bookmarks` to the set of persistent directories.

>
> Wanna try it?


Looks a little tricky to me, but it works. Let's go this way! ;-)
All the needed patches are attached:

"0001-generate-iceweasel-profile-at-build-time.patch" and
"0001-symlink-places.sqlite-for-bookmarks-persistence.patch" are for
Tails;

"0001-Added-bookmarks-preset.patch" is for tails-persistence-setup;

I noticed that .po and .pot files for t-p-s should be updated, as they
refer to line numbers and some of those changed in Presets.pm, and I
added two gettext strings too. Are they updated on t-p-s build, or
should I do that now?

Greetings
Alessandro
From c8394e520dd15fdbf80bd1e2651a464499a4a010 Mon Sep 17 00:00:00 2001
From: Alessandro Grassi <alessandro.g89@???>
Date: Sun, 30 Sep 2012 20:09:08 +0200
Subject: [PATCH] generate iceweasel profile at build time

---
config/chroot_local-hooks/14-generate-iceweasel-profile | 11 +++++++++++
1 file changed, 11 insertions(+)
create mode 100755 config/chroot_local-hooks/14-generate-iceweasel-profile

diff --git a/config/chroot_local-hooks/14-generate-iceweasel-profile b/config/chroot_local-hooks/14-generate-iceweasel-profile
new file mode 100755
index 0000000..d910076
--- /dev/null
+++ b/config/chroot_local-hooks/14-generate-iceweasel-profile
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+#generate iceweasel profile at build time, so that it has a fixed name
+
+set -e
+apt-get --yes install xvfb
+xvfb-run iceweasel -CreateProfile default
+mv ~/.mozilla/firefox/*.default ~/.mozilla/firefox/default
+sed -i "s@Path=.*\.default@Path=default@" ~/.mozilla/firefox/profiles.ini
+mv ~/.mozilla /etc/skel
+apt-get --yes purge xvfb
--
1.7.10.4

From 8b46486483acfd30767723c15c08642f4ec097f7 Mon Sep 17 00:00:00 2001
From: Tails developers <amnesia@???>
Date: Fri, 5 Oct 2012 23:10:06 +0200
Subject: [PATCH] symlink places.sqlite for bookmarks persistence

---
 config/chroot_local-hooks/15-symlink-places.sqlite |    8 ++++++++
 1 file changed, 8 insertions(+)
 create mode 100755 config/chroot_local-hooks/15-symlink-places.sqlite


diff --git a/config/chroot_local-hooks/15-symlink-places.sqlite b/config/chroot_local-hooks/15-symlink-places.sqlite
new file mode 100755
index 0000000..688e80f
--- /dev/null
+++ b/config/chroot_local-hooks/15-symlink-places.sqlite
@@ -0,0 +1,8 @@
+#!/bin/sh
+
+#create a symlink to places.sqlite in iceweasel profile
+#from a dedicated "bookmarks" directory, so that
+#it can be made persistent
+
+set -e
+ln -s /home/amnesia/.mozilla/firefox/bookmarks/places.sqlite /etc/skel/.mozilla/firefox/default/places.sqlite
--
1.7.10.4

From e173105a99a545f754d367325ef91714ac81d443 Mon Sep 17 00:00:00 2001
From: Tails developers <amnesia@???>
Date: Fri, 5 Oct 2012 22:54:29 +0200
Subject: [PATCH] Added bookmarks preset

---
lib/Tails/Persistence/Configuration/Presets.pm | 10 ++++++++++
1 file changed, 10 insertions(+)

diff --git a/lib/Tails/Persistence/Configuration/Presets.pm b/lib/Tails/Persistence/Configuration/Presets.pm
index 5113828..ede4b24 100644
--- a/lib/Tails/Persistence/Configuration/Presets.pm
+++ b/lib/Tails/Persistence/Configuration/Presets.pm
@@ -114,6 +114,16 @@ method _build__presets {
             enabled     => 0,
             icon_name   => 'network-wired',
         },
+    {
+            name        => $self->encoding->decode(gettext(q{Browser bookmarks})),
+            description => $self->encoding->decode(gettext(
+                q{Bookmarks saved in Iceweasel browser}
+            )),
+            destination => '/home/amnesia/.mozilla/firefox/bookmarks',
+            options     => [ 'source=bookmarks' ],
+            enabled     => 0,
+            icon_name   => 'user-bookmarks',
+        },
         {
             name        => $self->encoding->decode(gettext(q{APT Packages})),
             description => $self->encoding->decode(gettext(
-- 
1.7.10.4