Bug#477750: don't readd bash to /etc/shells

2008-05-10 Thread Ben Hutchings
This is complicated by the fact that the postrm script currently runs
remove-shell even during an upgrade.  So we cannot tell during an
upgrade whether bash was removed from /etc/shells by the user or by the
old postrm script.

The following patch should improve later upgrades, however.  It changes
postrm to run remove-shell only on purge (or disappear), and postinst to
run add-shell on initial installation or upgrade from a version that
runs remove-shell when being upgraded.

This would mean that bash would still be left in /etc/shells if it is
removed but not purged, though this is a non-issue so long as bash is
essential.

Ben.

diff -u bash-3.2/debian/bash.postrm bash-3.2/debian/bash.postrm
--- bash-3.2/debian/bash.postrm
+++ bash-3.2/debian/bash.postrm
@@ -3,7 +3,14 @@
 set -e
 
 case $1 in
-purge|remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
+remove|upgrade|failed-upgrade|abort-install|abort-upgrade)
+   ;;
+
+purge|disappear)
+   if [ -x /usr/sbin/remove-shell ]  [ -f /etc/shells ]; then
+   /usr/sbin/remove-shell /bin/bash
+   /usr/sbin/remove-shell /bin/rbash
+   fi
;;
 
 *)
@@ -12,11 +19,6 @@
;;
 esac
 
-if [ -x /usr/sbin/remove-shell ]  [ -f /etc/shells ]; then
-/usr/sbin/remove-shell /bin/bash
-/usr/sbin/remove-shell /bin/rbash
-fi
-
 #DEBHELPER#
 
 exit 0
diff -u bash-3.2/debian/bash.postinst bash-3.2/debian/bash.postinst
--- bash-3.2/debian/bash.postinst
+++ bash-3.2/debian/bash.postinst
@@ -14,7 +14,8 @@
 10 \
   || true
 
-if [ -x /usr/sbin/add-shell ]; then
+if [ $1 = configure ]  dpkg --compare-versions $2 le 3.2-2 \
+ [ -x /usr/sbin/add-shell ]; then
 /usr/sbin/add-shell /bin/bash
 /usr/sbin/add-shell /bin/rbash
 fi
--- END ---

-- 
Ben Hutchings
We get into the habit of living before acquiring the habit of thinking.
  - Albert Camus


signature.asc
Description: This is a digitally signed message part


Bug#477750: don't readd bash to /etc/shells

2008-04-24 Thread Jörg Sommer
Package: bash
Version: 3.1dfsg-9
Severity: serious
Justification: Policy 10.7.3

Hi,

please, do not readd bash and rbash on every upgrade to /etc/shells. You
should preserve user changes during upgrades. When I remove bash from
/etc/shells it's readded after an upgrade.

Bye, Jörg.

-- System Information:
Debian Release: unstable/experimental
  APT prefers unstable
  APT policy: (900, 'unstable'), (700, 'experimental')
Architecture: powerpc (ppc)

Kernel: Linux 2.6.25
Locale: LANG=de_DE.UTF-8, LC_CTYPE=de_DE.UTF-8 (charmap=UTF-8)
Shell: /bin/sh linked to /bin/dash

Versions of packages bash depends on:
ii  base-files4.0.3  Debian base system miscellaneous f
ii  debianutils   2.28.4 Miscellaneous utilities specific t
ii  libc6 2.7-10 GNU C Library: Shared libraries
ii  libncurses5   5.6+20080419-1 Shared libraries for terminal hand

Versions of packages bash recommends:
pn  bash-completion   none (no description available)

-- no debconf information


signature.asc
Description: Digital signature http://en.wikipedia.org/wiki/OpenPGP