[maemo-commits] [maemo-commits] r14461 - in projects/haf/trunk/osso-app-killer: debian src

From: subversion at stage.maemo.org subversion at stage.maemo.org
Date: Tue Oct 16 15:38:03 EEST 2007
Author: kihamala
Date: 2007-10-16 15:38:01 +0300 (Tue, 16 Oct 2007)
New Revision: 14461

Modified:
   projects/haf/trunk/osso-app-killer/debian/changelog
   projects/haf/trunk/osso-app-killer/src/gconf-clean.sh
Log:
removing 'empty' gconf directories


Modified: projects/haf/trunk/osso-app-killer/debian/changelog
===================================================================
--- projects/haf/trunk/osso-app-killer/debian/changelog	2007-10-16 11:52:46 UTC (rev 14460)
+++ projects/haf/trunk/osso-app-killer/debian/changelog	2007-10-16 12:38:01 UTC (rev 14461)
@@ -1,3 +1,9 @@
+osso-app-killer (1.17-1~unreleased) unstable; urgency=low
+
+  * Remove 'empty' GConf directories. Fixes: NB#72357
+
+ -- Kimmo Hämäläinen <kimmo.hamalainen at nokia.com>  Tue, 16 Oct 2007 14:19:46 +0300
+
 osso-app-killer (1.16-1) unstable; urgency=low
 
   * Use osso-product-info, if available, to get the product name.

Modified: projects/haf/trunk/osso-app-killer/src/gconf-clean.sh
===================================================================
--- projects/haf/trunk/osso-app-killer/src/gconf-clean.sh	2007-10-16 11:52:46 UTC (rev 14460)
+++ projects/haf/trunk/osso-app-killer/src/gconf-clean.sh	2007-10-16 12:38:01 UTC (rev 14461)
@@ -19,11 +19,42 @@
 # Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA
 # 02110-1301 USA
 
+is_empty()
+{
+  cmp $1 - << EOF
+EOF
+}
+
+# remove empty directories and directories with only empty files
+r_rmdir()
+{
+  local EMPTY=1
+  local OLDDIR=`pwd`
+  cd $1
+  for f in `ls`; do
+    if [ -d $f ]; then
+      r_rmdir $f
+    fi
+  done
+  for f in `ls`; do
+    if [ -d $f ]; then
+      EMPTY=0
+    elif [ -f $f ]; then
+      if ! is_empty $f; then
+        EMPTY=0
+      fi
+    fi
+  done
+  cd $OLDDIR
+  if [ $EMPTY = 1 ]; then
+    echo "removing $1"
+    rm -rf $1
+  fi
+}
+
 empty_file()
 {
-  rm -f $1
-  touch $1
-  chmod ugo+rw $1
+  echo -n '' > $1
 }
 
 cd /etc/osso-af-init/gconf-dir
@@ -38,6 +69,7 @@
           echo "$0: removing $f"
           empty_file $f
         done
+        r_rmdir $d
         continue
       elif [ "x$CUD" = "x" ]; then
         for f in `find system -name *.xml`; do
@@ -49,6 +81,7 @@
           echo "$0: removing $f"
           empty_file $f
         done
+        r_rmdir $d
         continue
       fi
     elif [ "x$d" = "xapps" ]; then
@@ -63,6 +96,7 @@
           echo "$0: removing $f"
           empty_file $f
         done
+        r_rmdir $d
         continue
       fi
     fi


More information about the maemo-commits mailing list