3

After installing a custom package I should force a reboot of the system.

I looked at couple of solutions to this

  1. use notify-send to display user notification followed by a reboot command, which did work as planned. But the user notification is only shown when I install the package from command line and not when I installed through Software Center.

  2. I came across some posts where they suggested adding the following to the postinst script

    [ -x /usr/share/update-notifier/notify-reboot-required ] && \
    /usr/share/update-notifier/notify-reboot-required || true
    

    Tried including the above in the postinst script but all it does is updating the two files /var/run/reboot-required.pkgs and /var/run/reboot-required with restart information.

    It neither displayed user-notification nor rebooted the system after package is installed.

Is there a way to display reboot required user notification in Ubuntu/Fedora/Open SUSE ?

1 Answer 1

2

I figured out the answer for this. Can display post install user notification using the following postinst script.

Create a file with the name postinst and copy the following script into it. This script should be copied into the right directory before creating the Debian package.

Note: This is for Debian environment.

#!/bin/sh -e

if [ -d /var/lib/update-notifier/user.d/ ]; then
   rm -rf /var/lib/update-notifier/user.d/PackageName
   cat << EOF >> /var/lib/update-notifier/user.d/PackageName
Name: PackageName Post Install Notification 
Priority: High
Terminal: False
#Command: /usr/bin/PackageName
Description: Reboot is required to complete the installation. 
EOF
   touch /var/lib/update-notifier/dpkg-run-stamp
fi

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .