Voici un script automatique pour se simplifier la vie et éviter de fastidieuses installation ou désinstallation :
Code : Tout sélectionner
#!/bin/bash
declare -A hb_deb=(
[audacity]=": logiciel d'édition de sources audionumériques.|"
[brasero]=": logiciel de gravure CD/DVD.|"
[brscan4]=": installation du scanner Brother DCPJ-572DW.||brscan4-0.4.9-1.amd64.deb|download.brother.com/welcome/dlf006645/brscan4-0.4.9-1.amd64.deb|hb_brs|hb-wdb"
[brscan-skey]=": bouton envoyer vers du scanner Brother DCPJ-572DW.||brscan-skey-0.3.1-1.amd64.deb|download.brother.com/welcome/dlf006652/brscan-skey-0.3.1-1.amd64.deb||hb-wdb"
[cheese]=": application vidéo pour webcam en usb.|"
[dcpj572dwpdrv]=": insrallation de l'imprimante Brother DCPJ-572DW.|hb_ia3|dcpj572dwpdrv-1.0.5-0.i386.deb|download.brother.com/welcome/dlf103777/dcpj572dwpdrv-1.0.5-0.i386.deb|hb_dcp|hb-wdb"
[droidcam]=": utilitaire pour transformer son smartphone en webcam.||/usr/share/droidcam/droidcam|files.dev47apps.net/linux/droidcam_latest.zip|hb_dro|hb-wtz"
[dropbox]=": logiciel de synchronisation de fichier dans un nuage.|"
[gparted]=": logiciel de partitionnement basé sur GNU Parted.|"
[imagemagick]=": permet de convertir et de modifier des images.|"
[microsoft-edge-dev]=": navigateur web de Microsoft.||microsoft-edge-dev_88.0.680.1-1_amd64.deb|go.microsoft.com/fwlink/?linkid=2124602|hb_win|hb-wdb"
[numlockx]=": activation du pavé numérique à la connexion.||||hb_num"
[skypeforlinux]=": pour passer des appels vidéo.|"
[spotify-client]=": logiciel propriétaire de streaming musical web.|"
[synology-assistant]=": outil de configuration du NAS.||synology-assistant_6.2-24922_amd64.deb|global.download.synology.com/download/Utility/Assistant/6.2-24922/Ubuntu/x86_64/synology-assistant_6.2-24922_amd64.deb||hb-wdb"
)
but="Tout cocher"
nam=$(logname)
nbl=0
sel=FALSE
stt=$(date +%s)
hb_brs(){
touch hb-rbt
brsaneconfig4 -a name=SDCPJ572DW model=DCP_J572DW ip=192.168.1.12
su $nam -c "mkdir -p /home/$nam/.config/autostart"
su $nam -c "cat <<- EOF > /home/$nam/.config/autostart/brscan-skey.desktop
[Desktop Entry]
Type=Application
Exec=brscan-skey
Name=brscan-skey
X-GNOME-Autostart-enabled=true
EOF"
}
hb_chg(){
if [ $sel = FALSE ]; then
sel=TRUE
but="Tout décocher"
else
sel=FALSE
but="Tout cocher"
fi
hb_slt
}
hb_dcp(){
lpadmin -p DCPJ572DW -E -v socket://192.168.1.12 -P /usr/share/cups/model/Brother/brother_dcpj572dw_printer_en.ppd > /dev/null 2>&1
}
hb_dro(){
if aptitude show adb|grep -q 'non installé'; then
printf "adb..."
(apt-get -y install adb 2>/dev/null)|hb_pro
printf '\r \r'
printf "adb ✔\n"|tee -a hb-ins
fi
unzip -q droidcam_latest.zip -d /usr/share/droidcam
cd /usr/share/droidcam
((./install-client && ./install-video && ./install-sound) 2>/dev/null)|hb_pro
cat <<- EOF > /usr/share/applications/droidcam.desktop
[Desktop Entry]
Type=Application
Exec=droidcam
Name=Droidcam
Icon=/opt/droidcam-icon.png
EOF
cd /home/$nam/HB-TMP
}
hb_ia3(){
if aptitude show ia32-libs|grep -q 'non installé'; then
printf "ia32-libs..."
((dpkg --add-architecture i386 && apt-get -y install ia32-libs) 2>/dev/null)|hb_pro
printf '\r \r'
printf "ia32-libs ✔\n"|tee -a hb-ins
fi
}
hb_lif(){
while [ -f hb-lif ]; do
for ((com=45; com>0; com--)); do
printf "." && sleep 0.03
done
printf '\r \r'
if [ ! -f hb-lif ]; then
printf '\r \r' && sleep 2
break
fi
done
}
hb_lsp(){
for ((com=45; com>0; com--)); do
printf "." && sleep 0.03
done
printf '\n'
}
hb_num(){
cat /usr/share/lightdm/lightdm.conf.d/50-guest-wrapper.conf|grep -q 'numlockx on' || {
cat <<- EOF >> /usr/share/lightdm/lightdm.conf.d/50-guest-wrapper.conf
greeter-session=slick-greeter
greeter-setup-script=/usr/bin/numlockx on
EOF
}
}
hb_pro(){
yad --progress --pulsate --title="[ HB ]" --auto-close --on-top --fixe --width=600 --height=50 --no-buttons \
--progress-text="$tex" --image=checkbox --skip-taskbar --no-escape --no-headers --text-align=left
}
hb_rap(){
unset zer
sort hb-ins -o hb-ins
su $nam -c "touch hb-rap" && hb_lsp > hb-rap
printf "Rapport du $(date|cut -d'C' -f1|sed '$ s/.$//') :\n" >> hb-rap
hb_lsp >> hb-rap
[ $(cat hb-ins|wc -l) -le 9 ] && zer=%01d
while read lin; do
unset zer && [ $(($nbl+1)) -le 9 ] && zer=%01d
printf "$zer$(($nbl+1)) $lin\n" >> hb-rap
((nbl++))
done < hb-ins
unset nbl
end=$(date +%s)
hb_lsp >> hb-rap
echo $((end-stt))|awk '{printf "Durée totale : %01dh:%02dmn:%02ds.\n", $1/3600, ($1/60)%60, $1%60}'|tee -a hb-rap
hb_lsp|tee -a hb-rap && su $nam -c "mv hb-rap /home/$nam/rapport-$(date +%d-%m-%Y-%H-%M-%S)"
}
hb_run(){
if [ -s hb-slt ]; then
timedatectl set-local-rtc 1
aptitude -q=2 -y purge ~c > /dev/null 2>&1
while read lin; do
if echo $lin|grep -q 'hb-wdb'; then
dpkg -l|grep -q $(echo $lin|cut -d'|' -f1) || su $nam -c "touch hb-scn"
elif echo $lin|grep -q 'hb-wtz'; then
[ ! -f $(echo $lin|cut -d'|' -f3) ] && su $nam -c "touch hb-scn"
else
aptitude show $(echo $lin|cut -d'|' -f1)|grep -q 'non installé' && su $nam -c "touch hb-scn"
fi
done < hb-slt
if [ -f hb-scn ]; then
rm -f hb-lif && sleep 2 && hb_lsp
printf ' H B ' && sleep 1
printf '\r \r'
printf " ######### [ H B ] ######### " && sleep 1
printf '\r \r'
printf "################## [ H B ] ##################\n" && hb_lsp
printf "Mise à jour..."
tex="Mise à jour..."
(apt-get -y update && apt-get -y upgrade)2>/dev/null|hb_pro
printf '\r \r'
printf "Mise à jour ✔\n" && hb_lsp
su $nam -c "touch hb-lif" && hb_lif &
[ -f /home/$nam/.cinnamon/configs/radio@driglu4it/radio@driglu4it.json ] && {
cat /home/$nam/.cinnamon/configs/radio@driglu4it/radio@driglu4it.json|grep -q 'France Info' || {
su $nam -c "sed -i 's/Chillout/France Info/' /home/$nam/.cinnamon/configs/radio@driglu4it/radio@driglu4it.json"
su $nam -c "sed -i 's/http:\/\/ic7.101.ru:8000\/c15_3/http:\/\/direct.franceinfo.fr\/live\/franceinfo-midfi.mp3/' /home/$nam/.cinnamon/configs/radio@driglu4it/radio@driglu4it.json"
}
}
su $nam -c "touch hb-ins"
while read lin; do
if echo $lin|grep -q 'hb-wdb'; then
dpkg -l|grep -q $(echo $lin|cut -d'|' -f1) || {
rm -f hb-lif && sleep 2
wget -c -q -t 0 --show-progress https://$(echo $lin|cut -d'|' -f4) -O $(echo $lin|cut -d'|' -f3)
tex="$(echo $lin|cut -d'|' -f1)..."
$(echo $lin|cut -d'|' -f2)
gdebi -n $(echo $lin|cut -d'|' -f3) 2>/dev/null|hb_pro
$(echo $lin|cut -d'|' -f5)
printf "$(echo $lin|cut -d'|' -f1) ✔\n"|tee -a hb-ins && hb_lsp
}
elif echo $lin|grep -q 'hb-wtz'; then
[ ! -f $(echo $lin|cut -d'|' -f3) ] && {
rm -f hb-lif && sleep 2
wget -c -q -t 0 --show-progress https://$(echo $lin|cut -d'|' -f4)
tex="$(echo $lin|cut -d'|' -f1)..."
$(echo $lin|cut -d'|' -f2)
$(echo $lin|cut -d'|' -f5)
printf "$(echo $lin|cut -d'|' -f1) ✔\n"|tee -a hb-ins && hb_lsp
}
else
aptitude show $(echo $lin|cut -d'|' -f1)|grep -q 'non installé' && {
rm -f hb-lif && sleep 2
printf "$(echo $lin|cut -d'|' -f1)..."
tex="$(echo $lin|cut -d'|' -f1)..."
$(echo $lin|cut -d'|' -f2)
apt-get -y install $(echo $lin|cut -d'|' -f1) 2>/dev/null|hb_pro
$(echo $lin|cut -d'|' -f5)
printf '\r \r'
printf "$(echo $lin|cut -d'|' -f1) ✔\n"|tee -a hb-ins && hb_lsp
}
fi
done < hb-slt
rm -f hb-lif && sleep 2
printf "Nettoyage..."
tex="Nettoyage..."
(rm -f /var/cache/apt/archives/lock /var/cache/debconf/*.dat /var/lib/apt/lists/lock /var/lib/dpkg/lock
apt-get -y clean && apt-get -y autoremove && aptitude -q=2 -y purge ~c)|hb_pro
printf '\r \r'
printf "Nettoyage ✔\n" && hb_lsp
else
rm -f hb-lif && sleep 2 && su $nam -c "notify-send -i gtk-quit 'Aucune installation !'"
fi
else
rm -f hb-lif && sleep 2 && su $nam -c "notify-send -i gtk-quit 'Aucune sélection !'"
fi
}
hb_slt(){
rm -f hb-chk* hb-slt
for deb in ${!hb_deb[@]}; do
cat <<- EOF >> hb-chk
${deb}%$(echo ${hb_deb[$deb]}|cut -d'|' -f1)%${deb}|$(echo ${hb_deb[$deb]}|cut -d'|' -f2-6)
EOF
done
sort hb-chk -o hb-chk && sed -i "s/^/$sel%/g" hb-chk && cat hb-chk|tr '%' '\n' > hb-chk-lst
yad --list --checklist --title="[ HB ]" --image=checkbox --no-headers \
--buttons-layout=edge --button="$but"!gtk-refresh:2 --button=gtk-ok:0 --button=gtk-quit:1 --centre \
--text="Sélection auto de toute la liste dans 60 s !" --fixe --on-top \
--width=600 --height=420 --timeout-indicator=bottom --timeout=60 --text-align=left --skip-taskbar --separator=" " \
--column= --column= --column= --column= < hb-chk-lst > hb-slt --print-column=4 --hide-column=4
case $? in
0) hb_run;;
1|252) rm -f hb-lif && sleep 2 && su $nam -c "notify-send -i gtk-quit 'Annulation !'";;
2) hb_chg;;
70) awk -F% '{print $4}' hb-chk > hb-slt && hb_run;;
esac
}
hb_win(){
if [ ! -f /usr/share/applications/winamax.desktop ]; then
wget -c -q -t 0 --show-progress https://www.dropbox.com/s/zpyzf7s190qvq2t/winamax.jpg.zip
unzip -q winamax.jpg.zip -d /usr/share/app-install/icons
cat <<- EOF > /usr/share/applications/winamax.desktop
[Desktop Entry]
Name=Winamax
Exec=microsoft-edge-dev https://www.winamax.fr/poker/launch_poker.php
Comment=Winamax Poker
Terminal=false
Icon=/usr/share/app-install/icons/winamax.jpg
Type=Application
EOF
su $nam -c "notify-send -i gtk-ok 'Winamax Poker ajouté !'"
fi
}
rm -rf HB-TMP && su $nam -c "mkdir HB-TMP" && cd HB-TMP
aptitude show yad|grep -q 'non installé' && apt-get -y install notify-osd yad > /dev/null 2>&1
touch hb-lif && hb_lif &
hb_slt
if [ -s hb-ins ]; then
yad --question --image=checkbox --title="[ HB ]" --button=gtk-yes:0 --button=gtk-no:1 \
--timeout-indicator=bottom --timeout=10 --text="Voulez-vous éditer un rapport (oui auto dans 10 s) ?" \
--on-top --fixe --centre --buttons-layout=edge --skip-taskbar --no-escape --width=600 --height=100 --no-headers
case $? in
0|70) hb_rap;;
1|252) su $nam -c "notify-send -i gtk-quit 'Edition du rapport annulé !'";;
esac
fi
if [ -f hb-rbt ];then
yad --question --image=checkbox --title="[ HB ]" --button=gtk-yes:0 --button=gtk-no:1 --buttons-layout=edge --skip-taskbar \
--text="Voulez-vous redémarrer le PC ?" --on-top --fixe --centre --no-escape --width=600 --height=100 --no-headers
case $? in
0|70) cd .. && rm -rf HB-TMP && reboot;;
1|252) cd .. && rm -rf HB-TMP;;
esac
else
cd .. && rm -rf HB-TMP
fi
exit 0
# Henri B.
Code : Tout sélectionner
sudo bash <<le nom du script que vous avez donné>>