borg-zenity/install.sh
2022-10-29 13:33:32 +02:00

74 lines
2.2 KiB
Bash

#! /bin/bash
. testdistro.sh
# Borg zenity install and update
if [[ "$OS" =~ "Fedora" ]];then
echo "Fedora detecté"
sudo dnf install borgbackup zenity
elif [[ "$OS" =~ "Debian" ]];then
echo "Debian detecté"
su -c "apt-get -y install borgbackup zenity"
elif [[ "$OS" =~ "Ubuntu" ]];then
echo "Ubuntu detecté"
sudo apt-get install -y borgbackup zenity
elif [[ "$OS" =~ "Linux Mint" ]];then
echo "Linux Mint detecté"
sudo apt-get install -y borgbackup zenity
elif [[ "$OS" =~ "Manjaro" ]];then
echo "Manjaro detecté"
sudo pacman -Sy borgbackup zenity
fi
if [[ "$OS" =~ "Debian" ]];then
su -c "mkdir -vp /opt/borg-zenity"
su -c "cp -fv icons/borg.svg /usr/share/icons/"
su -c "cp -fv icons/borgzenity-profils.svg /usr/share/icons/"
su -c "cp -fv icons/borgzenity-sauvegarde.svg /usr/share/icons/"
su -c "cp -fv borg-zenity-sauvegarde.desktop /usr/share/applications/"
su -c "cp -fv borg-zenity-gestprofils.desktop /usr/share/applications/"
su -c "cp -fv borg-gui.sh /opt/borg-zenity/"
su -c "cp -fv profile-manager.sh /opt/borg-zenity/"
su -c "cp -fv uninstall.sh /opt/borg-zenity/"
else
# Copie des fichiers
sudo mkdir -vp /opt/borg-zenity
sudo cp -fv icons/borg.svg /usr/share/icons/
sudo cp -fv icons/borgzenity-profils.svg /usr/share/icons/
sudo cp -fv icons/borgzenity-sauvegarde.svg /usr/share/icons/
sudo cp -fv borg-zenity-sauvegarde.desktop /usr/share/applications/
sudo cp -fv borg-zenity-gestprofils.desktop /usr/share/applications/
sudo cp -fv borg-gui.sh /opt/borg-zenity/
sudo cp -fv profile-manager.sh /opt/borg-zenity/
sudo cp -fv uninstall.sh /opt/borg-zenity/
fi
# réglages des droits
if [[ "$OS" =~ "Debian" ]];then
su -c "chmod a+rx /opt/borg-zenity/borg-gui.sh"
su -c "chmod a+rx /opt/borg-zenity/profile-manager.sh"
else
sudo chmod a+rx /opt/borg-zenity/borg-gui.sh
sudo chmod a+rx /opt/borg-zenity/profile-manager.sh
fi
# Création du fichier de configuration de base
mkdir -vp $HOME/.config/borg/
if [ ! -f $HOME/.config/borg/borg-zenity.conf ];then
cp -fv borg-zenity.conf $HOME/.config/borg/
fi
# nettoyage
if [ -f readme.md ];then cd ..;fi
if [ -f borg-zenity.zip ];then rm -v borg-zenity.zip;fi
if [ -d borg-zenity ];then rm -rv borg-zenity;fi
echo "--------------------"
echo "Installation terminée."