Actualiser Inject-USR-Repo.bash

This commit is contained in:
Tyleo Dv. Delaware 2025-06-25 14:26:01 +02:00
parent b0a0e8948b
commit cd6cb9296a

View file

@ -1,6 +1,45 @@
#!/usr/bin/env bash
# ===========================
Repo=$1
Reponame="USR-$Repo"
Repolink="https://git.tyleo.dev/TyleoDvDelaware3217/USR-$Repo"
# ===========================
# Dossier à vérifier
USRDIR="/usr/local/bin"
echo $Reponame
# 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
# ==========================