Do not invoke battery visudo from update.sh, because it may crash the UI (issue #377)

This commit is contained in:
base47
2025-11-20 01:15:25 +01:00
parent 8f63a7b9be
commit 232559e06c
2 changed files with 9 additions and 4 deletions

View File

@@ -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

View File

@@ -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"