• spiiroin's avatar
    Make command line reboot go through dsme when applicable · 3f9e5b24
    spiiroin authored
    Users that are not deeply familiar with nemomobile can assume that
    running reboot utility from command line is just fine for rebooting
    the device. Most of the times it does work, but it also bypasses
    shutdown/reboot policy that is in dsme (emergency calls etc should
    block immediate reboot/shutdown) and causes save-data and pre-shutdown
    signals not to be sent / shutdown logo not shown.
    
    Simply replacing reboot, halt and poweroff utilities with other binaries
    is problematic since it would a) require non-upstreamable patches to
    systemd b) cause failures if dsme itself is down for some reason.
    
    Define shell function wrappers for reboot, poweroff, halt and shutdown.
    
    The wrapper functions use dsmetool functionality to perform reboot and
    shutdown. If unhandled parameters are passed to wrappers, dsme is not
    running or dsmetool fails for some reason, the wrappers will fall back
    to using systemd binaries.
    
    The wrappers are made available to interactive login shells only. Any
    scripts that use reboot & co commands are not affected.
    
    [dsme] Make command line reboot go through dsme when applicable. Fixes MER#1049
    3f9e5b24