How to use @preexec to test for installed packages

Matthias Fechner idefix at fechner.net
Sat Apr 6 13:59:03 UTC 2019


Dear all,

as pkg cannot handle CONFLICTS_INSTALL I tried now to implement this as
a preinstall command using @preexec in pkg-plist.

The command should check if a package is installed and stop the
installation or continue if the package is not installed.

I tried it with the following command:
@preexec `/usr/sbin/pkg -N info -e gogs`; if [ $? -eq 0 ]; then echo
"Gitlab cannot be installed together with gogs as both of them modify
.ssh/authorized_keys" && exit 1; else echo "Gogs not installed,
continue."; fi

But it does not work.
Now matter if gogs is installed or not.
If I execute the same line in a shell script, it works fine.

Anyone an idea?


Gruß
Matthias

-- 

"Programming today is a race between software engineers striving to
build bigger and better idiot-proof programs, and the universe trying to
produce bigger and better idiots. So far, the universe is winning." --
Rich Cook



More information about the freebsd-ports mailing list