Post Upgrade Script?
-
Hi all
I'm looking for a possibility to run serveral tasks after an pfSense upgrade has been performed. Is there a forseen possibility to run a customized post upgrade script or similar?
As another option, i tried to analyse /usr/local/libexec/pfSense-upgrade. I understand that initally a kernel update will be performed and then the box will be rebooted afterwards. I tried to add my custom actions within the section 'if [ "${next_stage}" = "2" ]; then', but as i can see this section is not beeing executed in case a reboot was performed. Does somebody know where the stage2 will be launched after a reboot?
Best regards
Tom -
Ok - i found out why my modifications in pfSense-upgrade never run. They are overwitten by a newer upgrade-script before the update will be performed...
# If a new version of pfSense-upgrade is available, upgrade it # and return a special code 99 used by wrapper to run newer # version again using the same parameters if [ "$(compare_pkg_version ${product}-upgrade)" != "=" ]; then _exec "pkg-static upgrade${dont_update} -f \ ${product}-upgrade" "Upgrading ${product}-upgrade" \ mute _exit 99 fi
Dear devs:
- Can we get the possibility to configure a post-upgrade script?
- Probably a script that we can configure in /etc/inc/globals.inc?
- Probably we can link to it like this: https://myhost.localdomain.local/my_pfsense_postupgrade_script.sh?
- Or maybe in the config file?
- And we can configure a post_upgrade_script.sh within the GUI?
Br
Tom -
Hi all
I was able to create a solution for my need by using "the hidden config.xml option <shellcmd> will run the command specified towards the end of the boot process."
See here: https://doc.pfsense.org/index.php/Executing_commands_at_boot_time
A snippet of code called by <shellcmd>
VERSION=`cat /etc/version` PATCH=`cat /etc/version.patch` CONFCHECK="/cf/conf/checkfile-${VERSION}-${PATCH}.done" if [ ! -f ${CONFCHECK} ]; then # do some stuff touch ${CONFCHECK} fi
If someone has a better option, please let me know - would be awesome.
Have fun
Tom -
That's unlikely to be supported as there really aren't enough use cases to justify jumping through the hoops to get there.
You may have more luck using an
<earlyshellcmd>
to test on boot and perform your action. -
Hi Jim
We have posted nearly the same time our reply. Thank you for the hint, that is what i was looking for. However, my personal believe is, of course this is a solution but probably not the smartest and sexiest. Maybe there is a explicit 'post upgrade script'-possibility for the future.
Cheers
Tom