borg-zenity/testdistro.sh
2021-08-05 18:09:22 +02:00

64 lines
1.6 KiB
Bash
Executable File

#!/bin/bash
if [ -f /etc/os-release ]; then
# freedesktop.org and systemd
. /etc/os-release
OS=$NAME
VER=$VERSION_ID
elif type lsb_release >/dev/null 2>&1; then
# linuxbase.org
OS=$(lsb_release -si)
VER=$(lsb_release -sr)
elif [ -f /etc/lsb-release ]; then
# For some versions of Debian/Ubuntu without lsb_release command
. /etc/lsb-release
OS=$DISTRIB_ID
VER=$DISTRIB_RELEASE
elif [ -f /etc/debian_version ]; then
# Older Debian/Ubuntu/etc.
OS=Debian
VER=$(cat /etc/debian_version)
elif [ -f /etc/SuSe-release ]; then
# Older SuSE/etc.
OS=Suse
elif [ -f /etc/redhat-release ]; then
# Older Red Hat, CentOS, etc.
OS=Redhat
else
echo "La distribution n'a pas été détecté."
echo "Installez les paquets \"borgbackup\" et \"zenity\" manuellement."
exit
fi
echo "OS = $OS"
if [[ "$OS" =~ "Fedora" ]];then #OK
echo "Fedora detecté"
sudo dnf install borgbackup zenity
elif [[ "$OS" =~ Mageia ]];then #OK
# non fonctionnel sur Mageia 8, le paquet borgbackup n'existe pas encore
echo "Mageia detecté"
su -c "dnf install borgbackup zenity"
elif [[ "$OS" =~ Debian ]];then #OK
echo "Debian detecté"
sudo apt-get install borgbackup zenity
elif [[ "$OS" =~ Ubuntu ]];then #??
echo "Ubuntu detecté"
#sudo apt-get install borgbackup zenity
elif [[ "$OS" =~ "Linux Mint" ]];then #OK
echo "Linux Mint detecté"
sudo apt-get install borgbackup zenity
elif [[ "$OS" =~ Manjaro ]];then #OK
echo "Manjaro detecté"
sudo pacman -Sy borgbackup zenity
else
echo "La distribution n'a pas été détecté."
echo "Installez les paquets \"borgbackup\" et \"zenity\" manuellement."
exit
fi