[maemo-commits] [maemo-commits] r16046 - projects/haf/trunk/dbus/debian

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Fri Sep 5 21:40:59 EEST 2008
Author: guillem
Date: 2008-09-05 21:40:59 +0300 (Fri, 05 Sep 2008)
New Revision: 16046

Modified:
   projects/haf/trunk/dbus/debian/changelog
   projects/haf/trunk/dbus/debian/dbus.init
Log:
Only generate the machine-id file if non-existant or empty

Fixes NB#87920
Thanks to Artem Bityutskiy <Artem.Bityutskiy at nokia.com>.


Modified: projects/haf/trunk/dbus/debian/changelog
===================================================================
--- projects/haf/trunk/dbus/debian/changelog	2008-09-05 18:36:26 UTC (rev 16045)
+++ projects/haf/trunk/dbus/debian/changelog	2008-09-05 18:40:59 UTC (rev 16046)
@@ -5,6 +5,9 @@
     - debian/patches/90-atomic-file-change-sync.patch: New file.
     (Closes at FreeDesktop.org: #17352)
     Thanks to Artem Bityutskiy <Artem.Bityutskiy at nokia.com>.
+  * Only generate the machine-id file on boot if it does not exist or it's
+    an empty file. (Fixes NB#87920)
+    Thanks to Artem Bityutskiy <Artem.Bityutskiy at nokia.com>.
 
  -- Guillem Jover <guillem.jover at nokia.com>  Fri, 05 Sep 2008 20:52:49 +0300
 

Modified: projects/haf/trunk/dbus/debian/dbus.init
===================================================================
--- projects/haf/trunk/dbus/debian/dbus.init	2008-09-05 18:36:26 UTC (rev 16045)
+++ projects/haf/trunk/dbus/debian/dbus.init	2008-09-05 18:40:59 UTC (rev 16046)
@@ -25,6 +25,7 @@
 PIDFILE=$PIDDIR/pid
 DESC="system message bus"
 EVENTDIR=/etc/dbus-1/event.d
+MACHINE_ID=/var/lib/dbus/machine-id
 
 test -x $DAEMON || exit 0
 
@@ -50,9 +51,20 @@
 fi
 
 create_machineid() {
-  # Create machine-id file
-  if [ -x $UUIDGEN ]; then
-    $UUIDGEN $UUIDGEN_OPTS
+  # Create machine-id file if it does not exist (this is the first boot) or
+  # empty (due to an unclean reboot).
+  if [ ! -f $MACHINE_ID -o ! -s $MACHINE_ID ]; then
+    # machine-id file does not exist or is empty
+    if [ -x $UUIDGEN ]; then
+      if [ -f $MACHINE_ID ]; then
+         # machine-id file is empty, remove it to make dbus-uuidgen happy
+         rm $MACHINE_ID
+      fi
+      # generate machine-id file
+      $UUIDGEN $UUIDGEN_OPTS
+    else
+      echo Warning: machine-id file cannot be created
+    fi
   fi
 }
 


More information about the maemo-commits mailing list