diff --git a/battery.sh b/battery.sh index aa0066a..570ce19 100755 --- a/battery.sh +++ b/battery.sh @@ -509,6 +509,14 @@ if [[ "$action" == "update" ]]; then read fi curl -sS https://raw.githubusercontent.com/actuallymentor/battery/main/update.sh | bash + if [[ ! "$setting" == "silent" ]]; then + # The setting "silent" is always passed when `battery update` is invoked from the UI app, + # which decides whether to invoke `battery visudo` as well. But for Terminal-only users + # there is no UI app. So it's either we invoke `battery visudo` here, or assume that users + # remember to do it themselves, which did not work in the past. + echo "Runnig $battery_binary visudo" + $battery_binary visudo + fi fi exit 0 fi diff --git a/update.sh b/update.sh index cca1f3b..fb13c58 100644 --- a/update.sh +++ b/update.sh @@ -24,12 +24,9 @@ chown $USER $binfolder/battery chmod 755 $binfolder/battery chmod u+x $binfolder/battery -echo "[ 3 ] Updating visudo declarations" -$binfolder/battery visudo - # Remove tempfiles cd rm -rf $tempfolder -echo "[ 4 ] Removed temporary folder" +echo "[ 3 ] Removed temporary folder" echo -e "\nšŸŽ‰ Battery tool updated.\n"