Für Leute die den LXDE nutzen sicher auch interessant
Code: Select all
#!/bin/bash
################################################################################
# Herunterfahren und Neustarten auch für "normale Benutzer" im RedButtonMenü #
# https://debianforum.de/forum/viewtopic.php?f=2&t=127027&start=30#p831497 #
################################################################################
#Gruppe "power" anlegen, die herunterfahren/neustarten darf
sudo addgroup power
#aktuellen Benutzer(i.d.R. pi) in Gruppe "power" aufnehmen
sudo usermod -aG power ${USER}
#PolicityKit-Datei anlegen
PKFile=/etc/polkit-1/localauthority/50-local.d/org.freedesktop.consolekit.pkla
echo -e "[Local restart]" > pkfile.tmp
echo -e "Identity=unix-group:power" >> pkfile.tmp
echo -e "Action=org.freedesktop.consolekit.system.restart" >> pkfile.tmp
echo -e "ResultAny=yes" >> pkfile.tmp
echo -e "ResultInactive=no" >> pkfile.tmp
echo -e "ResultActive=yes" >> pkfile.tmp
echo -e "" >> pkfile.tmp
echo -e "[Local shutdown]" >> pkfile.tmp
echo -e "Identity=unix-group:power" >> pkfile.tmp
echo -e "Action=org.freedesktop.consolekit.system.stop" >> pkfile.tmp
echo -e "ResultAny=yes" >> pkfile.tmp
echo -e "ResultInactive=no" >> pkfile.tmp
echo -e "ResultActive=yes" >> pkfile.tmp
sudo mv pkfile.tmp ${PKFile}
sudo chown root:root ${PKFile}
#LXpanel ggf. neustarten um Änderungen sofort zu übernehmen
if [ 1 < `ps ux | grep -c lxpanel`]
killall lxpanel
find ~/.cache/menus -name '*' -type f -print0 | xargs -0 rm
lxpanel -p LXDE &
fi