CARP scripts surviving an upgrade / enhancement proposal
-
Hi folks,
I was wondering if there is an "official way" to preserve some lines of code added at the end of the CARP scripts (rc.carpmaster/rc.carpbackup).I've noticed that those files are always rewritten during an ugrade, leading to a loss a functionality that has to be restored manually later.
Anyway, I suppose that a definitive solution would be to implement a simple GUI "CARP actions customization page" of user-specific code (to be called after system actions in the above said files), i.e the selection of a custom script file (stored in the pfsense configuration file), so that all customizations can survive an upgrade. This would be very useful, as it is becoming common to provide spinoff actions for a CARP status change.
-
I was wondering if there is an "official way" to preserve some lines of code added at the end of the CARP scripts (rc.carpmaster/rc.carpbackup).
Try System Patches package.
-
Thanks for your fast-as-light answer!
I had already thought of using System Patches but I had deemed it too complicated, expecially if compared with the practical solution of this problem (vi+paste text at the end of the rc.carpmaster/rc.carpbackup files).
For this reason, and to create a definitive solution to getting-common necessities, I had preferred to suggest an enhancement for upcoming releases.
-
Look at what Quagga and OpenBGPD do. There is "plugin" support in packages for hooking into the CARP code in the master/backup scripts. That's as close as you'll get without using the patches package.
-
Thank you for the suggestion jimp, infact I had noticed this recent modification in rc.carpmaster/rc.carpbackup as I was adding my code manually, but I hadn't still understood its purpose.
However, your tip doesn't fit my case; indeed I have no package to notify about the CARP status change, just some code to execute in order to make a configuration change and an update for some dynamic dns entries; as said before - beside a manual edit of the CARP script files - the best for me would be a selection of a custom file in the GUI and a related call hook in rc.carpmaster/rc.carpbackup.
-
That's what the plugin system is for โ if you want to take advantage of it, make a small/simple package that does nothing but run your code. I highly doubt we'll be adding multiple ways of running custom code in the same area, so either keep patching it or take advantage of the plugin system made for that purpose.