103 lines
3.2 KiB
Bash
Executable File
103 lines
3.2 KiB
Bash
Executable File
#!/bin/bash
|
|
|
|
# Sicherstellen, dass das Skript mit Root-Rechten ausgeführt wird
|
|
if [ "$EUID" -ne 0 ]; then
|
|
echo "Bitte führen Sie das Skript mit Root-Rechten aus."
|
|
exit 1
|
|
fi
|
|
|
|
apt update && apt upgrade -y
|
|
apt install -y git sudo 7zip unrar unzip network-manager software-properties-common tree bluetooth tuxedo-neofetch tuxedo-ufw-profiles ubuntu-drivers-common apt-file kerneloops language-pack-gnome-de
|
|
|
|
echo "Passe Grub-Konfig an."
|
|
|
|
# Backup der aktuellen GRUB-Konfiguration
|
|
GRUB_CONFIG="/etc/default/grub"
|
|
BACKUP_CONFIG="/etc/default/grub.bak"
|
|
|
|
if [ -f "$GRUB_CONFIG" ]; then
|
|
echo "Erstelle ein Backup der aktuellen GRUB-Konfiguration unter $BACKUP_CONFIG"
|
|
cp "$GRUB_CONFIG" "$BACKUP_CONFIG"
|
|
|
|
# GRUB-Konfiguration anpassen
|
|
echo "Passe die GRUB-Konfiguration an, um den GRUB-Loader immer anzuzeigen..."
|
|
sed -i 's/^GRUB_TIMEOUT_STYLE=.*/GRUB_TIMEOUT_STYLE=menu/' "$GRUB_CONFIG"
|
|
sed -i 's/^GRUB_TIMEOUT=.*/GRUB_TIMEOUT=5/' "$GRUB_CONFIG"
|
|
|
|
# GRUB-Konfiguration aktualisieren
|
|
echo "Aktualisiere die GRUB-Konfiguration..."
|
|
update-grub
|
|
|
|
echo "Die GRUB-Konfiguration wurde erfolgreich angepasst."
|
|
else
|
|
echo "Die Datei $GRUB_CONFIG wurde nicht gefunden. Passe GRUB-Config nicht an."
|
|
fi
|
|
|
|
# Der Code, der eingefügt werden soll
|
|
CONFIG_BLOCK='if groups | grep -q "\bsudo\b"; then
|
|
case ":$PATH:" in
|
|
*":/sbin:"*) ;;
|
|
*) export PATH="$PATH:/sbin" ;;
|
|
esac
|
|
case ":$PATH:" in
|
|
*":/usr/sbin:"*) ;;
|
|
*) export PATH="$PATH:/usr/sbin" ;;
|
|
esac
|
|
fi'
|
|
|
|
# Saubere Lösung über /etc/profile.d/
|
|
echo "$CONFIG_BLOCK" >/etc/profile.d/custom_path.sh
|
|
|
|
# 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
|
|
|
|
XDG_BLOCK='# /etc/profile.d/desktop_session_xdg_dirs.sh - Prepend a $DESKTOP_SESSION-named directory to $XDG_CONFIG_DIRS and $XDG_DATA_DIRS
|
|
|
|
DEFAULT_XDG_CONFIG_DIRS="/etc/xdg"
|
|
DEFAULT_XDG_DATA_DIRS="/usr/local/share/:/usr/share/"
|
|
|
|
if [ -n "$DESKTOP_SESSION" ]; then
|
|
# readd default if was empty
|
|
if [ -z "$XDG_CONFIG_DIRS" ]; then
|
|
XDG_CONFIG_DIRS="$DEFAULT_XDG_CONFIG_DIRS"
|
|
fi
|
|
if [ -n "${XDG_CONFIG_DIRS##*$DEFAULT_XDG_CONFIG_DIRS/xdg-$DESKTOP_SESSION*}" ]; then
|
|
XDG_CONFIG_DIRS="$DEFAULT_XDG_CONFIG_DIRS"/xdg-"$DESKTOP_SESSION":"$XDG_CONFIG_DIRS"
|
|
fi
|
|
export XDG_CONFIG_DIRS
|
|
# gnome is already added if gnome-session installed
|
|
if [ "$DESKTOP_SESSION" != "gnome" ]; then
|
|
if [ -z "$XDG_DATA_DIRS" ]; then
|
|
XDG_DATA_DIRS="$DEFAULT_XDG_DATA_DIRS"
|
|
fi
|
|
if [ -n "${XDG_DATA_DIRS##*/usr/share/$DESKTOP_SESSION*}" ]; then
|
|
XDG_DATA_DIRS=/usr/share/"$DESKTOP_SESSION":"$XDG_DATA_DIRS"
|
|
fi
|
|
export XDG_DATA_DIRS
|
|
fi
|
|
fi
|
|
'
|
|
|
|
echo "$XDG_BLOCK" >/etc/profile.d/xdg_dirs_desktop_session.sh
|
|
|
|
echo "Fertig! Bitte neu einloggen."
|
|
|