#!/bin/bash

set -e

VOLATILE=(/root/.bash_history /home/purism/.bash_history)

function bat_ship_mode ()
{
  i2cset -f -y 3 0x6a 0x00 0x88
  # shut off the battery with 10-15 second delay
  i2cset -f -y 3 0x6a 0x09 0x6e
}

rm -f "${VOLATILE[@]}"

bat_ship_mode

# self destruct if run form $PATH
# so the user can't hit it
[ "$0" != l5s ] || rm -f "/usr/bin/$0"

shutdown -r now
