tag 899178 + patch
thanks

jftr, here's a patch for this. I'll send a merge request on salsa later on.

Regards,
Daniel
commit e561fc3f5ef81afa43cbe1746642ce663c491bdf
Author: Daniel Baumann <daniel.baum...@progress-linux.org>
Date:   Tue May 29 05:47:00 2018 +0200

    Updating config_files_path.patch to also include /etc/powerline as configuration directory (Closes: #899178).
    
    Previously, only user specific configurations could be stored in
    ~/.config/powerline. Now /etc/powerline can additionally be used
    as configuration directory which is system specific but applying
    globally for all users at the same time.
    
    The priority is now as follows (the later overwriting the
    previous):
    
      1. /usr/share/powerline/config_files
      2. /etc/powerline
      3. ~/.config/powerline
    
    Signed-off-by: Daniel Baumann <daniel.baum...@progress-linux.org>

diff --git a/debian/patches/config_files_path.patch b/debian/patches/config_files_path.patch
index d0ea015..eeae03f 100644
--- a/debian/patches/config_files_path.patch
+++ b/debian/patches/config_files_path.patch
@@ -2,16 +2,17 @@ Description: Adds Debian configuration path
 Bug-Debian: https://bugs.debian.org/758551
 Author: Jerome Charaoui <jer...@riseup.net>
 Forwarded: not-needed
-diff --git a/powerline/__init__.py b/powerline/__init__.py
-index 9d2bb68..0feefc9 100644
---- a/powerline/__init__.py
-+++ b/powerline/__init__.py
-@@ -148,8 +148,7 @@ def get_config_paths():
+
+diff -Naurp powerline.orig/powerline/__init__.py powerline/powerline/__init__.py
+--- powerline.orig/powerline/__init__.py
++++ powerline/powerline/__init__.py
+@@ -148,8 +148,8 @@ def get_config_paths():
  	config_dirs = os.environ.get('XDG_CONFIG_DIRS', DEFAULT_SYSTEM_CONFIG_DIR)
  	if config_dirs is not None:
  		config_paths[:0] = reversed([join(d, 'powerline') for d in config_dirs.split(':')])
 -	plugin_path = join(os.path.realpath(os.path.dirname(__file__)), 'config_files')
 -	config_paths.insert(0, plugin_path)
++	config_paths.insert(0, '/etc/powerline')
 +	config_paths.insert(0, '/usr/share/powerline/config_files')
  	return config_paths
  
diff --git a/debian/powerline.README.Debian b/debian/powerline.README.Debian
index f80b685..8224d59 100644
--- a/debian/powerline.README.Debian
+++ b/debian/powerline.README.Debian
@@ -56,8 +56,14 @@ Configuration
 The default configuration files for Powerline are located in
 /usr/share/powerline/config_files
 
-A user may customize Powerline by copying the contents of this directory into
-~/.config/powerline and modifying the JSON-formatted configuration files.
+root may customize Powerline system-wide by copying the contents of this directory
+into /etc/powerline and modifying the JSON-formatted configuration files.
+This will overwrite the configuration from /usr/share/powerline/config_files
+and apply globally for all users on the system.
+
+Additionally a user may customize Powerline by using ~/.config/powerline accordingly.
+This will overwrite both the configuration from /usr/share/powerline/config_files
+and /etc/powerline, applying to the current user only.
 
 Documentation for the various configuration options is found in the
 powerline-doc package, at this URL:
diff --git a/debian/powerline.dirs b/debian/powerline.dirs
new file mode 100644
index 0000000..05b7d97
--- /dev/null
+++ b/debian/powerline.dirs
@@ -0,0 +1 @@
+/etc/powerline
diff --git a/debian/powerline.postrm b/debian/powerline.postrm
index a6db113..f6580c6 100644
--- a/debian/powerline.postrm
+++ b/debian/powerline.postrm
@@ -5,6 +5,7 @@ set -e
 case "${1}" in
 	purge)
 		rm -f /etc/profile.d/zz-powerline.sh
+		rmdir /etc/powerline > /dev/null 2>&1 || true
 		;;
 
 	remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)

Reply via email to