PDA

View Full Version : [Solved] Wrap binary in scrip to set some variables


tkjacobsen
November 29th, 2009, 18:36
Hi all

I'm maintaining a port (graphics/ipe) and the newest version needs a
variable set. The way I would solve this is to rename the binary (and
move it out of PATH), create a script instead with the original and
let the script set the variable.

Is this the way to go or should I rather do something else?

If yes, how would I do so. Do a 'mv' in the Makefile and put the
script in files/?

Best Regards

Troels Kofoed Jacobsen

SirDice
November 29th, 2009, 18:51
The way I would solve this is to rename the binary (and move it out of PATH), create a script instead with the original and let the script set the variable.
The net-p2p/mldonkey port does something similar. Except it installs the binary in /usr/local/bin but renames it to mlnet-real. The script is named mlnet.

If yes, how would I do so. Do a 'mv' in the Makefile and put the script in files/?
That's how the mldonkey port does it.

DutchDaemon
November 29th, 2009, 19:12
There's also some moving/renaming going on in the nvidia port (x11/nvidia-driver), so even more inspiration there ;)

vivek
December 2nd, 2009, 14:58
I'm little late to party but this technique can be used with php, and perl via Apache+fastcgi too. You write a wrapper and move original php / perl binary and call your script. You can set additional environment, security checking (e.g. do not run perl script in /tmp) and much more.

aragon
December 2nd, 2009, 16:43
I'm maintaining a port (graphics/ipe) and the newest version needs a
variable set.
I take it you mean it needs a variable set to work at all on FreeBSD? If so, surely it'd be better to patch the source so that it doesn't need that env var and wrapper script?

tkjacobsen
December 2nd, 2009, 21:56
Actually, it needs a variable set to work with tetex. Here is the error I get:

! Pdftex is too old. Set IPEANCIENTPDFTEX environment variable!.
l.3 ...Set IPEANCIENTPDFTEX environment variable!}

The minute someone imports texlive into ports this will go away.