Warn the user if /bin/sh is ineffectively diverted (DEP17)

Co-authored-by: Andrej Shadura <andrewsh@debian.org>

Closes: #1078130
This commit is contained in:
Helmut Grohne 2024-08-14 09:16:00 +02:00 committed by Andrej Shadura
parent 4450adbc8b
commit 2f7cf67d73
No known key found for this signature in database
GPG Key ID: 2526E9EB828A8F35
6 changed files with 92 additions and 2 deletions

1
debian/clean vendored
View File

@ -1 +0,0 @@
debian/dash.templates

2
debian/control vendored
View File

@ -17,7 +17,7 @@ Architecture: any
Multi-Arch: foreign
Essential: yes
Priority: required
Pre-Depends: ${shlibs:Depends}
Pre-Depends: ${shlibs:Depends}, debconf
Depends:
debianutils (>= 5.6-0.1),
${misc:Depends},

24
debian/dash.preinst vendored Normal file
View File

@ -0,0 +1,24 @@
#!/bin/sh
set -e
if [ "$1" = upgrade ] && dpkg --compare-versions "$2" lt 0.5.12-9~; then
# Upgrading from pre-/usr-move DEP17
truename=$(dpkg-divert --truename /bin/sh)
if [ "$truename" != /bin/sh ] &&
[ "$(dpkg-divert --listpackage /bin/sh)_$truename" != "dash_/bin/sh.distrib" ] &&
[ "$(dpkg-divert --truename /usr/bin/sh)" = "/usr/bin/sh" ]; then
# There is a diversion of /bin/sh and it is not our own
# diversion to /bin/sh.distrib that will be removed in
# postinst and there is no matching diversion of /usr/bin/sh.
. /usr/share/debconf/confmodule
db_input critical dash/ineffectivediversion || true
db_go || true
# We have no other debconf usage in dash, so we can purge rightaway.
db_purge || true
fi
fi
#DEBHELPER#
exit 0

10
debian/dash.templates vendored Normal file
View File

@ -0,0 +1,10 @@
Template: dash/ineffectivediversion
Type: error
_Description: /bin/sh is ineffectively diverted
A diversion of /bin/sh was found.
.
After this update, dash will be recorded in the dpkg database at its new path, /usr/bin/sh. Since there is no diversion set for /usr/bin/sh, the existing diversion for /bin/sh will no longer work.
.
To keep using your preferred default shell, you need to set up another diversion for /usr/bin/sh. If you dont do so now, your changes to /bin/sh will be lost after this upgrade.
.
Once the upgrade is complete, the diversion for /bin/sh will no longer be needed and can be removed.

2
debian/po/POTFILES.in vendored Normal file
View File

@ -0,0 +1,2 @@
[encoding: UTF-8]
[type: gettext/rfc822deb] dash.templates

55
debian/po/templates.pot vendored Normal file
View File

@ -0,0 +1,55 @@
# debconf templates for dash
# Copyright (C) 2024 Debian dash maintainers
# This file is distributed under the same license as the dash package.
# FIRST AUTHOR <EMAIL@ADDRESS>, YEAR.
#
msgid ""
msgstr ""
"Project-Id-Version: dash\n"
"Report-Msgid-Bugs-To: dash@packages.debian.org\n"
"POT-Creation-Date: 2025-01-03 14:21+0100\n"
"PO-Revision-Date: YEAR-MO-DA HO:MI+ZONE\n"
"Last-Translator: FULL NAME <EMAIL@ADDRESS>\n"
"Language-Team: LANGUAGE <LL@li.org>\n"
"Language: \n"
"MIME-Version: 1.0\n"
"Content-Type: text/plain; charset=UTF-8\n"
"Content-Transfer-Encoding: 8bit\n"
#. Type: error
#. Description
#: ../dash.templates:1001
msgid "/bin/sh is ineffectively diverted"
msgstr ""
#. Type: error
#. Description
#: ../dash.templates:1001
msgid "A diversion of /bin/sh was found."
msgstr ""
#. Type: error
#. Description
#: ../dash.templates:1001
msgid ""
"After this update, dash will be recorded in the dpkg database at its new "
"path, /usr/bin/sh. Since there is no diversion set for /usr/bin/sh, the "
"existing diversion for /bin/sh will no longer work."
msgstr ""
#. Type: error
#. Description
#: ../dash.templates:1001
msgid ""
"To keep using your preferred default shell, you need to set up another "
"diversion for /usr/bin/sh. If you dont do so now, your changes to /bin/sh "
"will be lost after this upgrade."
msgstr ""
#. Type: error
#. Description
#: ../dash.templates:1001
msgid ""
"Once the upgrade is complete, the diversion for /bin/sh will no longer be "
"needed and can be removed."
msgstr ""