🐛 fix weird occasional bug where script gets confudes by fi

This commit is contained in:
Mentor
2022-01-28 10:31:38 +01:00
parent 8fc5ca425e
commit 5decc65ce6
2 changed files with 10 additions and 1 deletions

View File

@@ -91,11 +91,13 @@ function log() {
# Help message
if [ -z "$action" ]; then
echo -e "$helpmessage"
exit 0
fi
# Visudo message
if [[ "$action" == "visudo" ]]; then
echo -e "$visudoconfig"
exit 0
fi
# Update helper
@@ -104,6 +106,8 @@ if [[ "$action" == "update" ]]; then
echo "Press any key to continue"
read
curl -sS https://raw.githubusercontent.com/actuallymentor/battery/main/setup.sh | sudo bash
battery
exit 0
fi
@@ -119,6 +123,8 @@ if [[ "$action" == "charging" ]]; then
disable_charging
fi
exit 0
fi
# Charging on/off controller
@@ -141,6 +147,8 @@ if [[ "$action" == "charge" ]]; then
disable_charging
log "Charging completed at $battery_percentage%"
exit 0
fi
@@ -148,5 +156,6 @@ fi
if [[ "$action" == "status" ]]; then
log "Battery at $( get_battery_percentage )% ($( get_remaining_time ) remaining), smc charging $( get_smc_charging_status )"
exit 0
fi

View File

@@ -33,4 +33,4 @@ echo -e "\nRemoving temp folder $tempfolder"
rm -rf $tempfolder
echo -e "\nSmc binary built"
echo -e "\nBattery tool installed. Type \"battery\" for instructions."
echo -e "\n🎉 Battery tool installed. Type \"battery\" for instructions."