Criptoptimierung mit Chatgpt

This commit is contained in:
sebastian.zell 2024-12-28 22:23:30 +00:00
parent 56a43d8daf
commit f1840740dc
1 changed files with 104 additions and 109 deletions

View File

@ -1,53 +1,35 @@
#!/bin/bash
# Farben für die Ausgabe definieren
# ================================
# Skript zur Konfiguration von Debian
# ================================
# Beschreibung:
# Dieses Skript aktualisiert die Quellenliste, fügt neue Repositorys hinzu,
# installiert notwendige Softwarepakete über APT und Flatpak, und installiert
# zusätzliche .deb-Pakete.
# Farben für farbige Terminalausgaben definieren
GREEN='\033[0;32m'
RED='\033[0;31m'
NC='\033[0m' # Keine Farbe
# Datei und neuer Inhalt definieren
# Variablen
SOURCES_FILE="/etc/apt/sources.list"
NEW_CONTENT="deb http://deb.debian.org/debian bookworm main contrib non-free
NEW_CONTENT=$(cat <<EOF
deb http://deb.debian.org/debian bookworm main contrib non-free
deb-src http://deb.debian.org/debian bookworm main contrib non-free
deb http://deb.debian.org/debian-security/ bookworm-security main contrib non-free
deb-src http://deb.debian.org/debian-security/ bookworm ecurity main contrib non-free
deb-src http://deb.debian.org/debian-security/ bookworm-security main contrib non-free
deb http://deb.debian.org/debian bookworm-updates main contrib non-free
deb-src http://deb.debian.org/debian bookworm-updates main contrib non-free
deb http://deb.debian.org/debian bookworm-updates main contrib non-free
deb-src http://deb.debian.org/debian bookworm-updates main contrib non-free
deb http://www.ecodms.de/ecodms_240264/bookworm /
deb http://deb.debian.org/debian bookworm-backports main
EOF
)
deb http://deb.debian.org/debian bookworm-backports main"
# Datei leeren und neuen Inhalt hinzufügen
echo -e "${GREEN}Leere die Datei ${SOURCES_FILE} und füge neuen Inhalt hinzu...${NC}"
echo "$NEW_CONTENT" > "$SOURCES_FILE"
# Bestätigung der Änderung
if [[ $? -eq 0 ]]; then
echo -e "${GREEN}Die Datei ${SOURCES_FILE} wurde erfolgreich aktualisiert.${NC}"
else
echo -e "${RED}Fehler beim Aktualisieren der Datei ${SOURCES_FILE}.${NC}"
exit 1
fi
# GPG-Schlüssel hinzufügen
wget -qO /etc/apt/trusted.gpg.d/ecodms.asc http://www.ecodms.de/gpg/ecodms.key || { echo "Download des GPG-Schlüssels fehlgeschlagen"; exit 1; }
# Paketlisten aktualisieren
echo -e "${GREEN}Aktualisiere die Paketliste...${NC}"
apt update
# Abschlussmeldung
echo -e "${GREEN}Die Konfiguration der Repositories wurde abgeschlossen!${NC}"
# APT-Pakete
APT_PACKAGES=(
"vlc"
"thunderbird"
@ -66,7 +48,6 @@ APT_PACKAGES=(
"terminator"
)
# Flatpak-Pakete
FLATPAK_PACKAGES=(
"com.spotify.Client"
"com.bitwarden.desktop"
@ -74,94 +55,108 @@ FLATPAK_PACKAGES=(
"com.rustdesk.RustDesk"
)
# Alternativen für nicht verfügbare Pakete
ALTERNATIVES=(
"whatsapp-linux-app: Alternative: WhatsApp Web im Browser verwenden."
"chatgpt-desktop: Alternative: ChatGPT über die Weboberfläche nutzen."
)
# System aktualisieren
echo -e "${GREEN}System wird aktualisiert...${NC}"
sudo apt update && sudo apt upgrade -y
DOWNLOAD_DIR=~/deb_packages
# APT-Pakete installieren
echo -e "${GREEN}APT-Pakete werden installiert...${NC}"
for PACKAGE in "${APT_PACKAGES[@]}"; do
if sudo apt install -y "$PACKAGE"; then
echo -e "${GREEN}$PACKAGE erfolgreich installiert.${NC}"
# ================================
# Funktionen
# ================================
# Funktion: Quellenliste aktualisieren
update_sources() {
echo -e "${GREEN}Aktualisiere die Quellenliste...${NC}"
echo "$NEW_CONTENT" | sudo tee "$SOURCES_FILE" > /dev/null
if [[ $? -eq 0 ]]; then
echo -e "${GREEN}Die Quellenliste wurde erfolgreich aktualisiert.${NC}"
else
echo -e "${RED}Fehler bei der Installation von $PACKAGE.${NC}"
echo -e "${RED}Fehler beim Aktualisieren der Quellenliste.${NC}"
exit 1
fi
done
# Flatpak installieren, falls nicht vorhanden
if ! command -v flatpak &> /dev/null; then
echo -e "${GREEN}Flatpak wird installiert...${NC}"
sudo apt install -y flatpak
# Flathub-Repository hinzufügen
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
fi
# GPG-Schlüssel hinzufügen
echo -e "${GREEN}GPG-Schlüssel hinzufügen...${NC}"
wget -qO /etc/apt/trusted.gpg.d/ecodms.asc http://www.ecodms.de/gpg/ecodms.key || {
echo -e "${RED}Download des GPG-Schlüssels fehlgeschlagen.${NC}"
exit 1
}
}
# Flatpak-Pakete installieren
echo -e "${GREEN}Flatpak-Pakete werden installiert...${NC}"
for PACKAGE in "${FLATPAK_PACKAGES[@]}"; do
if flatpak install -y flathub "$PACKAGE"; then
echo -e "${GREEN}$PACKAGE erfolgreich installiert.${NC}"
else
echo -e "${RED}Fehler bei der Installation von $PACKAGE.${NC}"
# Funktion: System aktualisieren und Pakete installieren
install_apt_packages() {
echo -e "${GREEN}System wird aktualisiert...${NC}"
sudo apt update && sudo apt upgrade -y
echo -e "${GREEN}Installiere APT-Pakete...${NC}"
for PACKAGE in "${APT_PACKAGES[@]}"; do
if sudo apt install -y "$PACKAGE"; then
echo -e "${GREEN}$PACKAGE erfolgreich installiert.${NC}"
else
echo -e "${RED}Fehler bei der Installation von $PACKAGE.${NC}"
fi
done
}
# Funktion: Flatpak installieren und Pakete einrichten
install_flatpak_packages() {
if ! command -v flatpak &> /dev/null; then
echo -e "${GREEN}Flatpak wird installiert...${NC}"
sudo apt install -y flatpak
sudo flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
fi
done
# Alternativen anzeigen
echo -e "${GREEN}Alternativen für nicht verfügbare Pakete:${NC}"
for ALT in "${ALTERNATIVES[@]}"; do
echo -e "${GREEN}$ALT${NC}"
done
echo -e "${GREEN}Installiere Flatpak-Pakete...${NC}"
for PACKAGE in "${FLATPAK_PACKAGES[@]}"; do
if flatpak install -y flathub "$PACKAGE"; then
echo -e "${GREEN}$PACKAGE erfolgreich installiert.${NC}"
else
echo -e "${RED}Fehler bei der Installation von $PACKAGE.${NC}"
fi
done
}
echo -e "${GREEN}Installation abgeschlossen.${NC}"
# Funktion: Zusätzliche .deb-Pakete herunterladen und installieren
install_deb_packages() {
echo -e "${GREEN}Lade zusätzliche .deb-Pakete herunter...${NC}"
mkdir -p "$DOWNLOAD_DIR"
wget -O "$DOWNLOAD_DIR/shadow-amd64.deb" https://update.shadow.tech/launcher/prod/linux/x86_64/shadow-amd64.deb
wget -O "$DOWNLOAD_DIR/Installer_Fakturama_linux_x64_2.1.3c.deb" https://files.fakturama.info/release/v2.1.3/Installer_Fakturama_linux_x64_2.1.3c.deb
wget -O "$DOWNLOAD_DIR/nomachine_8.14.2_1_amd64.deb" https://download.nomachine.com/download/8.14/Linux/nomachine_8.14.2_1_amd64.deb
wget -O "$DOWNLOAD_DIR/xpipe-installer-linux-x86_64.deb" https://github.com/xpipe-io/xpipe/releases/latest/download/xpipe-installer-linux-x86_64.deb
# Unnötige Pakete entfernen
apt-get autoremove -y
# Zusätzliche Dateien aus Zip entpacken
wget -O "$DOWNLOAD_DIR/folder.zip" "https://next.zell-cloud.de/nextcloud/s/6BHNNj9WpoAFpoW/download"
unzip -j "$DOWNLOAD_DIR/folder.zip" "*.deb" -d "$DOWNLOAD_DIR" && rm -f "$DOWNLOAD_DIR/folder.zip"
echo -e "${GREEN}Installiere .deb-Pakete...${NC}"
for DEB_FILE in "$DOWNLOAD_DIR"/*.deb; do
if sudo apt install -y "$DEB_FILE"; then
echo -e "${GREEN}$DEB_FILE erfolgreich installiert.${NC}"
else
echo -e "${RED}Fehler bei der Installation von $DEB_FILE.${NC}"
fi
done
}
# Funktion: Alternativen anzeigen
show_alternatives() {
echo -e "${GREEN}Alternativen für nicht verfügbare Pakete:${NC}"
for ALT in "${ALTERNATIVES[@]}"; do
echo -e "${GREEN}$ALT${NC}"
done
}
# ================================
# Hauptskript
# ================================
update_sources
install_apt_packages
install_flatpak_packages
install_deb_packages
show_alternatives
# Verzeichnis erstellen für Downloads und entpackte Pakete
mkdir -p ~/deb_packages
# Zip-Datei von Nextcloud herunterladen
wget -O folder.zip "https://next.zell-cloud.de/nextcloud/s/6BHNNj9WpoAFpoW/download"
wget -O ~/deb_packages/shadow-amd64.deb https://update.shadow.tech/launcher/prod/linux/x86_64/shadow-amd64.deb
wget -O ~/deb_packages/Installer_Fakturama_linux_x64_2.1.3c.deb https://files.fakturama.info/release/v2.1.3/Installer_Fakturama_linux_x64_2.1.3c.deb
wget -O ~/deb_packages/nomachine_8.14.2_1_amd64.deb https://download.nomachine.com/download/8.14/Linux/nomachine_8.14.2_1_amd64.deb
wget -O ~/deb_packages/xpipe-installer-linux-x86_64.deb https://github.com/xpipe-io/xpipe/releases/latest/download/xpipe-installer-linux-x86_64.deb
# Nur die .deb-Dateien aus dem Zip-Archiv entpacken
unzip -j folder.zip "*.deb" -d ~/deb_packages
# Zip-Datei löschen, um Speicherplatz zu sparen
rm -f folder.zip
# Auflisten der entpackten .deb-Pakete
ls ~/deb_packages/*.deb
# Einzelne Installation der .deb-Pakete mit Fehlerprüfung
for DEB_FILE in ~/deb_packages/*.deb; do
echo "Installiere $DEB_FILE..."
sudo apt install -y "$DEB_FILE" || echo "Fehler bei der Installation von $DEB_FILE"
done
# Optional: Entfernen der .deb-Dateien nach erfolgreicher Installation
rm -f ~/deb_packages/*.deb
echo -e "${GREEN}Skript abgeschlossen.${NC}"