#! /bin/bash
# Script post install et de maintenance pour Debian 11 bullseye 12 bookworm
# Laurent.B MAJ 12/04/2023
# MAJ auto du script
#
nomdecode=$(lsb_release -cs 2>/dev/null)
echo "$nomdecode détectée" 

repcourant=$(pwd)
if [ ! -e /opt/p ];then mkdir /opt/p;fi
cd /opt/p
chmod +x /opt/p/p
if ( wget -N http://l.iut-nimes.fr/maintenance/p-$nomdecode -O p 2>&1|grep "enregistré" );then chmod +x /opt/p/p;echo "Script mis à jour, merci de le relancer /opt/p/p" && exit 0;fi
if [ -e $repcourant/p ];then rm $repcourant/p;fi
if [ -e $repcourant/t ];then rm $repcourant/t;fi
if [ -e $repcourant/f ];then rm $repcourant/f;fi
if [ -e $repcourant/tilix-profil-dconf-v1 ];then rm $repcourant/tilix-profil-dconf-v1;fi
if [ -e $repcourant/ms.tar.gz ];then rm $repcourant/ms.tar.gz;fi

cf='\033[0m'
blanc='\033[1m'
vert='\033[1;32m'
rouge='\033[31m'
jaune='\033[1;33m'
bleu='\033[34m'
violet='\033[35m'

debug=1
#debug=0

function pause { if [ $debug == 1 ]; then echo "Mode DEBUG Activé - Pause" && read;fi }

echo -e "\n $vert-- Script $cf $blanc POST INSTALL $cf et de $bleu maintenance $cf pour $jaune Debian $violet $nomdecode -- $cf \n"

