wibian-extras/install.sh
2024-04-25 14:11:42 +00:00

150 lines
5.8 KiB
Bash

#!/usr/bin/env bash
# Bannière
echo "Wibian Extras" | figlet -f big
echo -ne "\n"
# Vérifie si le script est lancé avec les droits root
if [[ $EUID -ne 0 ]]; then
echo "Vous devez avoir les privilèges root pour exécuter le script, utiliser la commande : sudo bash install.sh" 2>&1
exit 1
fi
username=$(id -u -n 1000)
builddir=$(pwd)
# Mise à jour de la liste des paquets disponibles et mise à jour des paquets installés
apt update
apt upgrade -y
# Création du répertoire Fichiers dans l'espace personnel
mkdir -p /home/$username/Fichiers
# Installation des dépendances pour Zoom
#apt install libxcb-xtest0 ibus
# Installation de la solution de virtualisation KVM
apt install -y bridge-utils dnsmasq-base qemu-system qemu-utils firewalld gir1.2-spiceclientgtk-3.0 libvirt-daemon-system virt-manager virt-viewer
adduser $username libvirt
export LIBVIRT_DEFAULT_URI='qemu:///system'
virsh net-start default
virsh net-autostart default
# Installation des logiciels en fonction du profil d'utilisation (décommenter selon le besoin)
#apt install -y blender
#apt install -y caja-nextcloud
#apt install -y geany geany-plugin-addons geany-plugin-git-changebar geany-plugin-overview geany-plugin-spellcheck geany-plugin-treebrowser geany-plugin-vimode
#apt install -y gimp gimp-data-extras gimp-help-fr
#apt install -y hugin
#apt install -y kdenlive
#apt install -y obs-studio
# Logiciel hors dépots : Youtube music (E: Sub-process /usr/bin/dpkg returned an error code)
#package="https://(.*)youtube-music_(.*).deb"
#wget $(curl -L -s https://api.github.com/repos/th-ch/youtube-music/releases/latest | grep -o -E $package) -P /tmp/wibian/
#apt install -y /tmp/wibian/youtube-music_*.deb
# Logiciel hors dépôts : PVE VDI Client
apt install -y python3-pip python3-proxmoxer python3-tk
git clone https://github.com/joshpatten/PVE-VDIClient.git
cd ./PVE-VDIClient/
pip3 install PySimpleGUI --break-system-packages
cp vdiclient.py /usr/local/bin
chmod +x /usr/local/bin/vdiclient.py
cd $builddir
# Téléchargement du logiciel hors dépôts : PDF Studio Pro 2022
wget https://download.qoppa.com/pdfstudio/v2022/PDFStudio_v2022_2_5_linux64.sh -P /home/$username/Fichiers/SH/
# Flatpak (reboot nécéssaire)
flatpak install -y flathub \
com.discordapp.Discord \
io.github.hmlendea.geforcenow-electron \
org.jdownloader.JDownloader \
com.valvesoftware.Steam \
com.stremio.Stremio
# Installation des drivers Nvidia
gpu=$(lspci | grep -i 'nvidia')
if [[ -n $gpu ]]; then
printf 'Une carte Nvidia a été détectée: %s\n' "$gpu"
apt install linux-headers-amd64
apt install firmware-misc-nonfree nvidia-driver nvidia-smi
apt install nvidia-cuda-dev nvidia-cuda-toolkit
else
printf 'Aucune carte Nvidia détectée\n'
fi
# Configuration du profil dconf de l'utilisateur pour synchroniser les paramètres via un fichier texte
mkdir -p /etc/dconf/profile
cp $builddir/dconf/user /etc/dconf/profile/user
# Mise à jour du répertoire /home de l'utilisateur principal sudo à l'origine de l'installation
mkdir -p /home/$username/.config/autostart
cp $builddir/autostart/* /home/$username/.config/autostart/
# Décommenter la ligne ci-dessous si vous avez besoin d'appliquer une commande runonce
#cp $builddir/runonce/* /home/$username/.config/autostart/
mkdir -p /home/$username/.config/dconf
cp $builddir/dconf/user.txt /home/$username/.config/dconf/
mkdir -p /home/$username/.config/mate/panel2.d/default/launchers
cp $builddir/launchers/* /home/$username/.config/mate/panel2.d/default/launchers/
mkdir -p /home/$username/.config/package-update-indicator
cp $builddir/package-update-indicator/package-update-indicator.conf /home/$username/.config/package-update-indicator/
mkdir -p /home/$username/.config/variety
cp $builddir/variety/* /home/$username/.config/variety/
mkdir -p /home/$username/.shutter/profiles
cp $builddir/shutter/* /home/$username/.shutter/profiles/
mkdir -p /home/$username/.themes
unzip $builddir/themes.zip -d /home/$username/.themes/
# Polybar pour l'utilisateur principal sudo à l'origine de l'installation (a voir dans le temps pour l'utilisateur lambda)
mkdir -p /home/$username/.config/polybar
cp $builddir/polybar/config.ini /home/$username/.config/polybar/
cp $builddir/polybar/launch.sh /home/$username/.config/polybar/
cp $builddir/polybar/polybar.desktop /home/$username/.config/autostart/
chmod +x /home/$username/.config/polybar/launch.sh
# Application du droit de propriété pour l'utilisateur principal sudo
chown -R $username:$username /home/$username/.config/
chown -R $username:$username /home/$username/.shutter/
chown -R $username:$username /home/$username/.themes/
# Mise à jour du répertoire /home pour les nouveaux utilisateurs via /etc/skel (Skeleton)
mkdir -p /etc/skel/.config/autostart
cp $builddir/autostart/* /etc/skel/.config/autostart/
mkdir -p /etc/skel/.config/dconf
cp $builddir/dconf/user.txt /etc/skel/.config/dconf/
mkdir -p /etc/skel/.config/mate/panel2.d/default/launchers
cp $builddir/launchers/* /etc/skel/.config/mate/panel2.d/default/launchers/
mkdir -p /etc/skel/.config/package-update-indicator
cp $builddir/package-update-indicator/package-update-indicator.conf /etc/skel/.config/package-update-indicator/
mkdir -p /etc/skel/.config/variety
cp $builddir/variety/* /etc/skel/.config/variety/
mkdir -p /etc/skel/.shutter/profiles
cp $builddir/shutter/* /etc/skel/.shutter/profiles/
mkdir -p /etc/skel/.themes
unzip $builddir/themes.zip -d /etc/skel/.themes/
# Suppression des sources d'installation du script
rm -r $builddir
rm -r /tmp/wibian/
# Nettoyage des paquets inutiles du système
apt autoremove
# Activation de la gestion des interfaces dans NetworkManager
sed -i 's/false/true/g' /etc/NetworkManager/NetworkManager.conf
sed -i '9,$d' /etc/network/interfaces
# Message de fin
echo "Bisous" | figlet -f big
echo -ne "\n"
# Décompte avant redémarrage
i=10
while [ $i -ge 0 ]; do printf "Redémarrage dans $i \r"; sleep 1; ((i--)); done
# redémarrage du système
reboot now