#!/bin/sh
if [ $# -lt 1 ] ; then
    echo "Usage: $0 <maxpercent>"
    exit 1
fi
MAXPERCENT=$1
MINPERCENT=$(($MAXPERCENT-10))
if [ $MINPERCENT -lt 60 ] ; then
    echo "I'll not set MINPERCENT less than 60 - you wanted $MINPERCENT"
    exit 1
fi

sudo tlp setcharge $MINPERCENT $MAXPERCENT BAT0
sudo tlp setcharge $MINPERCENT $MAXPERCENT BAT1
sudo tlp-stat -b

