I'm making a opkg package for a software update.
This package require a reboot after installation and needs some work done after the next reboot.
I added a shutdown -h now in postinst script but it seems to shutdown too early and interrupts the opkg install command.
Then the opkg system won't have the package info recorded, like opkg list-installed won't list the package as installed.
So the problem I'm trying to solve is: how to reliably schedule a shutdown/reboot in postinst script of OPKG package?
But I guess the fundamental question is, how to schedule a task in a shell script that runs as soon as the all the ancestors of current shell die, but not sooner than that?
Reference: What's postinst script and opkg package management system
ipkg install
callsipkg configure
,ipkg configure
callspostinst
,postinst
callsshutdown -h now
. I want to schedule toshutdown
to afteripkg install
finishes. Currently I can donohup sleep 5 && shutdown -h now &
inpostinst
assuming 5 seconds is long enough for everything to finish, but really not sure. – user3528438 Mar 23 '16 at 00:56