Fügt sudo-Hinweis zu /etc/profile.d hinzu.

This commit is contained in:
DragonSlayer_14 2025-02-22 17:04:19 +01:00
parent 8e4a86268e
commit 81ac3bd66b

View File

@ -25,5 +25,26 @@ fi'
echo "$CONFIG_BLOCK" > /etc/profile.d/custom_path.sh
chmod +x /etc/profile.d/custom_path.sh
echo "Fertig! Bitte neu einloggen oder 'source /etc/profile.d/custom_path.sh' ausführen."
# Sudo-Hinweis für bash.bashrc
SUDO_HINT_BLOCK='# sudo hint
if [ ! -e "$HOME/.sudo_as_admin_successful" ] && [ ! -e "$HOME/.hushlogin" ] ; then
case " $(groups) " in *\ admin\ *|*\ sudo\ *)
if [ -x /usr/bin/sudo ]; then
cat <<-EOF
To run a command as administrator (user "root"), use "sudo <command>".
See "man sudo_root" for details.
EOF
fi
esac
fi'
# Prüfen, ob der sudo-Hinweis bereits existiert
if ! grep -Fxq "# sudo hint" /etc/bash.bashrc; then
echo -e "\n$SUDO_HINT_BLOCK" | tee -a /etc/bash.bashrc > /dev/null
echo "Sudo-Hinweis zur bash.bashrc hinzugefügt."
else
echo "Sudo-Hinweis ist bereits in bash.bashrc vorhanden."
fi
echo "Fertig! Bitte neu einloggen oder 'source /etc/profile.d/custom_path.sh' & 'source /etc/bash.bashrc' ausführen."