Control: tags -1 - patch On 2021-02-07 21:51 -0500, Michael Gilbert wrote:
> debianutil's add-shell script uses awk, but awk is not an > Essential:yes package. For systems where awk is not yet installed > (chroots), installation of dash will currently fail since it's > postinst calls add-shell from debianutils. > > A simple fix seems possible, just change add-shell to use cat, which > is in coreutils (Essential:yes). Proposed update attached. > > Best wishes, > Mike > > --- debianutils-4.11.2/add-shell 2020-05-22 20:00:40.000000000 -0400 > +++ debianutils-4.11.3/add-shell 2021-02-07 21:47:27.000000000 -0500 > @@ -17,7 +17,7 @@ > } > trap cleanup EXIT > > -if ! awk '{print}' "$file" > "$tmpfile" > +if ! cat "$file" > "$tmpfile" > then > cat 1>&2 <<EOF > Either another instance of $0 is running, or it was previously interrupted. This would reopen bug #698874, I don't think the maintainer wants that. A possible solution which takes that bug into account might be to use sed instead: --8<---------------cut here---------------start------------->8--- diff --git a/add-shell b/add-shell index abce1c1..17967f5 100755 --- a/add-shell +++ b/add-shell @@ -17,7 +17,7 @@ cleanup() { } trap cleanup EXIT -if ! awk '{print}' "$file" > "$tmpfile" +if ! sed '$a\' $file > $tmpfile then cat 1>&2 <<EOF --8<---------------cut here---------------end--------------->8--- However while this works with GNU sed, busybox sed adds an unwanted extra empty line, and I am not sure if POSIX has anything to say about what is supposed to happen if you append nothing at the end of a file. See also #796848, #812784 and https://unix.stackexchange.com/questions/31947/how-to-add-a-newline-to-the-end-of-a-file. Cheers, Sven