2019-03-22 18:19:38 +01:00
|
|
|
#!/usr/bin/bash
|
2019-03-21 11:35:15 +01:00
|
|
|
######### Script d'etablissement de la fiche technique d'un PC #########
|
2019-03-21 19:58:35 +01:00
|
|
|
|
2019-03-26 21:35:16 +01:00
|
|
|
FILE="$DESKTOP/identification.txt"
|
2019-03-21 19:58:35 +01:00
|
|
|
|
2019-03-21 11:35:15 +01:00
|
|
|
usage()
|
|
|
|
{ echo ' Usage:'
|
2019-03-21 19:58:35 +01:00
|
|
|
echo ' -Argument 1: Entrer: p pour portable ou d pour desktop'
|
2019-03-21 11:35:15 +01:00
|
|
|
echo ' -Argument 2: Entrer: le numéro de série du PC'
|
|
|
|
echo ''
|
|
|
|
}
|
|
|
|
|
|
|
|
# test du nombre d'arguments < 2
|
2019-03-21 19:58:35 +01:00
|
|
|
#if [ "${#}" -lt 2 ]
|
2019-03-22 11:45:34 +01:00
|
|
|
#then usage
|
2019-03-21 19:58:35 +01:00
|
|
|
# exit 3
|
|
|
|
#fi
|
|
|
|
# test du type de PC (Portable ou Desktop)
|
2019-03-21 11:35:15 +01:00
|
|
|
if [ "${1}" = "p" ]
|
|
|
|
then echo '#*******************************************************#'
|
|
|
|
echo "# Portable numéro de série: ${2} "
|
|
|
|
echo '#*******************************************************#'
|
|
|
|
elif [ "${1}" = "d" ]
|
|
|
|
then echo '#*******************************************************#'
|
2019-03-21 19:58:35 +01:00
|
|
|
echo "# Desktop numéro de série: ${2} "
|
2019-03-21 11:35:15 +01:00
|
|
|
echo '#*******************************************************#'
|
|
|
|
fi
|
|
|
|
|
|
|
|
#*********** Identification PC *************
|
2019-03-21 19:58:35 +01:00
|
|
|
echo '' > $FILE
|
|
|
|
echo '/************** Identification PC **************/' >> $FILE
|
|
|
|
/usr/sbin/lshw -class system | sed -n '/description/p;/produit/p;/fabriquant/p;/numéro/p' >> $FILE
|
2019-03-21 11:35:15 +01:00
|
|
|
|
|
|
|
#*********** Identification BIOS *************
|
2019-03-21 19:58:35 +01:00
|
|
|
echo '' >> $FILE
|
|
|
|
echo ' /********** Identification BIOS **********' >> $FILE
|
|
|
|
/usr/sbin/dmidecode -t bios | sed -n '/Vendor/p;/Version/p;/Release/p;/Revision/p' >> $FILE
|
2019-03-21 11:35:15 +01:00
|
|
|
|
|
|
|
#*********** Identification CARTE MERE *************
|
2019-03-21 19:58:35 +01:00
|
|
|
echo '' >> $FILE
|
|
|
|
echo ' /********** Identification CARTE MERE **********' >> $FILE
|
2019-03-22 11:45:34 +01:00
|
|
|
/usr/sbin/lshw | grep -A 5 "description: Carte mère" >> $FILE
|
2019-03-21 11:35:15 +01:00
|
|
|
|
|
|
|
#*********** Identification CARTE GRAPHIQUE *************
|
2019-03-21 19:58:35 +01:00
|
|
|
echo '' >> $FILE
|
|
|
|
echo ' /********** Identification CARTE GRAPHIQUE **********' >> $FILE
|
|
|
|
/usr/sbin/lshw -class display | sed -n '/description/p;/produit/p;/fabriquant/p;/version/p' >> $FILE
|
2019-03-21 11:35:15 +01:00
|
|
|
|
|
|
|
#*********** Identification processeur *************
|
2019-03-21 19:58:35 +01:00
|
|
|
echo '' >> $FILE
|
|
|
|
echo ' /********** Identification processeur **********' >> $FILE
|
|
|
|
/usr/sbin/lshw -class processor | sed -n '/description/p;/produit/p;/fabriquant/p;/bits/p;/configuration/p' >> $FILE
|
2019-03-21 11:35:15 +01:00
|
|
|
|
|
|
|
#*********** Identification RAM *************
|
2019-03-21 19:58:35 +01:00
|
|
|
echo '' >> $FILE
|
|
|
|
echo ' /********** Identification RAM **********' >> $FILE
|
|
|
|
/usr/sbin/dmidecode -t memory | head -n 24 | sed -n '/Maximum/p' >> $FILE
|
|
|
|
echo '' >> $FILE
|
|
|
|
/usr/sbin/dmidecode -t memory | head -n 24 | sed -n '/Bank/p' >> $FILE
|
|
|
|
/usr/sbin/dmidecode -t memory | head -n 30 | sed -n '/Manufacturer/p;/Type/p;/Size/p;/Speed/p;/Serial/p' >> $FILE
|
|
|
|
echo '' >> $FILE
|
|
|
|
/usr/sbin/dmidecode -t memory | tail -n 11 | sed -n '/Bank/p' >> $FILE
|
|
|
|
/usr/sbin/dmidecode -t memory | tail -n 19 | sed -n '/Manufacturer/p;/Type/p;/Size/p;/Speed/p;/Serial/p' >> $FILE
|
2019-03-21 11:35:15 +01:00
|
|
|
|
|
|
|
#*********** Identification HDD *************
|
2019-03-21 19:58:35 +01:00
|
|
|
#echo '' >> $FILE
|
|
|
|
#echo ' /********** Identification HDD **********' >> $FILE
|
|
|
|
#/usr/sbin/lshw -class disk | head -n 13 | sed -n '/description/p;/produit/p;/fabriquant/p;/série/p;/taille/p' >> $FILE
|
2019-03-21 11:35:15 +01:00
|
|
|
|
|
|
|
#*********** Identification DVD *************
|
2019-03-21 19:58:35 +01:00
|
|
|
echo '' >> $FILE
|
|
|
|
echo ' /********** Identification DVD **********' >> $FILE
|
|
|
|
/usr/sbin/lshw -class disk | tail -n 14 | sed -n '/description/p;/produit/p;/fabriquant/p;/version:/p;/fonctionnalités:/p' >> $FILE
|
2019-03-21 11:35:15 +01:00
|
|
|
|
|
|
|
#*********** Identification réseau filaire *************
|
2019-03-21 19:58:35 +01:00
|
|
|
echo '' >> $FILE
|
|
|
|
echo ' /********** Identification réseau filaire **********' >> $FILE
|
|
|
|
/usr/sbin/lshw -class network | head -n 13 | sed -n '/description/p;/produit/p;/fabriquant/p;/numéro/p;/capacité/p' >> $FILE
|
2019-03-21 11:35:15 +01:00
|
|
|
|
|
|
|
#*********** Identification autre réseau *************
|
2019-03-21 19:58:35 +01:00
|
|
|
echo '' >> $FILE
|
|
|
|
echo ' /********** Identification autre réseau **********' >> $FILE
|
|
|
|
/usr/sbin/lshw -class network | tail -n 14 | sed -n '/description/p;/produit/p;/fabriquant/p;/numéro/p' >> $FILE
|
2019-03-21 11:35:15 +01:00
|
|
|
|
2019-03-21 19:58:35 +01:00
|
|
|
echo '' >> $FILE
|
|
|
|
echo ' /********** Identification USB et autre**********' >> $FILE
|
|
|
|
lsusb >> $FILE
|
2019-03-21 11:35:15 +01:00
|
|
|
|
2019-03-21 19:58:35 +01:00
|
|
|
#*********** Identification batterie *************
|
|
|
|
echo '' >> $FILE
|
|
|
|
echo ' /********** Identification Batterie **********' >> $FILE
|
|
|
|
/usr/sbin/lshw -class power | sed -n '/produit/p;/fabriquant/p;/capacité/p;/configuration/p' >> $FILE
|
|
|
|
echo '' >> $FILE
|
2019-03-21 11:35:15 +01:00
|
|
|
|
2019-03-21 19:58:35 +01:00
|
|
|
#*********** Test des disques durs *************
|
|
|
|
for DISK in `lsblk -dn -x NAME --output NAME`
|
|
|
|
do
|
|
|
|
echo '' >> $FILE
|
|
|
|
echo " /********** Test du disk #$DISK# **********" >> $FILE
|
|
|
|
/usr/sbin/smartctl -H /dev/$DISK| grep -c "PASSED"
|
2019-03-22 11:45:34 +01:00
|
|
|
|
2019-03-21 19:58:35 +01:00
|
|
|
if [ $? -ne 0 ]; then
|
|
|
|
/usr/sbin/smartctl -a /dev/$DISK >> $FILE
|
|
|
|
echo "############ Problème sur le disque $DISK ########################"
|
|
|
|
echo "############ Problème sur le disque $DISK ########################" >>$FILE
|
2019-03-22 11:45:34 +01:00
|
|
|
|
2019-03-21 19:58:35 +01:00
|
|
|
echo '' >> $FILE
|
|
|
|
else
|
|
|
|
/usr/sbin/smartctl -i /dev/$DISK >> $FILE
|
|
|
|
echo "############ Pas de problèmes détectés sur le disque $DISK ########################"
|
|
|
|
echo "############ Pas de problèmes détectés sur le disque $DISK ########################" >> $FILE
|
|
|
|
fi
|
|
|
|
done
|
2019-03-21 11:35:15 +01:00
|
|
|
|