[Sugar-devel] [PATCH sugar] Create a default unencrypted keyring, OLPC #10290

Simon Schampijer simon at schampijer.de
Mon Apr 16 06:33:05 EDT 2012


This patch does create an ununcrypted default keyring
if there is not one available already. This will stop
prompts for unlocking the keyring after logging into
Sugar.

In GNOME the session manager deals with creating
that keyring. In the OLPC images we do create a default
keyring on image creation time (see olpc-configure), same
is true for Soas. This patch does check/create the
keyring on every Sugar run. The advantage is that
for example installs the live image to a disk install
using liveinst, or install Sugar from the Fedora installer
without installing or ever running GNOME that workaround
will work for them as well.

Signed-off-by: Peter Robinson <pbrobinson at fedoraproject.org>
Signed-off-by: Simon Schampijer <simon at laptop.org>
---
 bin/sugar.in |   20 ++++++++++++++++++++
 1 files changed, 20 insertions(+), 0 deletions(-)

diff --git a/bin/sugar.in b/bin/sugar.in
index 12098db..df27143 100644
--- a/bin/sugar.in
+++ b/bin/sugar.in
@@ -62,6 +62,26 @@ export LANGUAGE="${LANGUAGE:-${LANG}}"
 # Set Sugar's telepathy accounts directory
 export MC_ACCOUNT_DIR=$HOME/.sugar/$SUGAR_PROFILE/accounts
 
+# Check if the keyring exists and create a default
+# unencrypted keyring (OLPC #10290)
+keyring_path=$HOME/.gnome2/keyrings
+if [ ! -e $keyring_path/login.keyring ] &&
+    [ ! -e $keyring_path/default.keyring ]; then
+    mkdir -p $keyring_path
+    echo 'default' > $keyring_path/default
+    TIME=$(/bin/date +%s)
+    cat >> $keyring_path/default.keyring.tmp <<EOF
+[keyring]
+display-name=default
+ctime=$TIME
+mtime=$TIME
+lock-on-idle=false
+lock-timeout=0
+EOF
+
+mv $keyring_path/default.keyring{.tmp,}
+fi
+
 # Workaround until gnome-keyring-daemon lets dbus activate it
 # https://bugzilla.gnome.org/show_bug.cgi?id=628302
 if test "$SUGAR_EMULATOR" = "yes" -a "$(type gnome-keyring-daemon)"; then
-- 
1.7.7.6



More information about the Sugar-devel mailing list