🛰️ Adding version check and marks

master
Rémi LAVERGNE 3 months ago
parent 6ecee465ca
commit a8069f4f47
Signed by: remi.lavergne
GPG Key ID: 7781E77D13479085

@ -2,8 +2,39 @@
# Script d'évaluateur de la SAE 1.03
# Auteur: Rémi LAVERGNE
VERSION="v1.0.0"
SCRIPT_URL="https://codefirst.iut.uca.fr/git/remi.lavergne/sae103-evaluateur/raw/branch/master/scripts/evaluateur.sh"
# Vérification de version
check_version() {
echo "Vérification de la version du script..."
remote_version=$(curl -s "$SCRIPT_URL" | grep -E '^VERSION=' | cut -d'"' -f2)
if [ "$remote_version" != "$VERSION" ]; then
echo -e "\\e[33mUne nouvelle version du script est disponible : $remote_version\\e[0m"
read -p "Voulez-vous mettre à jour ? (o/n) : " response
if [[ "$response" =~ ^[Oo]$ ]]; then
update_script
fi
else
echo -e "\\e[32mVous utilisez la dernière version du script : $VERSION\\e[0m"
fi
}
# Mise à jour automatique du script
update_script() {
echo "Téléchargement de la dernière version depuis CodeFirst..."
curl -o "$0" "$SCRIPT_URL" && chmod +x "$0"
echo -e "\\e[32mMise à jour réussie. Relancez le script pour appliquer les modifications.\\e[0m"
exit 0
}
total_points=0
total_tests=0
print_status() {
total_tests=$((total_tests + 1))
if [ "$1" -eq 0 ]; then
total_points=$((total_points + 1))
echo -e "\\e[32mOK\\e[0m - $2"
else
echo -e "\\e[31mKO\\e[0m - $2"
@ -77,6 +108,8 @@ grep -q '^john:' /etc/passwd
if [ $? -eq 0 ]; then
echo -e "\\e[31mKO\\e[0m - L'utilisateur 'john' existe encore, il doit être supprimé."
else
total_points=$((total_points + 1))
total_tests=$((total_tests + 1))
echo -e "\\e[32mOK\\e[0m - L'utilisateur 'john' a été supprimé."
fi
@ -139,3 +172,22 @@ print_status $? "Vérifier quel module gère un périphérique."
# Etape 4: Lister les modules chargés
grep -Fq 'lsmod' ~/.bash_history
print_status $? "Lister les modules chargés en mémoire."
# ========================================
# Affichage des résultats finaux
# ========================================
echo -e "\\n========================================"
echo -e "\\e[1mRÉSULTATS FINAUX\\e[0m"
echo -e "========================================"
echo -e "Tests réussis : $total_points / $total_tests"
note=$((total_points * 20 * 100 / total_tests))
integer_part=$((note / 100))
decimal_part=$((note % 100))
formatted_note="${integer_part}.$(printf "%02d" $decimal_part)"
echo -e "\\e[1mNote finale : $formatted_note / 20\\e[0m"

Loading…
Cancel
Save