diff mbox series

utils/pb-console: Trap SIGTERM on boot

Message ID 20190225041051.30911-1-sam@mendozajonas.com
State Accepted
Headers show
Series utils/pb-console: Trap SIGTERM on boot | expand

Commit Message

Sam Mendoza-Jonas Feb. 25, 2019, 4:10 a.m. UTC
On kexec all processes will be sent a SIGTERM and SIGKILL. By default
there are messages on the console alerting the user to this, however in
some implementations these messages are disabled. This can have the
effect of the UI seemingly exiting to the shell on boot and hanging for
a short while before the kexec actually jumps into the next kernel.
Trap the SIGTERM sent to the pb-console parent process and print a short
message to the screen instead of momentarily dropping to the shell and
printing the usual help messages.

While here also cleanup the shell help messages below which are now
handled in the shell's .shrc file.

Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>
---
 utils/pb-console | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Sam Mendoza-Jonas March 7, 2019, 1:50 a.m. UTC | #1
On Mon, 2019-02-25 at 15:10 +1100, Samuel Mendoza-Jonas wrote:
> On kexec all processes will be sent a SIGTERM and SIGKILL. By default
> there are messages on the console alerting the user to this, however in
> some implementations these messages are disabled. This can have the
> effect of the UI seemingly exiting to the shell on boot and hanging for
> a short while before the kexec actually jumps into the next kernel.
> Trap the SIGTERM sent to the pb-console parent process and print a short
> message to the screen instead of momentarily dropping to the shell and
> printing the usual help messages.
> 
> While here also cleanup the shell help messages below which are now
> handled in the shell's .shrc file.
> 
> Signed-off-by: Samuel Mendoza-Jonas <sam@mendozajonas.com>

Merged as 5c726bd

> ---
>  utils/pb-console | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/utils/pb-console b/utils/pb-console
> index ad601e2e..5ba98cc4 100644
> --- a/utils/pb-console
> +++ b/utils/pb-console
> @@ -135,12 +135,11 @@ fi
>  dmesg -n 1
>  
>  trap '' SIGINT
> +trap 'reset; echo "SIGTERM received, booting..."; sleep 2' SIGTERM
>  
>  while :
>  do
>  	$ui $verbose_opt
>  	reset
> -	echo "Exiting petitboot. Type 'exit' to return."
> -	echo "You may run 'pb-sos' to gather diagnostic data"
>  	$shell
>  done
diff mbox series

Patch

diff --git a/utils/pb-console b/utils/pb-console
index ad601e2e..5ba98cc4 100644
--- a/utils/pb-console
+++ b/utils/pb-console
@@ -135,12 +135,11 @@  fi
 dmesg -n 1
 
 trap '' SIGINT
+trap 'reset; echo "SIGTERM received, booting..."; sleep 2' SIGTERM
 
 while :
 do
 	$ui $verbose_opt
 	reset
-	echo "Exiting petitboot. Type 'exit' to return."
-	echo "You may run 'pb-sos' to gather diagnostic data"
 	$shell
 done