[debian-edu-commits] debian-edu/ 69/183: Fix random naming of generated path files, so it actually works, now tests fine

Alexander Alemayhu ccscanf-guest at moszumanska.debian.org
Wed Jun 11 16:48:34 UTC 2014


This is an automated email from the git hooks/post-receive script.

ccscanf-guest pushed a commit to branch master
in repository desktop-profiles.

commit 5165ade45d23961e34a91ed28165fc47c4d679c1
Author: Bart Cornelis <cobaco at linux.be>
Date:   Sat May 21 02:22:35 2005 +0000

    Fix random naming of generated path files, so it actually works,
    now tests fine
---
 20desktop-profiles_activateDesktopProfiles | 22 +++++++++++-----------
 debian/postinst                            | 10 +++++-----
 path                                       |  4 ++--
 3 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/20desktop-profiles_activateDesktopProfiles b/20desktop-profiles_activateDesktopProfiles
index 6450c88..b349982 100644
--- a/20desktop-profiles_activateDesktopProfiles
+++ b/20desktop-profiles_activateDesktopProfiles
@@ -174,10 +174,10 @@ activate_GCONF () {
   #       contain _only_ that include directive setting everything else up through profiles)
   
   # only generate path files for user if they will be included
-  if (grep 'include *\$(XDG_CACHE_HOME)/\$(MANDATORY_PATH)' /etc/gconf/2/path 2>&1 > /dev/null ) ||
-     (grep 'include *\$(XDG_CACHE_HOME)/\$(DEFAULTS_PATH)'  /etc/gconf/2/path 2>&1 > /dev/null ) ||
-     (grep 'include *\$(XDG_CACHE_HOME)/\$(MANDATORY_PATH)' /etc/gconf/1/path 2>&1 > /dev/null ) ||
-     (grep 'include *\$(XDG_CACHE_HOME)/\$(DEFAULTS_PATH)'  /etc/gconf/1/path 2>&1 > /dev/null ); then
+  if (grep 'include *\$(ENV_MANDATORY_PATH)' /etc/gconf/2/path 2>&1 > /dev/null ) ||
+     (grep 'include *\$(ENV_DEFAULTS_PATH)'  /etc/gconf/2/path 2>&1 > /dev/null ) ||
+     (grep 'include *\$(ENV_MANDATORY_PATH)' /etc/gconf/1/path 2>&1 > /dev/null ) ||
+     (grep 'include *\$(ENV_DEFAULTS_PATH)'  /etc/gconf/1/path 2>&1 > /dev/null ); then
 
     INCLUDED_HOME=false; 
     
@@ -191,23 +191,23 @@ activate_GCONF () {
     #   Attacker can be $USER hirself (to avoid mandatory settings form sysadmin), or if file is in a
     #   directory that's writeable by someone else a third party
     XDG_CACHE_HOME=${XDG_CACHE_HOME:-$HOME/.cache}; mkdir -p $XDG_CACHE_HOME;
-    MANDATORY_PATH=$(tempfile --directory $XDG_CACHE_HOME);
-    DEFAULTS_PATH=$(tempfile --directory $XDG_CACHE_HOME);
+    export MANDATORY_PATH=$(tempfile --directory $XDG_CACHE_HOME);
+    export DEFAULTS_PATH=$(tempfile --directory $XDG_CACHE_HOME);
     
     # $XDG_CACHE_HOME is not supposed to contain anything that can't be deleted
     # so we can do this to avoid leaving old generated files from previous logins laying around
-    rm $(grep '^# Generated by desktop-profiles package$' $XDG_CACHE_HOME/*);
+    rm -f $(grep '^# Generated by desktop-profiles package$' $XDG_CACHE_HOME/* | cut --delimiter : --fields 1);
     
     # add marker to generated file, both so we can find it again later, and to indicate origin
-    echo "# Generated by desktop-profiles package" > "$XDG_CACHE_HOME/$MANDATORY_PATH";
-    echo "# Generated by desktop-profiles package" > "$XDG_CACHE_HOME/$DEFAULTS_PATH";
+    echo "# Generated by desktop-profiles package" > "$MANDATORY_PATH";
+    echo "# Generated by desktop-profiles package" > "$DEFAULTS_PATH";
     
     cat $GCONF_FILE | while read LINE; do
        if (test "$LINE" != 'xml:readwrite:$(HOME)/.gconf'); then
          if (test $INCLUDED_HOME = false); then
-           echo $LINE >> "$XDG_CACHE_HOME/$MANDATORY_PATH";
+           echo $LINE >> "$MANDATORY_PATH";
          else	 
-           echo $LINE >> "$XDG_CACHE_HOME/$DEFAULTS_PATH";
+           echo $LINE >> "$DEFAULTS_PATH";
          fi;	 
        else  
          INCLUDED_HOME=true;
diff --git a/debian/postinst b/debian/postinst
index 6e92d47..b044b1b 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -12,16 +12,16 @@ if (test "$RET" = true); then
   # if gconf 2 path file is present and doesn't include the generated path file
   # then replace path file
   if (test -e /etc/gconf/2/path) ; then
-    if ! ( (grep 'include *\$(XDG_CACHE_HOME)/\$(MANDATORY_PATH)' /etc/gconf/2/path 2>&1 > /dev/null ) ||
-           (grep 'include *\$(XDG_CACHE_HOME)/\$(DEFAULTS_PATH)'  /etc/gconf/2/path 2>&1 > /dev/null ) ); then
+    if ! ( (grep 'include *\$(ENV_MANDATORY_PATH)' /etc/gconf/2/path 2>&1 > /dev/null ) ||
+           (grep 'include *\$(ENV_DEFAULTS_PATH)'  /etc/gconf/2/path 2>&1 > /dev/null ) ); then
       mv /etc/gconf/2/path /etc/gconf/2/path.pre-desktop-profiles;
       cp /usr/share/desktop-profiles/path /etc/gconf/2/path;
     fi;
   # if gconf 1 path file is present and doesn't include the generated path file
   # then replace path file
-  elif (test -e /etc/gconf/2/path) ; then
-    if ! ( (grep 'include *\$(XDG_CACHE_HOME)/\$(MANDATORY_PATH)' /etc/gconf/1/path 2>&1 > /dev/null ) ||
-           (grep 'include *\$(XDG_CACHE_HOME)/\$(DEFAULTS_PATH)'  /etc/gconf/1/path 2>&1 > /dev/null ) ); then
+  elif (test -e /etc/gconf/1/path) ; then
+    if ! ( (grep 'include *\$(ENV_MANDATORY_PATH)' /etc/gconf/1/path 2>&1 > /dev/null ) ||
+           (grep 'include *\$(ENV_DEFAULTS_PATH)'  /etc/gconf/1/path 2>&1 > /dev/null ) ); then
       mv /etc/gconf/1/path /etc/gconf/1/path.pre-desktop-profiles;
       cp -f /usr/share/desktop-profiles/path /etc/gconf/1/path;
     fi;
diff --git a/path b/path
index 00efef3..aca5dc1 100644
--- a/path
+++ b/path
@@ -11,7 +11,7 @@
 ###############################################################################
 
 # Look for mandatory "configuration sources" from desktop-profiles
-include $(XDG_CACHE_HOME)/$(MANDATORY_PATH)
+include $(ENV_MANDATORY_PATH)
 
 # Now see where users want us to look - basically the user can stick arbitrary 
 # sources in a ~/.gconf.path file and they're inserted here
@@ -21,4 +21,4 @@ include "$(HOME)/.gconf.path"
 xml:readwrite:$(HOME)/.gconf
 
 # Look for default "configuration sources" from desktop-profiles
-include $(XDG_CACHE_HOME)/$(DEFAULTS_PATH)
+include $(ENV_DEFAULTS_PATH)

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/debian-edu/pkg-team/desktop-profiles.git



More information about the debian-edu-commits mailing list