Detect that package is being (re)installed
-
@pfSense devs: How do I do this? There are multiple packages where certain parts of the code should NOT be done at this phase. Such as, (re)starting the package-provided services zillion times in 15 seconds.
-
I'm not sure we have a good way to detect that.
One might be able to leverage the return value from debug_backtrace() to find out how it's being called to make the decision though.
-
Yuck… @jimp:
One might be able to leverage the return value from debug_backtrace() to find out how it's being called to make the decision though.
Yuck… :-\
Found a different idea here:
https://github.com/marcelloc/pfsense-packages/blob/master/config/snort/snort_post_install.php#L70
https://github.com/marcelloc/pfsense-packages/blob/master/config/snort/snort.inc#L1068Not really sure how reliable that is...
-
If it's properly declared global before use it may be OK…
Or there's the ever-popular "touch a flag file in /tmp/" style.
Though if debug_backtrace() shows it being called by the package install code that would be pretty obvious, though I'd have to run some tests to find out how deep that goes. If the info is there it would definitely be the most reliable way. It's not really a bad way to go about it, it just needs some experimentation to derive the required tests/info.