rakslice / dell_unix_pkgscripts

Scripts to build (& package) some old open source software for Dell Unix (ancient Dell SVR4 product)
0 stars 0 forks source link

script fixing relative symlinks coming from pkgproto #7

Open rakslice opened 1 year ago

rakslice commented 1 year ago

In the scripted package builds in build.inc, if there is no existing prototype file for the package, one is created from the output files using pkgproto. pkgproto is able to handle symlinks, and for relative ones it outputs a line like:

s none /usr/local/bin/awk=gawk

However this line causes the pkgmk tool (in this version) to put in the package an absolute symlink to /gawk which will not work and is not what we want.

Note that for symlinks the prototype file determines the destination of symlink; pkgmk does not use the actual symlink file in the DESTDIR or similar as input.

It's possible to get a relative symlink by changing the line in the prototype to e.g.

s none /usr/local/bin/awk=./gawk

This will create a symlink to ./gawk, which is not exactly the same, but works fine in the majority of cases.

I've changed all the existing prototype files, but it would be good to update the script to ensure that prototype files generated automatically for new stuff in the future get corrected automatically.

A modern sed oneliner to start with (assumes no dotifles):

sed -i 's/^\(s none [^=]*=\)\([^/.].*\)/\1\.\/\2/'