[Bash-completion-commits] [SCM] debian-package branch, master, updated. debian/1.3-1-32-g653f34e
David Paleino
dapal at debian.org
Tue Apr 12 10:44:13 UTC 2011
The following commit has been merged in the master branch:
commit 313856a6f1d339ee67b219a1f4cf56e1349c3e21
Author: David Paleino <dapal at debian.org>
Date: Sun Apr 10 08:29:01 2011 +0200
Implement APT hook and update-bash-completion script, and monthly cronjob to clean up unused completions.
diff --git a/debian/changelog b/debian/changelog
index 77886b3..155af36 100644
--- a/debian/changelog
+++ b/debian/changelog
@@ -2,13 +2,13 @@ bash-completion (1:1.3-2) UNRELEASED; urgency=low
* Change completion directory layout (00-change_completions_layout.patch)
* Use autoreconf in debian/rules
- * Implement triggers: activate completions when something is installed
- in $PATH (drawback: paths are hardcoded in debian/triggers)
+ * Implement APT hook and update-bash-completion script, and monthly
+ cronjob to clean up unused completions.
* Remove old UCF-related postinst tasks
* Remove old conffiles, using dpkg-maintscript-helper
* Added debian/NEWS, to explain the changes with this revision
- -- David Paleino <dapal at debian.org> Wed, 06 Apr 2011 21:55:31 +0200
+ -- David Paleino <dapal at debian.org> Sun, 10 Apr 2011 08:27:38 +0200
bash-completion (1:1.3-1) unstable; urgency=low
diff --git a/debian/extra/99-bash-completion b/debian/extra/99-bash-completion
new file mode 100644
index 0000000..af62a63
--- /dev/null
+++ b/debian/extra/99-bash-completion
@@ -0,0 +1,6 @@
+// Activate bash-completions
+
+DPkg
+{
+ Post-Invoke {"if [ -x /usr/sbin/update-bash-completion ]; then /usr/sbin/update-bash-completion; else exit 0; fi";};
+};
diff --git a/debian/extra/bash-completion.cron b/debian/extra/bash-completion.cron
new file mode 100644
index 0000000..f1c9f53
--- /dev/null
+++ b/debian/extra/bash-completion.cron
@@ -0,0 +1,5 @@
+#!/bin/sh
+
+[ -x /usr/sbin/update-bash-completionvrms ] || exit 0
+
+/usr/sbin/update-bash-completion clean
diff --git a/debian/extra/update-bash-completion b/debian/extra/update-bash-completion
new file mode 100755
index 0000000..28d402e
--- /dev/null
+++ b/debian/extra/update-bash-completion
@@ -0,0 +1,27 @@
+#!/bin/bash
+
+echo "UPDATING!"
+
+GET_COMP=/usr/share/bash-completion/get-completions
+COMPDICT=/usr/share/bash-completion/compdict
+COMPDIR=/usr/share/bash-completion
+RUNCOMPDIR=/etc/bash_completion.d/triggered
+
+if [ "$1" == "-h" ] || [ "$1" == "--help" ]; then
+ echo "Usage: update-bash-completion [clean]"
+ echo
+ echo "Updates symlinks to relevant bash completions, i.e. completions for installed"
+ echo "executables."
+ echo
+ echo "The \"clean\" option also removes old completions, i.e. for uninstalled"
+ echo "executables."
+
+ exit 0
+elif [ "$1" == "clean" ]; then
+ rm -rf $RUNCOMPDIR/*
+fi
+
+
+for c in $($GET_COMP $COMPDICT | sort -u); do
+ ln -sf $COMPDIR/$c $RUNCOMPDIR/
+done
diff --git a/debian/install b/debian/install
index 9e33513..6aa8b26 100644
--- a/debian/install
+++ b/debian/install
@@ -3,3 +3,6 @@ debian/extra/bash_completion.pm /usr/share/perl5/Debian/Debhelper/Sequence/
debian/compdict /usr/share/bash-completion/
debian/extra/get-completions /usr/share/bash-completion/
+debian/extra/update-bash-completion /usr/sbin/
+debian/extra/bash-completion.cron /etc/cron.monthly/
+debian/extra/99-bash-completion /etc/apt/apt.conf.d/
diff --git a/debian/postinst b/debian/postinst
index 4e32eae..5282090 100644
--- a/debian/postinst
+++ b/debian/postinst
@@ -4,6 +4,8 @@ set -e
case "$1" in
configure)
+ [ -x /usr/sbin/update-bash-completion ] && echo OK!!!
+
# Populate with completions based on available commands
rm -rf /etc/bash_completion.d/triggered/*
for c in $(/usr/share/bash-completion/get-completions /usr/share/bash-completion/compdict | sort -u); do
@@ -16,14 +18,6 @@ case "$1" in
;;
abort-upgrade|abort-remove|abort-deconfigure)
;;
- triggered)
- # This is triggered by any installation of an executable in $PATH
- # (check debian/triggers to see what paths are being monitored)
- rm -rf /etc/bash_completion.d/triggered/*
- for c in $(/usr/share/bash-completion/get-completions /usr/share/bash-completion/compdict | sort -u); do
- ln -sf /usr/share/bash-completion/$c /etc/bash_completion.d/triggered/
- done
- ;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
diff --git a/debian/triggers b/debian/triggers
deleted file mode 100644
index 7fb8e12..0000000
--- a/debian/triggers
+++ /dev/null
@@ -1,8 +0,0 @@
-interest /sbin
-interest /usr/sbin
-interest /usr/local/sbin
-interest /bin
-interest /usr/bin
-interest /usr/local/bin
-interest /usr/games
-interest /usr/local/games
--
debian-package
More information about the Bash-completion-commits
mailing list