[debian-edu-commits] debian-edu/ 37/183: - Allow disabling/enabling of profile kinds through dpkg-reconfigure - Allow to specify additional directories containing .listing files to use, instead of allowing to specify additional files). And make this work in the Xsession.d script also (instead of only in list-desktop-profiles)

Alexander Alemayhu ccscanf-guest at moszumanska.debian.org
Wed Jun 11 16:48:31 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 75165507f4f4067bac7c1a3ccebc968a996d89bf
Author: Bart Cornelis <cobaco at linux.be>
Date:   Wed Jan 5 21:26:42 2005 +0000

    - Allow disabling/enabling of profile kinds through dpkg-reconfigure
    - Allow to specify additional directories containing .listing files to use,
      instead of allowing to specify additional files). And make this work in
      the Xsession.d script also (instead of only in list-desktop-profiles)
---
 20desktop-profiles_activateDesktopProfiles | 103 +++++++++++++++--------------
 debian/changelog                           |  13 ++--
 debian/config                              |  25 +++++--
 debian/po/nl.po                            |  16 ++++-
 debian/po/templates.pot                    |  19 +++++-
 debian/postinst                            |  35 ++++++++--
 debian/templates                           |  11 +++
 desktop-profiles                           |  49 +++++++-------
 list-desktop-profiles                      |   7 +-
 list-desktop-profiles.1                    |   9 +--
 listingmodule                              |  32 +++++++--
 11 files changed, 207 insertions(+), 112 deletions(-)

diff --git a/20desktop-profiles_activateDesktopProfiles b/20desktop-profiles_activateDesktopProfiles
index 9beb7c4..c7a9c22 100644
--- a/20desktop-profiles_activateDesktopProfiles
+++ b/20desktop-profiles_activateDesktopProfiles
@@ -9,7 +9,9 @@
 # (c) 2004 Bart Cornelis <cobaco AT skolelinux no>
 ###############################################################################
 
+########################################################
 # get utility functions for working with .listing files
+########################################################
 LIB=/usr/share/desktop-profiles/listingmodule;
 if (test -r $LIB); then
   . $LIB;
@@ -18,35 +20,13 @@ else
   errormsg "Shell library $LIB is missing! No desktop profiles will be activated.";
 fi;
 
-
-#################################
-# Check if user set any defaults
-#################################
-if (test -r /etc/default/desktop-profiles); then
-  . /etc/default/desktop-profiles;
-fi;  
-
-#################################################
-# Make sure the variable we need are initialized
-#################################################
-  LISTINGS_DIR=${LISTINGS_DIR:-'/etc/desktop-profiles'}
-  PROFILE_PATH_FILES_DIR=${PROFILE_PATH_FILES_DIR:-'/var/cache/desktop-profiles/'}
-
-  # if nothing specified use by default
-  USE_KDE_PROFILES=${USE_KDE_PROFILE:-'true'}
-  USE_XDG_PROFILES=${USE_XDG_PROFILE:-'true'}
-  USE_ROX_PROFILES=${USE_ROX_PROFILE:-'true'}
-  USE_UDE_PROFILES=${USE_UDE_PROFILE:-'true'}
-  USE_GCONF_PROFILES=${USE_GCONF_PROFILE:-'true'}
-
-
-#################################################
-# $1 = Profile-kind 
-#      (KDE, ROX, GCONF, XDG_DATA or XDG_CONFIG)
-#################################################
+############################################################
+# get the listings for all profiles of the kind given as $1 
+# $1 = one of (KDE, ROX, UDE, GCONF, XDG_DATA or XDG_CONFIG)
+############################################################
 get_profiles() {
   (# get profiles that are have fulfilled requirements
-     cat `ls $LISTINGS_DIR/*.listing` | grep -v "^#" | while read PROFILE; do
+     cat `ls $LISTINGS_DIRS/*.listing` | grep -v "^#" | while read PROFILE; do
       if (test_profile_requirements "$PROFILE"); then
         echo $PROFILE;      
       fi;  
@@ -65,53 +45,53 @@ get_profiles() {
   done;  
 }
 
-###########################################################################
-# Activate Profiles
-# -> if there was no setting disabling the profile kind
-# -> not setting variables if they would be empty or equal to the default
-# -> not generating gconf path files if they won't be included
-###########################################################################
-if(test "$USE_KDE_PROFILES" = "true"); then
+##########################################################
+# Functions for activating the different kinds of profile
+##########################################################
+DEFAULT_LISTING=/etc/desktop-profiles/desktop-profiles.listing
+activate_KDE () {
   KDEDIRS=`get_profiles KDE | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"`
   if (test "$KDEDIRS"x != x) &&
-     (test "$KDEDIRS" != "`cat $LISTINGS_DIR/default.listing | grep "^kde-prefix" | cut --fields 2 --delimiter ";"`"); then
+     (test "$KDEDIRS" != "`cat $DEFAULT_LISTING | grep "^kde-prefix" | cut --fields 2 --delimiter ";" | sed -e  "s/^ *//" -e "s/ *$//" -e "s/ /:/g"`"); then
     KDEDIRS=$(sh -c "echo $KDEDIRS");# FORCE expansion of variables in KDEDIRS if any
     export KDEDIRS;
   fi;
-fi;  
+}
 
-if(test "$USE_XDG_PROFILES" = "true"); then
+activate_XDG_CONFIG () {
   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 $LISTINGS_DIR/default.listing | grep "^default-xdg_config_dirs" | cut --fields 2 --delimiter ";" | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"`"); then
+     (test "$XDG_CONFIG_DIRS" != "`cat $DEFAULT_LISTING | grep "^default-xdg_config_dirs" | cut --fields 2 --delimiter ";" | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"`"); then
     XDG_CONFIG_DIRS=$(sh -c "echo $XDG_CONFIG_DIRS");# FORCE expansion of variables in XDG_CONFIG_DIRS if any
     export XDG_CONFIG_DIRS;
   fi;
+}
 
+activate_XDG_DATA () {
   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 $LISTINGS_DIR/default.listing | grep "^default-xdg_data_dirs" | cut --fields 2 --delimiter ";" | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"`"); then
+     (test "$XDG_DATA_DIRS" != "`cat $DEFAULT_LISTING | grep "^default-xdg_data_dirs" | cut --fields 2 --delimiter ";" | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"`"); then
     XDG_DATA_DIRS=$(sh -c "echo $XDG_DATA_DIRS");# FORCE expansion of variables in XDG_DATA_DIRS if any
     export XDG_DATA_DIRS;
   fi;
-fi;  
+}
 
-if(test "$USE_ROX_PROFILES" = "true"); then
+activate_ROX () {
   CHOICESPATH=`get_profiles ROX | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"`
-  DEFAULT_CHOICES=$(cat $LISTINGS_DIR/default.listing | grep '^default-rox-system;' | cut --field 2 --delimiter ";" | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g")
-  DEFAULT_CHOICES="$(cat $LISTINGS_DIR/default.listing | grep '^default-rox-user;' | cut --field 2 --delimiter ";" | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"):$DEFAULT_CHOICES"
+  DEFAULT_CHOICES=$(cat $DEFAULT_LISTING | grep '^default-rox-system;' | cut --field 2 --delimiter ";" | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g")
+  DEFAULT_CHOICES="$(cat $DEFAULT_LISTING | grep '^default-rox-user;' | cut --field 2 --delimiter ";" | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /:/g"):$DEFAULT_CHOICES"
   if (test "$CHOICESPATH"x != x) &&
      (test "$CHOICESPATH" != "$DEFAULT_CHOICES"); then
     CHOICESPATH=$(sh -c "echo $CHOICESPATH");# FORCE expansion of variables in CHOICESPATH if any
     export CHOICESPATH;
   fi;
-fi;  
+}
 
-if(test "$USE_UDE_PROFILES" = "true"); then
+activate_UDE () {
   # don't s/ /:g/ in next line, UDE doesn't currently support combining profile dirs
   UDEDIRS=`get_profiles UDE | sed -e "s/^ *//" -e "s/ *$//"`
   if (test "$UDEDIRS"x != x) &&
-     (test "$UDEDIRS" != "`cat $LISTINGS_DIR/default.listing | grep "^ude-install-dir" | cut --fields 2 --delimiter ";"`"); then
+     (test "$UDEDIRS" != "`cat $DEFAULT_LISTING | grep "^ude-install-dir" | cut --fields 2 --delimiter ";"`"); then
     # Take first dir and break, as UDE currently only supports one dir
     for dir in $UDEDIRS; do 
       UDEdir=$dir;
@@ -120,9 +100,9 @@ if(test "$USE_UDE_PROFILES" = "true"); then
     UDEdir=$(sh -c "echo $UDEdir");# FORCE expansion of variables in UDEdir if any
     export UDEdir;
   fi;
-fi;  
+}
 
-if(test "$USE_GCONF_PROFILES" = "true"); then
+activate_GCONF () {
   # HACK WARNING:
   #
   # While GCONF allows multiple "configuration sources", there seems to be no clean way to
@@ -156,4 +136,29 @@ if(test "$USE_GCONF_PROFILES" = "true"); then
        fi  
     done;
   fi;  
-fi;  
+}
+
+#####################
+# Start of execution
+#####################
+
+  #################################
+  # Check if user set any defaults
+  #################################
+  if (test -r /etc/default/desktop-profiles); then
+    . /etc/default/desktop-profiles;
+  fi;  
+
+  #################################################
+  # Make sure the variable we need are initialized
+  #################################################
+  LISTINGS_DIRS=${LISTINGS_DIRS:-'/etc/desktop-profiles'}
+  PROFILE_PATH_FILES_DIR=${PROFILE_PATH_FILES_DIR:-'/var/cache/desktop-profiles/'}
+  ACTIVE_PROFILE_KINDS=${ACTIVE_PROFILE_KINDS:-''}
+
+  ################################
+  # Actual activation of profiles
+  ################################
+  for KIND in $ACTIVE_PROFILE_KINDS; do
+    activate_$KIND;
+  done;
diff --git a/debian/changelog b/debian/changelog
index 0e0359d..3e61a3e 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -1,10 +1,15 @@
 desktop-profiles (1.2-1) unstable; urgency=low
 
   * Added kommander GUI for managing the /etc/desktop-profiles/*.listing files
-  * Added debhelper program for installing .listing files
-  * Follow own recommendation on naming of .listing files
-
- -- Bart Cornelis (cobaco) <cobaco at linux.be>  Mon, 27 Dec 2004 21:31:23 +0100
+  * Added debhelper program for installing .listing files (and use it)
+  * Add medium priority debconf questions to allow using dpkg-reconfigure to
+    manage the profile kinds in use. I Should probably extend this to allow 
+    full handling of the configuration file through debconf, but this is the 
+    only option that should be routinely changed.
+  * Make it possible to specify additional directories containg .listing files
+    (usefull for testing)
+
+ -- Bart Cornelis (cobaco) <cobaco at linux.be>  Wed,  5 Jan 2005 22:09:04 +0100
 
 desktop-profiles (1.1-2) unstable; urgency=low
 
diff --git a/debian/config b/debian/config
index 277bbcb..aa7cb7f 100755
--- a/debian/config
+++ b/debian/config
@@ -4,17 +4,32 @@
 . /usr/share/debconf/confmodule
 
 # if gconf path file is present and doesn't include the generated path file
-# ask wether to activate gnome profiles (defaults to no)
+# then ask the user wether to activate gnome profiles (defaults to no)
 if (test -e /etc/gconf/2/path) ; then
   if ! ( (grep '/var/cache/desktop-profiles/\$(USER)_mandatory.path' /etc/gconf/2/path > /dev/null) ||
          (grep '/var/cache/desktop-profiles/\$(USER)_defaults.path'  /etc/gconf/2/path > /dev/null) ); then
-    db_input medium desktop-profiles/replace-gconf-system-wide-path-file || true
-    db_go
+    db_input medium desktop-profiles/replace-gconf-system-wide-path-file || true;
+    db_go || true;
   fi;
 elif (test -e /etc/gconf/2/path) ; then
   if ! ( (grep '/var/cache/desktop-profiles/\$(USER)_mandatory.path' /etc/gconf/1/path > /dev/null) ||
          (grep '/var/cache/desktop-profiles/\$(USER)_defaults.path'  /etc/gconf/1/path > /dev/null) ); then
-    db_input medium desktop-profiles/replace-gconf-system-wide-path-file || true
-    db_go
+    db_input medium desktop-profiles/replace-gconf-system-wide-path-file || true;
+    db_go || true;
   fi;
 fi;  
+
+# override defaults with actual values from config file (if it's present)
+if (test -e /etc/default/desktop-profiles); then
+  . /etc/default/desktop-profiles || true;
+  
+  # change contents of variable to listformat expected by debconf
+  # (i.e. separate with ', ' instead of just ' ')
+  ACTIVE_PROFILE_KINDS="$(echo "$ACTIVE_PROFILE_KINDS" | sed -e "s/^ *//" -e "s/ *$//" -e "s/ /, /g")";
+  db_set desktop-profiles/active-profile-kinds "$ACTIVE_PROFILE_KINDS";
+fi;
+
+# Allow user to change the configuration values
+db_input medium desktop-profiles/active-profile-kinds || true;
+db_go || true;
+
diff --git a/debian/po/nl.po b/debian/po/nl.po
index f5639bf..4fadcd0 100644
--- a/debian/po/nl.po
+++ b/debian/po/nl.po
@@ -15,8 +15,8 @@ msgid ""
 msgstr ""
 "Project-Id-Version: desktop-profiles\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2004-10-24 21:18+0200\n"
-"PO-Revision-Date: 2004-10-24 21:18+0100\n"
+"POT-Creation-Date: 2005-01-05 20:53+0100\n"
+"PO-Revision-Date: 2005-01-05 21:21+0100\n"
 "Last-Translator: Bart Cornelis <cobaco at linux.be>\n"
 "Language-Team: debian-l10n-dutch <debian-l10n-dutch at lists.debian.org>\n"
 "MIME-Version: 1.0\n"
@@ -27,7 +27,7 @@ msgstr ""
 #. Type: boolean
 #: ../templates:4
 msgid "Replace the default system-wide path file?"
-msgstr ":Systeemwijd 'path'-bestand vervangen?"
+msgstr "Systeemwijd 'path'-bestand vervangen?"
 
 #. Type: boolean
 #: ../templates:4
@@ -44,3 +44,13 @@ msgstr "Dit veranderdt het standaardgedrag van gconf niet, maar laat wel toe om
 msgid "You can always do this later by running `dpkg-reconfigure desktop-profiles', or by manually replacing /etc/gconf/<gconf-version>/path with /usr/share/doc/desktop-profiles/examples/path."
 msgstr "U kunt dit altijd later doen via het commando 'desktop-reconfigure desktop-profiles', of door handmatig /etc/gconf/<gconf-version>path te vervangen door /usr/share/doc/desktop-profiles/examples/path"
 
+#. Type: multiselect
+#: ../templates:23
+msgid "Which profile kinds do you want to enable?"
+msgstr "Welke profiel-soorten wilt u inschakelen?"
+
+#. Type: multiselect
+#: ../templates:23
+msgid "Disabling profile kinds you won't use will improve performance of the  Xsession.d script of this package (and thus of X startup). Thus it is wise to only activate profiles kinds that will be used by the  programs you'll run. (e.g. most people won't have any ROX or UDE apps installed in which case those 2 profile kinds shouldn't be enabled)."
+msgstr "Uitschakelen van profiel-soorten die niet gebruikt zullen worden versnelt de uitvoering van het 'Xsession.d'-script van dit pakket (en dus het opstarten van de grafische interface). Om die reden kunt u best enkel die profiel-soorten activeren die van belang zijn voor de door u gebruikte programma's (vb. tenzij u een van de weinigen bent die ROX- of UDE-programma's ge�nstalleerd heeft, kunt u deze profiel-soorten best niet activeren)."
+
diff --git a/debian/po/templates.pot b/debian/po/templates.pot
index dc26d99..8b923b6 100644
--- a/debian/po/templates.pot
+++ b/debian/po/templates.pot
@@ -16,7 +16,7 @@ msgid ""
 msgstr ""
 "Project-Id-Version: PACKAGE VERSION\n"
 "Report-Msgid-Bugs-To: \n"
-"POT-Creation-Date: 2004-10-24 21:18+0200\n"
+"POT-Creation-Date: 2005-01-05 20:53+0100\n"
 "PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
 "Last-Translator: FULL NAME <EMAIL at ADDRESS>\n"
 "Language-Team: LANGUAGE <LL at li.org>\n"
@@ -58,3 +58,20 @@ msgid ""
 "or by manually replacing /etc/gconf/<gconf-version>/path with /usr/share/doc/"
 "desktop-profiles/examples/path."
 msgstr ""
+
+#. Type: multiselect
+#. Description
+#: ../templates:23
+msgid "Which profile kinds do you want to enable?"
+msgstr ""
+
+#. Type: multiselect
+#. Description
+#: ../templates:23
+msgid ""
+"Disabling profile kinds you won't use will improve performance of the  "
+"Xsession.d script of this package (and thus of X startup). Thus it is wise "
+"to only activate profiles kinds that will be used by the  programs you'll "
+"run. (e.g. most people won't have any ROX or UDE apps installed in which "
+"case those 2 profile kinds shouldn't be enabled)."
+msgstr ""
diff --git a/debian/postinst b/debian/postinst
index 94bf9ce..ffb2df7 100755
--- a/debian/postinst
+++ b/debian/postinst
@@ -3,6 +3,10 @@
 # source debconf library
 . /usr/share/debconf/confmodule
 
+#############################################################
+# Change default gconf path file so it uses desktop-profiles
+# IF (and only if) the user explicitly agreed to this
+#############################################################
 db_get desktop-profiles/replace-gconf-system-wide-path-file || true
 if (test "$RET" = true); then
   # if gconf 2 path file is present and doesn't include the generated path file
@@ -10,18 +14,41 @@ if (test "$RET" = true); then
   if (test -e /etc/gconf/2/path) ; then
     if ! ( (grep '/var/cache/desktop-profiles/\$(USER)_mandatory.path' /etc/gconf/2/path > /dev/null) ||
            (grep '/var/cache/desktop-profiles/\$(USER)_defaults.path'  /etc/gconf/2/path > /dev/null) ); then
-      mv /etc/gconf/2/path /etc/gconf/2/path.pre-desktop-profiles
-      cp /usr/share/doc/desktop-profiles/examples/path /etc/gconf/2/path
+      mv /etc/gconf/2/path /etc/gconf/2/path.pre-desktop-profiles;
+      cp /usr/share/doc/desktop-profiles/examples/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 '/var/cache/desktop-profiles/\$(USER)_mandatory.path' /etc/gconf/1/path > /dev/null) ||
            (grep '/var/cache/desktop-profiles/\$(USER)_defaults.path'  /etc/gconf/1/path > /dev/null) ); then
-      mv /etc/gconf/2/path /etc/gconf/1/path.pre-desktop-profiles
-      cp -f /usr/share/doc/desktop-profiles/examples/path /etc/gconf/1/path
+      mv /etc/gconf/2/path /etc/gconf/1/path.pre-desktop-profiles;
+      cp -f /usr/share/doc/desktop-profiles/examples/path /etc/gconf/1/path;
     fi;
   fi;  
 fi;
 
+###############################################################################
+# Adapt config-file as indicated by user answers to debconf questions
+#
+# The cp + mv are to ensures we do not mess up the config file's ownership and
+# permissions.
+###############################################################################
+CONFIGFILE=/etc/default/desktop-profiles
+
+cp -a -f $CONFIGFILE $CONFIGFILE.tmp
+  # Sync (possibly modified) debconf db setting for which profile kinds to 
+  # activate with the config file (from which that settings was initialized)
+  db_get desktop-profiles/active-profile-kinds  
+  ACTIVE_PROFILE_KINDS="$( echo "$RET" | sed 's/, / /g' )"; # switch from debconf listformat to shell listformat
+
+  if (grep -Eq '^ *ACTIVE_PROFILE_KINDS=' $CONFIGFILE); then 
+    cat $CONFIGFILE | sed -e "s/^ *ACTIVE_PROFILE_KINDS=.*/ACTIVE_PROFILE_KINDS=\"$ACTIVE_PROFILE_KINDS\"/" > $CONFIGFILE.tmp;
+  else
+    echo "ACTIVE_PROFILE_KINDS=\"$ACTIVE_PROFILE_KINDS\"" >> $CONFIGFILE.tmp;
+  fi;  
+
+  #FIXME: rest of values in config file maybe
+mv -f $CONFIGFILE.tmp $CONFIGFILE
+
 #DEBHELPER#
diff --git a/debian/templates b/debian/templates
index 7286726..54fb4cd 100644
--- a/debian/templates
+++ b/debian/templates
@@ -15,3 +15,14 @@ _Description: Replace the default system-wide path file?
  You can always do this later by running `dpkg-reconfigure desktop-profiles',
  or by manually replacing /etc/gconf/<gconf-version>/path with
  /usr/share/doc/desktop-profiles/examples/path.
+
+Template: desktop-profiles/active-profile-kinds
+Type: multiselect
+Choices: XDG_CONFIG, XDG_DATA, KDE, GCONF, ROX, UDE
+Default: XDG_CONFIG, XDG_DATA, KDE, GCONF
+_Description: Which profile kinds do you want to enable?
+ Disabling profile kinds you won't use will improve performance of the 
+ Xsession.d script of this package (and thus of X startup). 
+ Thus it is wise to only activate profiles kinds that will be used by the
+ programs you'll run. (e.g. most people won't have any ROX or UDE apps 
+ installed in which case those 2 profile kinds shouldn't be enabled).
diff --git a/desktop-profiles b/desktop-profiles
index 1be23d1..9826143 100644
--- a/desktop-profiles
+++ b/desktop-profiles
@@ -4,37 +4,34 @@
 # Should only contain shell variables and comments
 ###################################################################
 
-# probably not a good idea to change this one
-# tells the various scripts where to find the .listing files
-LISTINGS_DIR=/etc/desktop-profiles
+##################################################################
+# General settings (i.e. applying to all scripts in this package)
+##################################################################
+
+# Takes a (space separated) list of directories. Each of the dirs listed will
+# be searched for .listing files, all found .listing files will be used by
+# default.
+LISTINGS_DIRS="/etc/desktop-profiles"
 
 #################################
 # SETTINGS FOR xsession.d script
 #################################
-# Note: you probably don't want to disable a profile kind unless you are sure
-# your users won't run any programs of the corresponding desktop
-
-# uncomment to have the xsession.d script ignore kde profiles 
-#USE_KDE_PROFILES=false
-
-# uncomment to have the xsession.d script ignore xdg profiles 
-#USE_XDG_PROFILES=false
-
-# uncomment to have the xsession.d script ignore rox profiles 
-#USE_ROX_PROFILES=false
 
-# uncomment to have the xsession.d script ignore ude profiles 
-#USE_UDE_PROFILES=false
-
-# uncomment to have the xsession.d script ignore gconf(gnome) profiles 
-#USE_GCONF_PROFILES=false
-
-#####################################
-# SETTINGS FOR list-desktop-profiles
-#####################################
-
-# also use specified .listing files not in LISTINGS_DIR
-#EXTRA_LISTINGS=
+# The set [KDE, GCONF, XDG_CONFIG, XDG_DATA, ROX, UDE] defines the valid 
+# profile kinds. The following variable contains the subset of profile kinds
+# for which you want to activate the profiles.
+#
+# Disabling profile kinds you won't use will improve performance of the
+# Xsession.d script (and thus X startup). Thus it is wise to only activate 
+# profile kinds that will be used by the programs you'll run 
+# (e.g. most people won't have any ROX or UDE apps installed in which case 
+# those 2 profile kinds probably shouldn't be enabled).
+ACTIVE_PROFILE_KINDS="KDE XDG_CONFIG XDG_DATA GCONF"
+
+##############################################
+# SETTINGS FOR list-desktop-profiles 
+# (and by extension the kommander gui script)
+##############################################
 
 # which field do we sort on by default?
 #SORT_KEY=1
diff --git a/list-desktop-profiles b/list-desktop-profiles
index 332ba7a..c1497e1 100644
--- a/list-desktop-profiles
+++ b/list-desktop-profiles
@@ -21,8 +21,6 @@ Usage: list-desktop-profiles [OPTIONS]
 Options controlling the used .listing files:
   -d | --directory: directory where to look for .listing files
                     (default=/etc/desktop-profiles)
-  -f | --file     : profiles in the .listing file that is the next argument 
-                    will also be taken into account (may appear more then once)
   
 Options for filtering the shown profiles:
   -c, --comment | --description: 
@@ -80,10 +78,8 @@ while test $# -ge 1; do
     fi;
     
     case $1 in
-	-d | --directory) LISTINGS_DIR="$2" ;;
+	-d | --directory) LISTINGS_DIRS="$2 $LISTINGS_DIRS" ;;
 	
-	-f | --file) EXTRA_LISTINGS="$2 $EXTRA_LISTINGS" ;;
-
 	-c | --comment | --description) DESCRIPTION_FILTER="$2"	;;
 	
 	-k | --kind) KIND_FILTER="$2" ;;
@@ -142,4 +138,3 @@ fi;
 # use utility function to give user what he wants (we set up the environment
 # variables to control the function output in the commandline parsing)
 filter_listings;
-
diff --git a/list-desktop-profiles.1 b/list-desktop-profiles.1
index 0baf0c1..bbd7a0c 100644
--- a/list-desktop-profiles.1
+++ b/list-desktop-profiles.1
@@ -51,12 +51,7 @@ Limit shown profiles to those for which the given user meets the requirements. (
 .PP
 -d <dir>, --directory <dir>
 .IP
-Also use .listing files found in the given directory
-
-.PP
--f <path>, --file <path> 
-.IP
-Also use the specified .listing file
+Also use .listing files found in the given directory. This option can be used multiple times to add more then 1 additional directory
 
 .PP
 -e <formatstring>, --entry-format <formatstring>
@@ -66,7 +61,7 @@ Show profile information according to the specified format spring (instead of ju
 .PP
 -s <fieldname>, --sort-key <fieldname>
 .IP
-Sort output on the requested field (fieldname is one of name, location, precedence, requirements, kind, or description.
+Sort output on the requested field (fieldname is one of name, location, precedence, requirements, kind, or description).
 
 .SH EXAMPLES
 .PP
diff --git a/listingmodule b/listingmodule
index 5ab47b2..a5fc58d 100644
--- a/listingmodule
+++ b/listingmodule
@@ -12,6 +12,8 @@
 #    - for_each_requirement: first argument is a list of requirements, second
 #                            argument is a command to be executed once for 
 #                            each requirement (with requirement as argument)
+#    - list_listings: returns a space separated list of all .listing files
+#                     found in the directories contained in $LISTINGS_DIRS
 #    - filter_listings: returns matching profiles from the available listing
 #                       files (output influenced by a number of environment
 #                       variables, see below for a list)
@@ -149,6 +151,21 @@ test_profile_requirements() {
   exit;      
 }
 
+################################################################################
+# outputs a space separated list of all .listing files found in the directories
+# contained in $LISTINGS_DIRS
+################################################################################
+list_listings () {
+  # Make sure the variable we need are initialized
+  LISTINGS_DIRS=${LISTINGS_DIRS:-'/etc/desktop-profiles'}
+
+  for DIR in "$LISTINGS_DIRS"; do
+    echo -n $(ls -1 $DIR/*.listing);
+  done;
+  
+  echo;
+}
+
 ###############################################################################
 # filter_listings() - filters the profiles in the .listing files 
 #                     (criteria and output-format are set through a number of
@@ -173,8 +190,8 @@ test_profile_requirements() {
 #   sorting on the precedence field (3) you probably want to set this to
 #   '--general-numeric-sort --reverse')
 # - EXTRA_LISTINGS: may contain a comma-separated list of extra (outside the 
-#   $LISTINGS_DIR) .listing files to be taken into account.
-# - LISTINGS_DIR: the directory containing the .listing files to include 
+#   $LISTINGS_DIRS) .listing files to be taken into account.
+# - LISTINGS_DIRS: the directory containing the .listing files to include 
 #   (defaults to '/etc/desktop-profiles', probably shouldn't be changed ever)
 #
 # In absence of any set variables it will just output all available profiles
@@ -185,8 +202,8 @@ test_profile_requirements() {
 ###############################################################################
 filter_listings () {
   # Make sure the variable we need are initialized
-  LISTINGS_DIR=${LISTINGS_DIR:-'/etc/desktop-profiles'}
-  EXTRA_LISTINGS=${EXTRA_LISTINGS:-''}
+  #LISTINGS_DIRS=${LISTINGS_DIRS:-'/etc/desktop-profiles'}
+  #EXTRA_LISTINGS=${EXTRA_LISTINGS:-''}
 
   SORT_KEY=${SORT_KEY:-1}
   SORT_ARGS=${SORT_ARGS:-''}
@@ -201,9 +218,10 @@ filter_listings () {
   OUR_USER=${OUR_USER:-''}
 
   FORMAT=${FORMAT:-'$NAME\;$LOCATION\;$PRECEDENCE\;$REQUIREMENTS\;$KIND\;$DESCRIPTION'};
-
+  
+  LISTINGS_LIST=$(list_listings)
   # do the filtering
-  cat $(ls $LISTINGS_DIR/*.listing) $EXTRA_LISTINGS |  grep -v -e "^#" -e "^ *$" | sort $SORT_ARGS --key="$SORT_KEY" --field-separator=';' | \
+  cat $LISTINGS_LIST |  grep -v -e "^#" -e "^ *$" | sort $SORT_ARGS --key="$SORT_KEY" --field-separator=';' | \
   while read PROFILE; do
     # split fields
     export NAME="`echo $PROFILE | cut --delimiter ';' --fields 1`";
@@ -213,7 +231,7 @@ filter_listings () {
     export KIND="`echo $PROFILE | cut --delimiter ';' --fields 5`";
     export DESCRIPTION="`echo $PROFILE | cut --delimiter ';' --fields 6`";
 
-    export FILE=`grep -l "^$NAME;" $LISTINGS_DIR/*.listing $EXTRA_LISTINGS`;
+    export FILE=`grep -l "^$NAME;" $LISTINGS_LIST`;
 
     if (test "$PRECEDENCE"x = x); then 
       #unset = lower then anything, so set to insanely low value

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