config file installation/removal
Stefan Esser
se at freebsd.org
Thu Feb 18 19:32:48 UTC 2021
Am 18.02.21 um 19:51 schrieb Gerrit Kuehn:
>
> On Tue, 16 Feb 2021 12:22:38 +0100
> Gerrit Kuehn <gerrit.kuehn at aei.mpg.de> wrote:
>
>
> Hello,
>
> I think I finally found the trigger for this:
> It happens on systems where I had moved /usr/local/etc to /etc/local and
> put a link in /usr/local instead:
>
> lrwxr-xr-x 1 root wheel 10 Aug 31 2018 etc@ -> /etc/local
>
> Moving the directory back to /usr/local/etc makes pkg behave as before.
>
> I've been using this for many years on many systems, but something in
> file handling must have changed in the pkg/ports recently causing this
> strange behaviour with sample files installation/removal.
>
> Any ideas why this changed? Is this a bug or a feature?
The @sample option in the plist file is implemented in the following
LUA code:
DBG(3)[37044]> Scripts: executing lua
--- BEGIN ---
-- args: etc/pkg.conf.sample
args = {}
for arg in string.gmatch("etc/pkg.conf.sample", "%S+") do
table.insert(args, arg)
end
sample_file = pkg.prefixed_path(args[1])
if args[2] == nil then
target_file = string.gsub(sample_file,'%.sample$', "")
else
target_file = pkg.prefixed_path(args[2])
end
if not pkg.stat(target_file) then
pkg.copy(sample_file, target_file)
end
Scripts: --- END ---
My assumption is that pkg.stat() does not follow symbolic links, but
I have not checked whether this actually is the case.
Regards, STefan
-------------- next part --------------
A non-text attachment was scrubbed...
Name: OpenPGP_signature
Type: application/pgp-signature
Size: 495 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-pkg/attachments/20210218/a9ed8e60/attachment.sig>
More information about the freebsd-pkg
mailing list