#!/bin/sh

### BEGIN INIT INFO
# Provides:          depthchargectl-bless
# Required-Start:    $remote_fs
# Required-Stop:
# Default-Start:     2 3 4 5
# Default-Stop:
# Short-Description: Mark the current depthcharge partition as successful
### END INIT INFO

if ! command -v depthchargectl >/dev/null 2>/dev/null; then
    exit 0
fi

if ! grep "cros_secure" /proc/cmdline >/dev/null 2>/dev/null; then
    # Not booted by depthcharge.
    exit 0
fi

if [ -f /lib/lsb/init-functions ]; then
    . /lib/lsb/init-functions
fi

case "$1" in
    start|restart|reload|force-reload)
        depthchargectl bless
        ;;
    stop|status)
        # Not a daemon.
        ;;
esac
