#!/usr/bin/env bash

if [ -f "/etc/pwrstatd.conf" ]; then
    /opt/dosis2/bin/conf-edit "/etc/pwrstatd.conf" --output "/etc/pwrstatd.conf" --set ".powerfail-delay=5"
    /opt/dosis2/bin/conf-edit "/etc/pwrstatd.conf" --output "/etc/pwrstatd.conf" --set ".powerfail-shutdown=no"
    /opt/dosis2/bin/conf-edit "/etc/pwrstatd.conf" --output "/etc/pwrstatd.conf" --set ".lowbatt-delay=0"
    /opt/dosis2/bin/conf-edit "/etc/pwrstatd.conf" --output "/etc/pwrstatd.conf" --set ".lowbatt-duration=3"
    /opt/dosis2/bin/conf-edit "/etc/pwrstatd.conf" --output "/etc/pwrstatd.conf" --set ".shutdown-sustain=300"
    /opt/dosis2/bin/conf-edit "/etc/pwrstatd.conf" --output "/etc/pwrstatd.conf" --set ".allowed-device-nodes=/dev/ttyS0;/dev/ttyS1;hiddev"
    /opt/dosis2/bin/conf-edit "/etc/pwrstatd.conf" --output "/etc/pwrstatd.conf" --set ".powerfail-cmd-path=/etc/dosis-pwrstatd-powerfail"
    /opt/dosis2/bin/conf-edit "/etc/pwrstatd.conf" --output "/etc/pwrstatd.conf" --set ".lowbatt-cmd-path=/etc/dosis-pwrstatd-lowbatt"
fi
