Re: Shipping /bin/sh [Re: Moving bash from essential/required to important?]
Bastian Blank <firstname.lastname@example.org> writes:
> On Fri, Apr 08, 2011 at 06:52:41PM +0200, Bastian Blank wrote:
>> We have the same problem with awk since ages. We should fix both
>> problems together. Therefor I propose the following:
> - An essential or pseudo-essential (dependency or pre-dependency from an
> essential package) may include a new maintainer script called
> "bootstrap" in its control.tar.
> - This script must be executable and use /bin/sh as interpreter.
> - The rules for essential packages must be fulfilled after this script
> was executed.
- The rules for essential packages must remain fulfilled on upgrades
without this script being executed. The bootstrap script is never
executed if the system was installed from a version predating the
"bootstrap" script in the package.
> - It should be called by the bootstrap process after the initial unpack
> of the owning package or all packages in the essential set.
- It must be called before any maintainer script of any package other
than the "bootstrap" script is called.
> - It must be called outside of the new root, so it can assume that it
> can execute some essential commands.
> - It must not access other scripts or executables in the new root.
- It must not execute other scripts or executables in the new root.
- It must not rely on the presence of any files or directories outside
the contents of the owning package.
Note: Unpacking and calling the script can be any order without regards
to dependencies. It can access files or directories from the owning
package as long as it doesn't execute anything.
Unless we want the essential system-shell package to setup /bin/sh and
base-files to setup /usr/bin/awk. Then (Pre-)Depends must be at least
unpacked. See below.
- Scripts are to be kept to a minimum and simple to be run by even not
fully POSIX compliant /bin/sh.
- Scripts must not fail if a competing package was "bootstrap"ed
first. E.g. mawk must not fail if gawk is already in palce.
> For now two packages will get such a script:
> - dash (setup of /bin/sh)
> - base-files (setup of /usr/bin/awk)
Here I think we can go one of two ways:
1) The (pseudo-)essential packages providing will setup the link
For this dash, bash, mawk and gawk would each have a "bootstrap"
script. Whichever gets executed first sets up the required link. The
result would be random.
Optionally the default provider could overwrite the link if it exists
while all others only set it if missing. This would give some preference
to the result but still allow choice if the default provider is
explicitly excluded in the bootstrap.
2) "bootstrap" scripts are only executed after the owners (Pre-)Depends
have been unpacked. This would allow base-files to setup the links based
on available packages and some internal preference list. In this
scenario I think base-files should set up /bin/sh and /usr/bin/awk and
gain a Pre-Depends: system-shell.
The result would still be random and potentially more so that option
1. bash + base-files might be unpacked, "bootstrap"ed and only then
dash, which would normaly be the deafult, is unpacked. Here dash could
not be made to override bash as inital /bin/sh.
> The bootstrap process may work this:
> - The data.tar of every package in the essential set is unpacked.
> - The bootstrap scripts from the control.tar of every package in the
> essential set is extracted and executed.
If we go ahead with this I would recommend that support for "bootstrap"
scripts will be backported to bootstrap tools in squeeze in some point
release and that only after wheezy is released bootstrap tools will be
required to execute the "bootstrap" script. That way even old-stable
(except early point releases) will be able to bootstrap unstable.