Install-Repo-As-Usr/Inject-USR-Repo.bash

45 lines
No EOL
1.2 KiB
Bash

#!/usr/bin/env bash
# ===========================
Repo=$1
Reponame="USR-$Repo"
Repolink="https://git.tyleo.dev/TyleoDvDelaware3217/USR-$Repo"
# ===========================
# Dossier à vérifier
USRDIR="/usr/local/bin"
# Vérifie si le dossier contient des fichiers
if [ "$(ls -A "$DOSSIER")" ]; then
echo "/usr/local/bin is populated ! Cancelled."
exit 1
else
echo "/usr/local/bin is empty."
fi
# ========= DEPLOY =========
## INSTALL GIT
echo "Détection du système..."
if command -v rpm-ostree &> /dev/null; then
echo "Système basé sur RPM-OSTree détecté"
rpm-ostree install git
echo "Redémarrage nécessaire pour finaliser l'installation sur RPM-OSTree"
elif [ -f /etc/debian_version ]; then
echo "Debian/Ubuntu détecté"
sudo apt update
sudo apt install -y git
elif [ -f /etc/fedora-release ]; then
echo "Fedora détecté"
sudo dnf install -y git
elif [ -f /etc/arch-release ]; then
echo "Arch Linux détecté"
sudo pacman -Sy --noconfirm git
else
echo "Distribution non prise en charge"
exit 1
fi
## INJECT REPO
git clone $Repolink /usr/local/bin
chmod -v +x /usr/local/bin/*
ls /usr/local/bin
# ==========================