#!/bin/sh
# Action script to collect battery status when the power connector is
# inserted or removed.  Not working as intended on Debian due to
# bug #818649, but worked around by adding udev rule manually.
#
# Copyright: 2013,2016 Petter Reinholdtsen
# License:   GPL-2+
#

PATH=/sbin:/usr/sbin:/bin:/usr/bin

case "${1}" in
    false|true)
	if [ -x /usr/share/battery-stats/collect-csv ]; then
	    /usr/share/battery-stats/collect-csv
	    /usr/sbin/battery-stats-collector -1
	fi
        ;;
esac
