agent: Stop the agent mainloop when we get a SIGTERM
agent: Stop the agent mainloop when we get a SIGTERM

This correctly shuts down the agent in the presence of a SIGTERM,
including letting us unregister cleanly from polkit and so on.

Note that we only wait for one SIGTERM, if we receive a second one
a little later, that one will actually terminate the process.

Reviewed-by: Marius Vollmer <bb11c6e942c5cc765df5f04da146b3198127a7a3@redhat.com>

sub-mod/cockpit,stefwalter/cockpit,andreasn/cockpit,moolitayer/cockpit,netzvieh/cockpit,jscotka/cockpit,moolitayer/cockpit,sub-mod/cockpit,andreasn/cockpit,kkaempf/cockpit,denysvitali/cockpit,larsu/cockpit,stefwalter/cockpit,matobet/cockpit,cockpituous/cockpit,larskarlitski/cockpit,jscotka/cockpit,Thermionix/cockpit,matobet/cockpit,vbatts/cockpit,harishanand95/cockpit,martinpitt/cockpit,nmav/cockpit,nmav/cockpit,zigitax/cockpit,firebitsbr/cockpit,denysvitali/cockpit,vanloswang/cockpit,vbatts/cockpit,mareklibra/cockpit,michalskrivanek/cockpit,Scribery/cockpit,firebitsbr/cockpit,fridex/cockpit,mareklibra/cockpit,xhad/cockpit,matobet/cockpit,moraleslazaro/cockpit,martinpitt/cockpit,darioajr/cockpit,kkaempf/cockpit,evol262/cockpit,darioajr/cockpit,xhad/cockpit,petervo/cockpit,michalskrivanek/cockpit,larsu/cockpit,SotolitoLabs/cockpit,cockpit-project/cockpit,larskarlitski/cockpit,denysvitali/cockpit,petervo/cockpit,cockpit-project/cockpit,arilivigni/cockpit,darioajr/cockpit,moraleslazaro/cockpit,harishanand95/cockpit,garrett/cockpit,Scribery/cockpit,michalskrivanek/cockpit,FireDrunk/cockpit,xhad/cockpit,kkaempf/cockpit,sgallagher/cockpit,evol262/cockpit,mvollmer/cockpit,vanloswang/cockpit,jscotka/cockpit,Armstrong1992/cockpit,maxamillion/cockpit,harishanand95/cockpit,netzvieh/cockpit,garrett/cockpit,Scribery/cockpit,larskarlitski/cockpit,haiyangd/cockpit_view,larsu/cockpit,mareklibra/cockpit,michalskrivanek/cockpit,zigitax/cockpit,matobet/cockpit,sgallagher/cockpit,sgallagher/cockpit,Thermionix/cockpit,martinpitt/cockpit,xhad/cockpit,firebitsbr/cockpit,larsu/cockpit,xhad/cockpit,arilivigni/cockpit,cockpituous/cockpit,moraleslazaro/cockpit,dperpeet/cockpit,evol262/cockpit,Armstrong1992/cockpit,matobet/cockpit,harishanand95/cockpit,fridex/cockpit,andreasn/cockpit,FireDrunk/cockpit,cockpituous/cockpit,moolitayer/cockpit,moraleslazaro/cockpit,netzvieh/cockpit,moraleslazaro/cockpit,petervo/cockpit,xhad/cockpit,Armstrong1992/cockpit,netzvieh/cockpit,Thermionix/cockpit,larskarlitski/cockpit,mvollmer/cockpit,Thermionix/cockpit,netzvieh/cockpit,sgallagher/cockpit,andreasn/cockpit,evol262/cockpit,fridex/cockpit,harishanand95/cockpit,petervo/cockpit,larskarlitski/cockpit,xhad/cockpit,nmav/cockpit,SotolitoLabs/cockpit,vanloswang/cockpit,denysvitali/cockpit,moraleslazaro/cockpit,haiyangd/cockpit_view,mareklibra/cockpit,deryni/cockpit,dperpeet/cockpit,jscotka/cockpit,dperpeet/cockpit,michalskrivanek/cockpit,maxamillion/cockpit,sub-mod/cockpit,arilivigni/cockpit,jscotka/cockpit,deryni/cockpit,vanloswang/cockpit,SotolitoLabs/cockpit,mareklibra/cockpit,vbatts/cockpit,haiyangd/cockpit_view,fridex/cockpit,andreasn/cockpit,petervo/cockpit,dperpeet/cockpit,sgallagher/cockpit,stefwalter/cockpit,denysvitali/cockpit,jscotka/cockpit,deryni/cockpit,firebitsbr/cockpit,cockpit-project/cockpit,matobet/cockpit,SotolitoLabs/cockpit,larsu/cockpit,Scribery/cockpit,netzvieh/cockpit,FireDrunk/cockpit,sgallagher/cockpit,dperpeet/cockpit,moolitayer/cockpit,vanloswang/cockpit,darioajr/cockpit,haiyangd/cockpit_view,maxamillion/cockpit,garrett/cockpit,cockpituous/cockpit,harishanand95/cockpit,vbatts/cockpit,deryni/cockpit,stefwalter/cockpit,petervo/cockpit,andreasn/cockpit,evol262/cockpit,cockpituous/cockpit,Scribery/cockpit,firebitsbr/cockpit,larskarlitski/cockpit,sub-mod/cockpit,dperpeet/cockpit,cockpit-project/cockpit,FireDrunk/cockpit,mvollmer/cockpit,Scribery/cockpit,Thermionix/cockpit,maxamillion/cockpit,Scribery/cockpit,nmav/cockpit,moraleslazaro/cockpit,Armstrong1992/cockpit,vanloswang/cockpit,martinpitt/cockpit,garrett/cockpit,kkaempf/cockpit,harishanand95/cockpit,deryni/cockpit,mareklibra/cockpit,zigitax/cockpit,sub-mod/cockpit,stefwalter/cockpit,zigitax/cockpit,deryni/cockpit,andreasn/cockpit,evol262/cockpit,vbatts/cockpit,SotolitoLabs/cockpit,zigitax/cockpit,cockpituous/cockpit,stefwalter/cockpit,SotolitoLabs/cockpit,mvollmer/cockpit,fridex/cockpit,moolitayer/cockpit,martinpitt/cockpit,maxamillion/cockpit,kkaempf/cockpit,mareklibra/cockpit,nmav/cockpit,FireDrunk/cockpit,vanloswang/cockpit,SotolitoLabs/cockpit,vbatts/cockpit,mvollmer/cockpit,Armstrong1992/cockpit,arilivigni/cockpit,arilivigni/cockpit,arilivigni/cockpit,cockpit-project/cockpit,arilivigni/cockpit,michalskrivanek/cockpit,haiyangd/cockpit_view,larskarlitski/cockpit,darioajr/cockpit,petervo/cockpit,deryni/cockpit,stefwalter/cockpit,larsu/cockpit,fridex/cockpit,dperpeet/cockpit,michalskrivanek/cockpit,sgallagher/cockpit,Thermionix/cockpit,garrett/cockpit