[Pkg-zsh-commits] [zsh] 01/01: Remove usage of alternatives system for zsh, rzsh and zsh-static

Axel Beckert abe at deuxchevaux.org
Sun Jan 31 19:23:44 UTC 2016


This is an automated email from the git hooks/post-receive script.

abe pushed a commit to branch debian
in repository zsh.

commit da1b680be1e3307cc2c2de34b81be554f4a32be6
Author: Axel Beckert <abe at deuxchevaux.org>
Date:   Sun Jan 31 20:20:28 2016 +0100

    Remove usage of alternatives system for zsh, rzsh and zsh-static
    
    This also fixes installation together with usrmerge, which fiddles
    with the directory layout and makes /bin a symlink to /usr/bin against
    all Unix tradition and violating FHS.
    
    Closes: #768079
---
 debian/rules                        |  7 ++++---
 debian/zsh-common.links             |  1 -
 debian/zsh-static.install           |  1 +
 debian/zsh-static.lintian-overrides |  2 ++
 debian/zsh-static.postinst          |  2 +-
 debian/zsh-static.prerm             | 21 ---------------------
 debian/zsh.install                  |  1 +
 debian/zsh.lintian-overrides        |  2 ++
 debian/zsh.postinst                 | 19 ++++++++++++-------
 debian/zsh.prerm                    | 24 ------------------------
 debian/zsh5                         | 27 +++++++++++++++++++++++++++
 11 files changed, 50 insertions(+), 57 deletions(-)

diff --git a/debian/rules b/debian/rules
index afdf540..c94eef5 100755
--- a/debian/rules
+++ b/debian/rules
@@ -127,7 +127,7 @@ binary-indep: build-indep binary-arch-dynamic
              /^#define FPATH_SUBDIRS/ { $$1=""; $$2=""; gsub(/[" ]/,""); tail=$$0; } \
              END                      { printf "%s/%s\n", head, tail; };'            \
 	    obj/Src/zshpaths.h >obj/Src/zshpaths.temp
-	debian/zsh/bin/zsh5 -fc \
+	debian/zsh/bin/zsh -fc \
             'setopt extendedglob; \
 	     for i in debian/zsh-common/'`cat obj/Src/zshpaths.temp`'; do \
 		 zcompile -U -M $$i.zwc $$i/*~*.zwc(^/);                  \
@@ -173,7 +173,6 @@ binary-arch-dynamic: build-arch
 	cd obj && $(MAKE) install.bin     DESTDIR=$(CURDIR)/debian/zsh INSTALL_PROGRAM='$(INSTALL_PROGRAM)'
 	cd obj && $(MAKE) install.modules DESTDIR=$(CURDIR)/debian/zsh INSTALL_PROGRAM='$(INSTALL_PROGRAM)'
 
-	mv debian/zsh/bin/zsh debian/zsh/bin/zsh5
 	rm debian/zsh/bin/zsh-5.[0-9]*
 
 	dh_bugfiles    -pzsh
@@ -204,7 +203,9 @@ binary-arch-static: build-static
 	dh_install           -pzsh-static
 	dh_strip             -pzsh-static
 
-	mv debian/zsh-static/bin/zsh  debian/zsh-static/bin/zsh5-static
+	mv debian/zsh-static/bin/zsh  debian/zsh-static/bin/zsh-static
+	mv debian/zsh-static/bin/zsh5 debian/zsh-static/bin/zsh5-static
+	sed -e 's:#!/bin/zsh:#!/bin/zsh-static:' -i debian/zsh-static/bin/zsh5-static
 
 	dh_installchangelogs -pzsh-static
 
diff --git a/debian/zsh-common.links b/debian/zsh-common.links
deleted file mode 100644
index b695f6f..0000000
--- a/debian/zsh-common.links
+++ /dev/null
@@ -1 +0,0 @@
-/usr/share/man/man1/zsh.1.gz /usr/share/man/man1/zsh5.1.gz
diff --git a/debian/zsh-static.install b/debian/zsh-static.install
index 51a7123..4c32118 100644
--- a/debian/zsh-static.install
+++ b/debian/zsh-static.install
@@ -1 +1,2 @@
 obj-static/Src/zsh bin
+debian/zsh5 bin
diff --git a/debian/zsh-static.lintian-overrides b/debian/zsh-static.lintian-overrides
index 21a0ecb..68a294c 100644
--- a/debian/zsh-static.lintian-overrides
+++ b/debian/zsh-static.lintian-overrides
@@ -1,3 +1,5 @@
 zsh-static: embedded-library bin/zsh5-static: libm
 zsh-static: embedded-library bin/zsh5-static: ncurses
 zsh-static: package-contains-broken-symlink usr/share/man/man1/zsh5-static.1.gz zsh.1.gz
+# Migration wrapper which is not meant to be used
+zsh-static: binary-without-manpage bin/zsh5-static
diff --git a/debian/zsh-static.postinst b/debian/zsh-static.postinst
index e275a2c..2d04961 100644
--- a/debian/zsh-static.postinst
+++ b/debian/zsh-static.postinst
@@ -19,8 +19,8 @@ case "$1" in
     ;;
 esac
 
-update-alternatives --install /bin/zsh-static zsh-static /bin/zsh5-static 41
 update-alternatives --remove zsh-static /bin/zsh4-static
+update-alternatives --remove zsh-static /bin/zsh5-static
 
 #DEBHELPER#
 
diff --git a/debian/zsh-static.prerm b/debian/zsh-static.prerm
deleted file mode 100644
index adbdf8c..0000000
--- a/debian/zsh-static.prerm
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/bin/sh
-
-set -e
-
-case "$1" in
-    remove|deconfigure)
-	update-alternatives --remove zsh-static /bin/zsh5-static
-    ;;
-    upgrade)
-    ;;
-
-    failed-upgrade)
-    ;;
-
-    *)
-	echo "prerm called with unknown argument \`$1'" >&2
-	exit 0
-    ;;
-esac
-
-#DEBHELPER#
diff --git a/debian/zsh.install b/debian/zsh.install
new file mode 100644
index 0000000..cd31624
--- /dev/null
+++ b/debian/zsh.install
@@ -0,0 +1 @@
+debian/zsh5 bin
diff --git a/debian/zsh.lintian-overrides b/debian/zsh.lintian-overrides
index f23c6a1..c5cc701 100644
--- a/debian/zsh.lintian-overrides
+++ b/debian/zsh.lintian-overrides
@@ -1,2 +1,4 @@
 # Only one of many files affected -> likely a false positive
 zsh: hardening-no-fortify-functions usr/lib*/zsh/*/zsh/zleparameter.so
+# Migration wrapper which is not meant to be used
+zsh: binary-without-manpage bin/zsh5
diff --git a/debian/zsh.postinst b/debian/zsh.postinst
index 2ba2202..843a8f3 100644
--- a/debian/zsh.postinst
+++ b/debian/zsh.postinst
@@ -18,15 +18,20 @@ case "$1" in
     ;;
 esac
 
-update-alternatives --remove zsh /usr/bin/zsh
+# ksh alternatives
 update-alternatives --remove ksh /usr/bin/zsh
 update-alternatives --remove ksh /bin/zsh4
-update-alternatives --install /bin/zsh zsh /bin/zsh5 51 \
-		--slave /usr/bin/zsh zsh-usrbin /bin/zsh5
-update-alternatives --install /bin/rzsh rzsh /bin/zsh5 51 \
-		--slave /usr/share/man/man1/rzsh.1.gz rzsh.1.gz /usr/share/man/man1/zsh.1.gz
-update-alternatives --remove zsh /bin/zsh4
-update-alternatives --remove rzsh /bin/zsh4
+
+# Remove alternatives system for zsh in general
+update-alternatives --remove zsh /bin/zsh5
+update-alternatives --remove rzsh /bin/rzsh5
+
+# New hardcoded symlinks which unfortunately can't be shipped inside
+# the package itself since some people want to merge /bin and /usr/bin
+# against FHS and all Unix tradition.
+if [ ! -e /usr/bin/zsh -a ! -L /usr/bin/zsh ]; then
+  ln -s /bin/zsh /usr/bin/zsh
+fi
 
 #DEBHELPER#
 
diff --git a/debian/zsh.prerm b/debian/zsh.prerm
deleted file mode 100644
index d49ec46..0000000
--- a/debian/zsh.prerm
+++ /dev/null
@@ -1,24 +0,0 @@
-#!/bin/sh
-
-set -e
-
-case "$1" in
-    (remove|deconfigure)
-	update-alternatives --remove zsh /bin/zsh5
-	update-alternatives --remove rzsh /bin/zsh5
-    ;;
-    (upgrade)
-    ;;
-
-    (failed-upgrade)
-    ;;
-
-    (*)
-	echo "prerm called with unknown argument \`$1'" >&2
-	exit 0
-    ;;
-esac
-
-#DEBHELPER#
-
-exit 0
diff --git a/debian/zsh5 b/debian/zsh5
new file mode 100644
index 0000000..91b831c
--- /dev/null
+++ b/debian/zsh5
@@ -0,0 +1,27 @@
+#!/bin/zsh -f
+
+# This wrapper's sole purpose is to ease the migration of zsh's binary
+# location from /bin/zsh5 to /bin/zsh between Debian Jessie and
+# Stretch since zsh no more uses the alternatives system as there is
+# only one version of zsh left in Debian since Jessie.
+#
+# Related bug report: https://bugs.debian.org/768079
+
+if [[ "$0" == *zsh5* ]]; then
+    static=''
+    if [[ "$0" == *static* ]]; then
+        static=-static
+    fi
+
+    echo ""
+    echo "    ####"
+    echo "    ####  $0 is deprecated, please switch to /bin/zsh${static} (or /usr/bin/zsh)"
+    if [[ "$1" == "-l" || "$0" == -* ]]; then
+        echo '    ####  Use "chsh -s '"/bin/zsh${static}"'" to change your login shell'
+    fi
+    echo "    ####  This command ($0) will disappear eventually!"
+    echo "    ####"
+    echo ""
+fi 1>&2
+
+exec "/bin/zsh${static}" "$@"

-- 
Alioth's /usr/local/bin/git-commit-notice on /srv/git.debian.org/git/collab-maint/zsh.git



More information about the Pkg-zsh-commits mailing list