Quantcast
Channel: Raspberry Pi Forums
Viewing all articles
Browse latest Browse all 8013

Raspberry Pi OS • Re: How to request reboot when building a postinst script in package

$
0
0
I found this page https://akmatori.com/blog/understanding ... ile-ubuntu. Apparently it is a postinst script's responsibility to create an empty /run/reboot-required file if during a package installation it wants the system to reboot for the package to take effect. It is any notification tool's responsibility to monitor this and make the appropriate notification.

I am only concerned about the postinst script right now so I added the following, and cleaned up some obvious mistakes in the script, and the first couple of setups seem to do the right thing:

Code:

## If we don't need to reboot to get the I2C bus device go# ahead and restart the service.#if [ $need_reboot = "false" ]; then  #  # If it is currently running pick up the new version  # restart will stop and start a new one if one is running or  # start a new one if not  #   systemctl -q restart $qw_serviceelse  #  # We need to indicate that a reboot is needed  #  touch /run/reboot-required  # If the package isn't already in the reboot-required.pkgs file then add it  if [ ! -f /run/reboot-required.pkgs ] || ! grep -q "qw-weatherstation" /run/reboot-required.pkgs; then    echo "qw-weatherstation" >> /run/reboot-required.pkgs  fifi
I wasn't previously aware of the role of /run/reboot-request. It is good to know.

Thanks
Chris

Statistics: Posted by chriskot870 — Sat Jun 14, 2025 6:31 am



Viewing all articles
Browse latest Browse all 8013

Trending Articles