wibian/install.sh
2024-02-28 18:09:04 +00:00

258 lines
8.9 KiB
Bash

#!/usr/bin/env bash
# Bannière
cat wibian.figlet
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)
# Changement de la langue par défaut
localectl set-locale LANG=fr_FR.UTF-8
echo "La langue française a été définie par défaut pour ce système"
# Définition du nom d'hôte
echo "- Quel nom d'hôte voulez-vous donner à cette nouvelle machine ?"
read machinename
clear
hostnamectl set-hostname $machinename
sed -i '1i 127.0.0.1\t'$machinename /etc/hosts
# noatime
cp /etc/fstab /etc/fstab.bck
awk '!/^#/ && ($3 != "swap") && ($2 != "/media/cdrom0") { if(!match(/noatime/, $4)) $4=$4",noatime" } 1' /etc/fstab > /etc/fstab.tmp
mv /etc/fstab.tmp /etc/fstab
# Installation et configuration du logiciel des gestion automatique des mises à jour
# Commande pour tester le bon fonctionnement : unattended-upgrades --dry-run --debug
nala install -y unattended-upgrades
cp 50unattended-upgrades /etc/apt/apt.conf.d/50unattended-upgrades
cp /usr/share/unattended-upgrades/20auto-upgrades /etc/apt/apt.conf.d/
sed -i 's/InhibitDelayMaxSec=30/InhibitDelayMaxSec=1800/g' /usr/lib/systemd/logind.conf.d/unattended-upgrades-logind-maxdelay.conf
# Installation des composants du serveur graphique Xorg
apt install -y xorg xbacklight xbindkeys xinput xserver-xorg-input-synaptics
# Installation de l'environnement de bureau MATE en mode core
apt install -y mate-desktop-environment-core
# Installation du gestionnaire d'affichage
apt install -y lightdm lightdm-gtk-greeter-settings
# Isntallations des outils de gestion de l'alimentation.
apt install -y acpi acpid
# Installation des outils de gestion du son
apt install -y pulseaudio alsa-utils mate-media
# Installation des outils de gestion des cartes réseaux
apt install -y network-manager-gnome network-manager-openvpn
# Installation des outils de gestion d'impression, de numérisation et du bluetooth
apt install -y blueman cups printer-driver-all simple-scan system-config-printer
# Activation des services fraichement installés
systemctl enable acpid
systemctl enable cups
systemctl enable bluetooth
systemctl enable lightdm
# Install nala
apt install nala -y
nala fetch --auto -y
# Installation des paquets complémentaires pour MATE
nala install -y \
atril \
caja-admin \
caja-mediainfo \
caja-nextcloud \
caja-share \
caja-eiciel \
celluloid \
crow-translate \
dconf-editor \
foliate \
engrampa \
eom \
gnome-system-tools \
gparted \
gtkhash \
kazam \
metadata-cleaner \
mate-applet-brisk-menu \
mate-calc \
mate-dock-applet \
mate-power-manager \
mate-screensaver \
mate-system-monitor \
mate-tweak \
mate-utils \
peek \
pluma \
qshutdown \
picom \
redshift-gtk \
seahorse \
shutter \
stacer \
tilix \
ttf-mscorefonts-installer \
variety \
vorta \
synaptic \
xscreensaver-gl
# Installation des paquets utilitaires
nala install -y curl flatpak freerdp2-x11 figlet htop libnotify-bin nmap net-tools numlockx speedtest-cli stress s-tui swaks testdisk tldr tlp whois wmctrl xdotool
# Installation des logiciels en fonction du profil d'utilisation (décommenter selon le besoin)
# nala install -y blender
nala install -y cheese
# nala install -y geany geany-plugin-addons geany-plugin-git-changebar geany-plugin-overview geany-plugin-spellcheck geany-plugin-treebrowser geany-plugin-vimode
# nala install -y gimp
nala install -y hugin
nala install -y imagination
# nala install -y kdenlive
# nala install -y obs-studio
# nala install -y steam
# Désinstallation des paquets non désirés
nala remove -y fortunes-min
# Approbation du dépot pour QOwnNotes
SIGNED_BY='/etc/apt/keyrings/qownnotes.gpg'
mkdir -p "$(dirname "${SIGNED_BY}")"
curl --silent --show-error --location http://download.opensuse.org/repositories/home:/pbek:/QOwnNotes/Debian_12/Release.key | gpg --dearmor | tee "${SIGNED_BY}" > /dev/null
chmod u=rw,go=r "${SIGNED_BY}"
# Ajout du dépot et installation de QOwnNotes à partir de celui-ci
SIGNED_BY='/etc/apt/keyrings/qownnotes.gpg'
ARCHITECTURE="$(dpkg --print-architecture)"
echo "deb [arch=${ARCHITECTURE} signed-by=${SIGNED_BY}] http://download.opensuse.org/repositories/home:/pbek:/QOwnNotes/Debian_12/ /" | tee /etc/apt/sources.list.d/qownnotes.list > /dev/null
nala update
nala install -y qownnotes
# Logiciel hors dépôts : Applications Web
wget --recursive --no-parent --no-host-directories --no-directories --accept '*webapp-manager*deb' 'http://packages.linuxmint.com/pool/main/w/webapp-manager/' -P /tmp/wibian/
release=$(ls /tmp/wibian/webapp-manager_1.* | tail -1)
nala install -y $release
# Logiciel hors dépôts : PVE VDI Client
nala install -y python3-pip python3-proxmoxer python3-tk virt-viewer
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
# Logiciel hors dépots : Deskreen
package="https://(.*)deskreen_(.*).deb"
wget $(curl -L -s https://api.github.com/repos/pavlobu/deskreen/releases/latest | grep -o -E $package) -P /tmp/wibian/
nala install -y /tmp/wibian/deskreen_*.deb
# Logiciel hors dépots : Youtube music
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/
nala install -y /tmp/wibian/youtube-music_*.deb
# Logiciel hors dépots : DroidCam
nala install -y libavutil-dev libswscale-dev libasound2-dev libspeex-dev libusbmuxd-dev libplist-dev libturbojpeg0-dev linux-headers-`uname -r` gcc
package="https://(.*)droidcam_(.*).zip"
wget $(curl -L -s https://api.github.com/repos/dev47apps/droidcam/releases/latest | grep -o -E $package)
unzip droidcam_*.zip -d droidcam
cd droidcam && ./install-client && ./install-video
cd $builddir
# Installation des thèmes wibian-light et wibian-dark
nala install -y greybird-gtk-theme papirus-icon-theme
mkdir -p /home/$username/.themes
unzip $builddir/themes.zip -d /home/$username/.themes/
chown -R $username:$username /home/$username/.themes/
# Flatpak (reboot nécéssaire)
flatpak remote-add --if-not-exists flathub https://flathub.org/repo/flathub.flatpakrepo
flatpak install -y \
flathub \
com.github.tchx84.Flatseal \
io.github.giantpinkrobots.flatsweep \
io.freetubeapp.FreeTube \
com.github.geigi.cozy \
com.discordapp.Discord \
com.jgraph.drawio.desktop \
me.hyliu.fluentreader \
io.github.hmlendea.geforcenow-electron \
org.onlyoffice.desktopeditors \
org.jdownloader.JDownloader \
io.gitlab.librewolf-community \
com.github.PintaProject.Pinta \
com.stremio.Stremio \
de.haeckerfelix.Shortwave \
com.github.marinm.songrec \
io.github.hakandundar34coding.mini-system-monitor \
com.github.rajsolai.textsnatcher \
app.drey.Warp
# Copie des lanceurs d'applications personnalisés dans le tableau de bord de Mate
mkdir -p /home/$username/.config/mate/panel2.d/default/launchers
cp $builddir/launchers/* /home/$username/.config/mate/panel2.d/default/launchers/
chown -R $username:$username /home/$username/.config/mate/
# 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
# Restauration des paramètres de Variety
mkdir -p /home/$username/.config/variety
cp $builddir/variety/* /home/$username/.config/variety/
chown -R $username:$username /home/$username/.config/variety/
# Restauration des pramètres de Shutter
mkdir -p /home/$username/.shutter/profiles
cp $builddir/shutter/* /home/$username/.shutter/profiles/
chown -R $username:$username /home/$username/.shutter/
# Copie des applications au démarrage de la session utilisateur à l'origine de l'installation
mkdir -p /home/$username/.config/autostart
cp $builddir/autostart/* /home/$username/.config/autostart/
cp $builddir/runonce/* /home/$username/.config/autostart/
chown -R $username:$username /home/$username/.config/autostart/
# Mise à jour du répertoire /home pour les nouveaux utilisateurs via /etc/skel (Skeleton)
unzip $builddir/themes.zip -d /etc/skel/.themes/
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/dconf
cp $builddir/dconf/user.txt /etc/skel/.config/dconf/user.txt
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/.config/autostart
cp $builddir/autostart/* /etc/skel/.config/autostart/
# Suppression des sources d'installation du script
rm -r $builddir
rm -r /tmp/wibian/
# Nettoyage des paquets inutiles du système
nala autoremove
# 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