bsdinstall script uses split(1) to split the installation script
into a preamble - containing options - and an optional setup script
called installscript.
In case the setup script contains a script header ("shebang") after
the initial one, the installation script is split multiple times,
ignoring anything from that point in the file when creating
installscript.
Example:
RELEASE="14.0" ... #!/bin/sh echo "Populate rc.local" cat >/etc/rc.local<<EOF #!/bin/sh echo booted | logger -s -t 'example' EOF echo "Shutdown" shutdown -p now
This results in three files:
- bsdinstall-installscript-aa: preamble
- bsdinstall-installscript-ab: setup script only containing three lines (ending on cat >/etc/rc.local<<EOF)
- bsdinstall-installscript-ac: remainder of the install script, which is never executed (and if it would, it would do the wrong thing).
Unfortunately, the split command doesn't support a "max files" option
(which would be a nice addition and an easy fix, think split -m2).
This patch aims to correct this by replacing split with awk (and
adding some more fixes).