[TUHS] Traditional method of dealing with embedded shar files

Warner Losh imp at bsdimp.com
Tue Jul 21 03:55:27 AEST 2020


On Mon, Jul 20, 2020 at 11:25 AM Will Senn <will.senn at gmail.com> wrote:

> As y'all know, I'm a relative latecomer to the world of Unix, but I do try
> to figure out how y'all did it back when. So, sometimes, as in this case, I
> can figure out how to do something, but I'm curious how it was done back in
> the day, moreso than how I can get it done today. I'm looking at the
> patching of my shiny new 2.11 BSD pl 431 system running on my speedy little
> virtual PDP-11/70, so I grabbed patch 432 (here's a portion of the patch):
> ...
>     To install the update cut where indicated below and save to a file
>     (/tmp/432) and then:
>
>         cd /tmp
>         sh 432
>         ./432.sh
>         ./432.rm
>         sh 432.shar
>         patch -p0 < 432.patch
>
>     Watch carefully for any rejected parts of the patch.   Failure of a
>     patch typically means the system was not current on all preceeding
>     updates _or_ that local modifications have been made.
> ...
> ====== cut here
> #! /bin/sh
> # This is a shell archive, meaning:
> # 1. Remove everything above the #! /bin/sh line.
> # 2. Save the resulting text in a file.
> # 3. Execute the file with /bin/sh (not csh) to create:
> #    432.rm
> #    432.sh
> #    432.shar
> #    432.patch
> ...
> #    End of shell archive
>
> This seems straightforward. Just follow the directions et voila magic
> happens.
>
> My questions for y'all are how would you go about doing this? Use vi to
> delete everything through the ==== cut here line? Use some combination of
> standard unix tools to chop it up? What was your workflow for patching up
> the system using these files?
>

sed -e '1,/---cut here---/d' < $patch | sh -x

is what I use, but there's a wide variety of 'cut here' lines in the
2.11BSD patches, so I have had to taylor to each patch.


> In my world, if I screw something up, it's 15 seconds to run a restore
> script in my simh directory and I can try again, so my level of concern for
> a mistake is pretty low. If I was doing this in 1980, on real hardware, I
> would have had many concerns, as I'm sure some of y'all can remember, how
> did you prepare and protect yourselves so a patch was successful.
>

Yea, it was always a crap-shoot back in the day on slow hardware. Backups
on tape were your best bet :(.


> BTW, I thought .shar was an archive format, so when I saw the patch was a
> shar file, I was worried it would be in some binary form, lo and behold, it
> looks like text to me... not even b64. So much to learn, so little time.
>

It is and it isn't. Mostly isn't for these patches. libarchive supports it,
but there's no standard and what libarchive supports is quite limited.

Warner


> Thanks,
>
> Will
>
> --
> GPG Fingerprint: 68F4 B3BD 1730 555A 4462  7D45 3EAA 5B6D A982 BAAF
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://minnie.tuhs.org/pipermail/tuhs/attachments/20200720/5bdc4e6f/attachment.htm>


More information about the TUHS mailing list