Re: [Tails-dev] [patch, please review] generate Iceweasel profile at build time

2012-09-30 Thread Alessandro Grassi

 People usually use Xvfb when they need a 'fake' X server. See the 'xvfb'
 package in Debian, and the `xvfb-run` script it contains.


xvfb works fine, new patch is attached ;-)

Now the real thing: make bookmarks persistent. I got it working using
dotfiles and putting places.sqlite in the right subfolder, so I can make a
preset in tails-persistence-setup which links bookmarks/places.sqlite to
/home/amnesia/.mozilla/firefox/profiles/amnesia/places.sqlite (I looked
at the code).

The only missing thing is the first-time behaviour: the existing
places.sqlite (or, if missing, a default one) must be moved to the
persistent storage and linked to the profile folder, and Iceweasel should
not be open while this happens.

Is there a way for tails-persistence-setup to execute a script on preset
activation?

Alessandro
From faf5d5d142c6d3a7928a106ec53dfb2660a8c2d6 Mon Sep 17 00:00:00 2001
From: Alessandro Grassi alessandro@gmail.com
Date: Sun, 30 Sep 2012 15:43:03 +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 000..be2054f
--- /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/amnesia
+sed -i s@Path=.*\.default@Path=amnesia@ ~/.mozilla/firefox/profiles.ini
+mv ~/.mozilla /etc/skel
+apt-get --yes purge xvfb
-- 
1.7.10.4

___
tails-dev mailing list
tails-dev@boum.org
https://mailman.boum.org/listinfo/tails-dev


Re: [Tails-dev] [patch, please review] generate Iceweasel profile at build time

2012-09-30 Thread Ague Mill
On Sun, Sep 30, 2012 at 04:18:07PM +0100, Alessandro Grassi wrote:
  People usually use Xvfb when they need a 'fake' X server. See the 'xvfb'
  package in Debian, and the `xvfb-run` script it contains.
 
 xvfb works fine, new patch is attached ;-)

Great! The hook looks fine. Minor cosmetic remark: I'd rather have the
profile named 'default' than 'amnesia'. The 'amnesia' name is a leftover
from the very first versions of what became Tails. Maybe someday we'll
want to get rid of those.
 
 Now the real thing: make bookmarks persistent. I got it working using
 dotfiles and putting places.sqlite in the right subfolder, so I can make a
 preset in tails-persistence-setup which links bookmarks/places.sqlite to
 /home/amnesia/.mozilla/firefox/profiles/amnesia/places.sqlite (I looked
 at the code).
 
 The only missing thing is the first-time behaviour: the existing
 places.sqlite (or, if missing, a default one) must be moved to the
 persistent storage and linked to the profile folder, and Iceweasel should
 not be open while this happens.
 
 Is there a way for tails-persistence-setup to execute a script on preset
 activation?

I am not sure I understand. Do you already have code for that?

Some tests have shown that you can have `places.sqlite` be a symlink to
a file in another directory, e.g. `~/.mozilla/tails-bookmarks`. If the
symlink points to a non-existent file, then Firefox will happily create
it from the defaults when it starts. So I suspect that making this
directory persistent would do the trick.

-- 
Ague


pgpVaRcdUOqj7.pgp
Description: PGP signature
___
tails-dev mailing list
tails-dev@boum.org
https://mailman.boum.org/listinfo/tails-dev


Re: [Tails-dev] [patch, please review] generate Iceweasel profile at build time

2012-09-30 Thread Alessandro Grassi
 Great! The hook looks fine. Minor cosmetic remark:[...]
Fixed and new patch attached

 I am not sure I understand. Do you already have code for that?
No, I made tests on the running system

 [...] If the symlink points to a non-existent file, then Firefox will
happily create it [...]
Correct, I tried it too. This is ok for when no places.sqlite exists.
If it exists, user may have some saved bookmarks already, and we should
preserve them.

Alessandro
From c8394e520dd15fdbf80bd1e2651a464499a4a010 Mon Sep 17 00:00:00 2001
From: Alessandro Grassi alessandro@gmail.com
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 000..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

___
tails-dev mailing list
tails-dev@boum.org
https://mailman.boum.org/listinfo/tails-dev


Re: [Tails-dev] [patch, please review] generate Iceweasel profile at build time

2012-09-26 Thread anonym
25/09/12 10:31, Ague Mill wrote:
 On Mon, Sep 24, 2012 at 05:24:51PM +0100, Alessandro Grassi wrote:
 How far have you tested this patch?

 Does calling `iceweasel -CreateProfile` requires to have an X server
 running?

 I didn't test this. Turns out that it requires an X server! Thanks for
 asking!
 We need to work around this somehow.
 
 People usually use Xvfb when they need a 'fake' X server. See the 'xvfb'
 package in Debian, and the `xvfb-run` script it contains.
 
 Overall, I am still having a hard time convincing myself that generating
 an Iceweasel profile on build time is the way to go. That is why I have
 been researching how complicated it would be to create a dedicated
 extension...

Note that there are other aspects of Iceweasel that we may want to make
persistent, like the changes made by the certificate manager. With a
pre-generated Iceweasel profile, that could be solved in the same way as
with bookmarks. Without it, there would be need for another dedicated
extension.

However, todo/persistence_preset_-_bookmarks has been updated and it
seems that making the bookmarks persistent using this approach may be
trickier than I initially thought.

Cheers!



signature.asc
Description: OpenPGP digital signature
___
tails-dev mailing list
tails-dev@boum.org
https://mailman.boum.org/listinfo/tails-dev


Re: [Tails-dev] [patch, please review] generate Iceweasel profile at build time

2012-09-25 Thread Ague Mill
On Mon, Sep 24, 2012 at 05:24:51PM +0100, Alessandro Grassi wrote:
  How far have you tested this patch?
 
  Does calling `iceweasel -CreateProfile` requires to have an X server
  running?
 
 I didn't test this. Turns out that it requires an X server! Thanks for
 asking!
 We need to work around this somehow.

People usually use Xvfb when they need a 'fake' X server. See the 'xvfb'
package in Debian, and the `xvfb-run` script it contains.

Overall, I am still having a hard time convincing myself that generating
an Iceweasel profile on build time is the way to go. That is why I have
been researching how complicated it would be to create a dedicated
extension...

But I am happy to see you trying this approach. We will be able to see
how far it goes! :)
 
 Also, it would be better if the hook would start with `set -e` in order
  to catch any errors that can happen in the process.
 
 How do I do that? I just put `set -e` before other commands?

Yes, just put it at the start of the script. For what it does, let's
quote dash(1):

   If not interactive, exit immediately if any
   untested command fails.  The exit status of a com‐
   mand is considered to be explicitly tested if the
   command is used to control an if, elif, while, or
   until; or if the command is the left hand operand
   of an “” or “||” operator.

-- 
Ague


pgpYUyniA26sA.pgp
Description: PGP signature
___
tails-dev mailing list
tails-dev@boum.org
https://mailman.boum.org/listinfo/tails-dev