tag 899184 + patch
thanks

Here's a patch.

Regards,
Daniel
commit 1ba4d2f91276cb166941e3d1602bda431c6ec4b6
Author: Daniel Baumann <daniel.baum...@progress-linux.org>
Date:   Sun May 20 14:58:09 2018 +0200

    Adding debconf support for placing snippet in /etc/profile.d to enable powerline for all users (Closes: #899184).
    
    Signed-off-by: Daniel Baumann <daniel.baum...@progress-linux.org>

diff --git a/debian/po/POTFILES.in b/debian/po/POTFILES.in
new file mode 100644
index 0000000..c25927b
--- /dev/null
+++ b/debian/po/POTFILES.in
@@ -0,0 +1 @@
+[type: gettext/rfc822deb] powerline.templates
diff --git a/debian/po/templates.pot b/debian/po/templates.pot
new file mode 100644
index 0000000..f9248b8
--- /dev/null
+++ b/debian/po/templates.pot
@@ -0,0 +1,36 @@
+# SOME DESCRIPTIVE TITLE.
+# Copyright (C) YEAR THE PACKAGE'S COPYRIGHT HOLDER
+# This file is distributed under the same license as the powerline package.
+# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
+#
+#, fuzzy
+msgid ""
+msgstr ""
+"Project-Id-Version: powerline\n"
+"Report-Msgid-Bugs-To: powerl...@packages.debian.org\n"
+"POT-Creation-Date: 2018-05-20 15:08+0200\n"
+"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
+"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
+"Language-Team: LANGUAGE <l...@li.org>\n"
+"Language: \n"
+"MIME-Version: 1.0\n"
+"Content-Type: text/plain; charset=CHARSET\n"
+"Content-Transfer-Encoding: 8bit\n"
+
+#. Type: title
+#. Description
+#: ../powerline.templates:1001
+msgid "powerline: Setup"
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../powerline.templates:2001
+msgid "enable powerline globally:"
+msgstr ""
+
+#. Type: boolean
+#. Description
+#: ../powerline.templates:2001
+msgid "powerline can be enabled globally for all Bash users of this system."
+msgstr ""
diff --git a/debian/powerline.config b/debian/powerline.config
new file mode 100644
index 0000000..b2aae61
--- /dev/null
+++ b/debian/powerline.config
@@ -0,0 +1,11 @@
+#!/bin/sh
+
+set -e
+
+. /usr/share/debconf/confmodule
+
+db_settitle powerline/title
+db_input low powerline/enable || true
+db_go
+
+db_stop
diff --git a/debian/powerline.install b/debian/powerline.install
index be39476..1d4f789 100644
--- a/debian/powerline.install
+++ b/debian/powerline.install
@@ -15,3 +15,4 @@ powerline/bindings/zsh/powerline.zsh /usr/share/powerline/bindings/zsh
 powerline/config_files /usr/share/powerline
 debian/powerline.yaml /usr/share/vim/registry
 powerline/dist/systemd/powerline-daemon.service /usr/lib/systemd/user/
+debian/powerline.sh /usr/share/powerline/integrations
diff --git a/debian/powerline.postinst b/debian/powerline.postinst
new file mode 100644
index 0000000..baacfdf
--- /dev/null
+++ b/debian/powerline.postinst
@@ -0,0 +1,37 @@
+#!/bin/sh
+
+set -e
+
+case "${1}" in
+	configure)
+		. /usr/share/debconf/confmodule
+
+		db_get powerline/enable
+		POWERLINE_ENABLE="${RET}" # boolean
+
+		db_stop
+
+		case "${POWERLINE_ENABLE}" in
+			true)
+				ln -sf /usr/share/powerline/integrations/powerline.sh /etc/profile.d/zz-powerline.sh
+				;;
+
+			false)
+				rm -f /etc/profile.d/powerline.sh
+				;;
+		esac
+		;;
+
+	abort-upgrade|abort-remove|abort-deconfigure)
+
+		;;
+
+	*)
+		echo "postinst called with unknown argument \`${1}'" >&2
+		exit 1
+		;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/powerline.postrm b/debian/powerline.postrm
new file mode 100644
index 0000000..a6db113
--- /dev/null
+++ b/debian/powerline.postrm
@@ -0,0 +1,22 @@
+#!/bin/sh
+
+set -e
+
+case "${1}" in
+	purge)
+		rm -f /etc/profile.d/zz-powerline.sh
+		;;
+
+	remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+
+		;;
+
+	*)
+		echo "postrm called with unknown argument \`${1}'" >&2
+		exit 1
+		;;
+esac
+
+#DEBHELPER#
+
+exit 0
diff --git a/debian/powerline.sh b/debian/powerline.sh
new file mode 100644
index 0000000..3379493
--- /dev/null
+++ b/debian/powerline.sh
@@ -0,0 +1,11 @@
+# /etc/profile.d/powerline.sh
+
+if [ -n "${BASH}" ] && [ -e /usr/bin/powerline-daemon ]
+then
+	powerline-daemon -q
+
+	POWERLINE_BASH_CONTINUATION="1"
+	POWERLINE_BASH_SELECT="1"
+
+	. /usr/share/powerline/bindings/bash/powerline.sh
+fi
diff --git a/debian/powerline.templates b/debian/powerline.templates
new file mode 100644
index 0000000..c1b5d51
--- /dev/null
+++ b/debian/powerline.templates
@@ -0,0 +1,9 @@
+Template: powerline/title
+Type: title
+_Description: powerline: Setup
+
+Template: powerline/enable
+Type: boolean
+Default: false
+_Description: enable powerline globally:
+ powerline can be enabled globally for all Bash users of this system.

Reply via email to