[debian-edu-commits] debian-edu/ 14/183: - Don't set environment variables when equal to default (when default contains multiple dirs) - Don't complain when /etc/gconf/1/path or /etc/gconf/2/path aren't present - Add pointers to man page - Rewrite several comments/explanations somewhat

Alexander Alemayhu ccscanf-guest at moszumanska.debian.org
Wed Jun 11 16:48:29 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 9bbee56d757b81cf42da42244e2e35245001dd78
Author: Bart Cornelis <cobaco at linux.be>
Date:   Thu Oct 21 17:42:02 2004 +0000

    - Don't set environment variables when equal to default (when default
    contains multiple dirs)
    - Don't complain when /etc/gconf/1/path or /etc/gconf/2/path aren't present
    - Add pointers to man page
    - Rewrite several comments/explanations somewhat
---
 20desktop-profiles_activateDesktopProfiles | 43 ++++++++++++++++++------------
 default.listing                            | 16 ++++++-----
 2 files changed, 35 insertions(+), 24 deletions(-)

diff --git a/20desktop-profiles_activateDesktopProfiles b/20desktop-profiles_activateDesktopProfiles
index 7fe15b2..6c0df13 100644
--- a/20desktop-profiles_activateDesktopProfiles
+++ b/20desktop-profiles_activateDesktopProfiles
@@ -1,13 +1,19 @@
 #! /bin/sh
 #
-# Script to set the KDEDIRS, XDG_CONFIG_DIRS, and XDG_DATA_DIRS environment 
-# based on the profile-requirements stated in the profile listings.
+# Script to activate profiles (i.e. conditional setup) for the various desktop
+# environments in Debian based on the data in the *.listing files in the
+# /etc/desktop-profiles directory.
+#
+# See the desktop-profiles (7) man page for an overview of how this works
 #
 # (c) 2004 Bart Cornelis <cobaco AT skolelinux no>
 ###############################################################################
 
+# Where do we look for .listing files
 PROFILE_DIR="/etc/desktop-profiles";
-LISTINGS=`ls $PROFILE_DIR/*.listing`;
+
+# Where do we place the generated path file for gnome (if any)
+PROFILE_PATH_FILE="/var/cache/desktop-profiles/${USER}_profiles.path"
 
 ######################################################################
 # $1 = requirement
@@ -71,7 +77,7 @@ get_profiles_with_fulfilled_requirements () {
   #####################
   #for each profile do
   #####################
-  cat $LISTINGS | grep -v ^# | while read PROFILE; do
+  cat `ls $PROFILE_DIR/*.listing` | grep -v ^# | while read PROFILE; do
     PROFILE_REQUIREMENTS="`echo $PROFILE | cut --fields 4 --delimiter ";"`";
 
     #########################################################
@@ -158,19 +164,19 @@ fi;
 
 XDG_CONFIG_DIRS=`get_profiles XDG_CONFIG | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"`
 if (test "$XDG_CONFIG_DIRS"x != x) &&
-   (test "$XDG_CONFIG_DIRS" != "`cat $PROFILE_DIR/default.listing | grep "^default-xdg_config_dirs" | cut --fields 2 --delimiter ";"`"); then
+   (test "$XDG_CONFIG_DIRS" != "`cat $PROFILE_DIR/default.listing | grep "^default-xdg_config_dirs" | cut --fields 2 --delimiter ";" | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"`"); then
   export XDG_CONFIG_DIRS;
 fi;
 
 XDG_DATA_DIRS=`get_profiles XDG_DATA | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"`
 if (test "$XDG_DATA_DIRS"x != x) &&
-   (test "$XDG_DATA_DIRS" != "`cat $PROFILE_DIR/default.listing | grep "^default-xdg_data_dirs" | cut --fields 2 --delimiter ";"`"); then
+   (test "$XDG_DATA_DIRS" != "`cat $PROFILE_DIR/default.listing | grep "^default-xdg_data_dirs" | cut --fields 2 --delimiter ";" | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"`"); then
   export XDG_DATA_DIRS;
 fi;
 
-CHOICESPATH==`get_profiles ROX | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"`
+CHOICESPATH=`get_profiles ROX | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"`
 if (test "$CHOICESPATH"x != x) &&
-   (test "$CHOICESPATH" != "`cat $PROFILE_DIR/default.listing | grep "^default-choicespath" | cut --fields 2 --delimiter ";"`"); then
+   (test "$CHOICESPATH" != "`cat $PROFILE_DIR/default.listing | grep "^default-choicespath" | cut --fields 2 --delimiter ";" | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"`"); then
   # Rox doesn't have a seperate variable for the user settings, they need to be added here
   # -> add default location for ROX user settings 
   CHOICESPATH=${HOME}/Choices:$CHOICESPATH
@@ -178,15 +184,18 @@ if (test "$CHOICESPATH"x != x) &&
 fi;
 
 # HACK WARNING:
-# While GCONF allows multiple "configuration sources", there seems to be no way to make
-# the used "configuration sources" dependend on a condition (such as group membership).
-# To get around this we generate at login a path file with the directives for the active
-# profiles. For this to work the system-wide path file (/etc/gconf/2/path) needs to 
-# contain a include directive for this generated file. (if the default.listing file in
-# /etc/desktop-profiles is unchanged it should _only_ contain the include directive)
-PROFILE_PATH_FILE="/var/cache/desktop-profiles/${USER}_profiles.path"
+#
+# While GCONF allows multiple "configuration sources", there seems to be no clean way to
+# make the used "configuration sources" dependend on a condition (such as group membership).
+# One dirty way to get this ability is to generate a path file at login which will include
+# directives activating the profiles that have their requirements met.
+#
+# NOTE: this alone isn't enough, the system-wide path file (/etc/gconf/<gconf-version>/path)
+#       needs to contain a include directive for this generated file. (preferably it should 
+#       contain _only_ that include directive setting everything else up through profiles)
+
 # only generate path files for user if it will be included
-if (cat /etc/gconf/2/path | grep '/var/cache/desktop-profiles/\$(USER)_profiles.path' > /dev/null ) ||
-   (cat /etc/gconf/1/path | grep '/var/cache/desktop-profiles/\$(USER)_profiles.path' > /dev/null ) ; then
+if (cat /etc/gconf/2/path 2>&1 | grep '/var/cache/desktop-profiles/\$(USER)_profiles.path' > /dev/null ) ||
+   (cat /etc/gconf/1/path 2>&1 | grep '/var/cache/desktop-profiles/\$(USER)_profiles.path' > /dev/null ) ; then
   get_profiles GCONF > $PROFILE_PATH_FILE;
 fi;  
diff --git a/default.listing b/default.listing
index 2017ad7..b3ec98e 100644
--- a/default.listing
+++ b/default.listing
@@ -1,15 +1,17 @@
-# Add profiles for the system-wide settings:
-# - KDEDIRS defauls to the prefix used on compilation, which is '/usr' on a
-#   Debian system
-# - XDG_CONFIG_DIRS and XDG_DATA_DIRS have a default value specified in the
-#   'XDG Base Directory Specification'
+# This files specifies details the default system-wide settings, main use of 
+# profiles in here is to be able to use the default system settings as a 
+# fallback for anything that isn't defined in activated profiles.
+#
 # - CHOICESPATH (the ROX variable) defaults to 
 #   ${HOME}/Choices:/usr/local/share/Choices:/usr/share/Choices
 #   -> we don't add the first dir with the user-settings here, the dir with the
-#      userspecific settings is added as the first dir in CHOICESPATH first by
+#      userspecific settings is added as the first dir in CHOICESPATH by
 #      the Xsession.d script
+#
+# See the desktop-profiles (7) man page for details about the format of this 
+# file, and how it will be used
 ################################################################################
-kde-prefix;/usr;;;KDE;System-wide kde stuff on Debian
+kde-prefix;/usr;;;KDE;System-wide kde stuff on Debian (stuff in PREFIX)
 default-xdg_config_dirs;/etc/xdg;;;XDG_CONFIG;Default config location defined by XDG Base Directory Specification
 default-xdg_data_dirs;/usr/local/share /usr/share;;;XDG_DATA;Default data locations defined by XDG Base Directory Specification
 default-choicespath;/usr/local/share/Choices /usr/share/Choices;;;ROX;Default locations for non-user settings of ROX programs

-- 
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