bien entendu vous pouvez modifier le script à votre convenance.
Copier le script bash ci-dessous dans un fichier et donnez un nom au fichier qui se termine par .sh (exemple paq.sh) :
Code : Tout sélectionner
#!/bin/bash
# tableau associatif :
# [nom du paquet]="description du paquet|fonction réalisée avant l'installation|nom du paquet|fonction réalisée après l'installation|type de paquet : paqtel = paquet téléchargé, paqadp = paquet absent des dépôts"
declare -A PAQ_DEB=(
[audacity]=": logiciel d'édition de sources audionumériques.| |audacity| | |"
[brasero]=": logiciel de gravure CD/DVD.| |brasero| | |"
[cheese]=": application vidéo pour webcam en usb.| |cheese| | |"
[dropbox]=": logiciel de synchronisation de fichier dans un nuage.| |dropbox| | |"
[filezilla]=": client graphique FTP/FTPS/SFTP complet.| |filezilla| | |"
[gparted]=": logiciel de partitionnement basé sur GNU Parted.| |gparted| | |"
[imagemagick]=": permet de convertir et de modifier des images.| |imagemagick| | |"
[microsoft-edge-stable]=": navigateur web de microsoft.|paq_edg|microsoft-edge-stable| |paqadp|"
[numlockx]=": activation du pavé numérique à la connexion.|paq_num|numlockx| | |"
[spotify-client]=": logiciel propriétaire de streaming musical web.|paq_spo|spotify-client| |"
[vlc]=": lecteur multimédia issu du projet VideoLAN.| |vlc| | |"
[winamax]=": Winamax Poker, jeu de poker en ligne.|wgt_win|winamax|paq_win|paqtel|"
[yad]=": programme pour afficher des boîtes de dialogue GTK+.| |yad| | |"
)
# variables :
hau=360
lar=680
num=1
# microsoft-edge-stable :
paq_edg(){
[ ! -f /usr/share/keyrings/microsoft.gpg ] && wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor | dd of=/usr/share/keyrings/microsoft.gpg
[ ! -f /etc/apt/sources.list.d/microsoft-edge.list ] && echo "deb [signed-by=/usr/share/keyrings/microsoft.gpg arch=amd64] https://packages.microsoft.com/repos/edge stable main" > /etc/apt/sources.list.d/microsoft-edge.list
apt-get update -y && apt-get upgrade -y && aptitude show apt-transport-https | grep -q 'État: non installé' && apt-get install -y apt-transport-https
}
# fonction pour activer le pavé numérique au démarrage :
paq_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
}
}
# fonction pour attendre la fin de l'installation d'un paquet :
paq_pos(){
while [ ! -f paq-pos ]; do sleep 0.4; done; rm -f paq-pos
}
# fonction pour installer les paquets sélectionnés :
PAQ_RUN(){
cat paq-ins | cut -d'%' -f4 | sort -o paq-cmp && join -v 1 <(sort paq-yad) <(sort paq-cmp) > paq-run
printf "\r \r"
if [ -s paq-run ]; then
printf "Mise à jour..."
gnome-terminal -- bash -c "apt-get update -y && apt-get upgrade -y && touch paq-pos"; paq_pos
printf "\r \r"
while read lin; do
ins="apt-get install -y"
echo $lin|grep -q 'paqtel' && ins="gdebi -nq"
printf "$((num++)) $(echo $lin | cut -d'|' -f2)..."
[ -n "$(echo $lin | cut -d'|' -f1)" ] && (export -f $(echo $lin | cut -d'|' -f1) && gnome-terminal -- bash -c "$(echo $lin | cut -d'|' -f1) && touch paq-pos"; paq_pos)
gnome-terminal -- bash -c "$ins $(echo $lin | cut -d'|' -f2) && touch paq-pos"; paq_pos
$(echo $lin | cut -d'|' -f3)
printf "\b\b\b ✔ \n"
done < paq-run
printf "Nettoyage..."
gnome-terminal -- bash -c "apt-get clean -y && apt-get autoremove -y && apt-get purge ~c -y && touch paq-pos"; paq_pos
printf "\r \r"
fi
}
# spotify-client :
paq_spo(){
rm -f /etc/apt/sources.list.d/spotify.list
curl -sS https://download.spotify.com/debian/pubkey_7A3A762FAFD4A51F.gpg | gpg --dearmor --yes -o /etc/apt/trusted.gpg.d/spotify.gpg
echo "deb http://repository.spotify.com stable non-free" | tee /etc/apt/sources.list.d/spotify.list
apt-get update -y && apt-get upgrade -y
}
# fonction de sélection de tous les paquets :
PAQ_TOU(){
sed -i "s/FALSE/TRUE/g" paq-slt
yad --list --checklist --title="- $(lsb_release -ds) -" --skip-taskbar --separator=" " \
--buttons-layout=edge --button=gtk-ok:0 --button=gtk-quit:1 --centre --no-headers --on-top \
--text="Tous les paquets sont sélectionnés." --width=$lar --height=$hau --text-align=left \
--column= --column= --column= --column= < paq-slt > paq-yad --print-column=4 --hide-column=4
}
# winamax poker :
paq_win(){
cat <<- EOF > /usr/share/applications/winamax.desktop
[Desktop Entry]
Name=Winamax
Exec=/opt/Winamax/winamax %U
Comment=Winamax Poker
Terminal=false
Icon=/usr/share/app-install/icons/winamax.jpg
Type=Application
StartupWMClass=Winamax
Categories=Utility;
EOF
}
wgt_win(){
wget -c -q -t 0 --show-progress https://www.dropbox.com/s/m3qt8y2z888p6pc/winamax
wget -c -q -t 0 --show-progress --limit-rate=10k https://www.dropbox.com/s/c25sa4gexvl2g9e/winamax.jpg
[ -f /usr/share/app-install/icons/winamax.jpg ] || mv winamax.jpg /usr/share/app-install/icons/winamax.jpg
apt-get update -y && apt-get upgrade -y
}
# début du script :
printf "Préparation..."
[ -d "Paqdeb" ] && rm -rf Paqdeb
su $(logname) -c "mkdir Paqdeb" && cd Paqdeb
aptitude show yad | grep -q 'État: non installé' && (gnome-terminal -- bash -c "apt-get install -y yad && touch paq-pos"; paq_pos)
for DEB in ${!PAQ_DEB[@]}; do
if echo ${PAQ_DEB[$DEB]} | egrep -q 'paqtel|paqadp'; then
if dpkg -V ${DEB} > /dev/null 2>&1; then
cat <<- EOF >> paq-ins
TRUE%${DEB}%$(echo ${PAQ_DEB[$DEB]} | cut -d'|' -f1)%$(echo ${PAQ_DEB[$DEB]} | cut -d'|' -f2-5)
EOF
else
cat <<- EOF >> paq-dis
FALSE%${DEB}%$(echo ${PAQ_DEB[$DEB]} | cut -d'|' -f1)%$(echo ${PAQ_DEB[$DEB]} | cut -d'|' -f2-5)
EOF
fi
else
if aptitude show $(echo ${PAQ_DEB[$DEB]} | cut -d'|' -f3)|grep -q 'État: non installé'; then
cat <<- EOF >> paq-dis
FALSE%${DEB}%$(echo ${PAQ_DEB[$DEB]} | cut -d'|' -f1)%$(echo ${PAQ_DEB[$DEB]} | cut -d'|' -f2-4)
EOF
else
cat <<- EOF >> paq-ins
TRUE%${DEB}%$(echo ${PAQ_DEB[$DEB]} | cut -d'|' -f1)%$(echo ${PAQ_DEB[$DEB]} | cut -d'|' -f2-4)
EOF
fi
fi
done
printf "\r \r"
if [ -s paq-dis ]; then
printf "Sélection..."
sort paq-ins paq-dis -o paq-chk -k2 -t % && cat paq-chk | tr % '\n' > paq-slt
yad --list --checklist --title="- $(lsb_release -ds) -" --no-headers --on-top --skip-taskbar \
--buttons-layout=edge --button=gtk-ok:0 --button="Tous sélectionner"!gtk-ok:1 --centre --button=gtk-quit:2 \
--text="Sélectionner le ou les paquets à installer :" --width=$lar --height=$hau --text-align=left --separator=" " \
--column= --column= --column= --column= < paq-slt > paq-yad --print-column=4 --hide-column=4
case $? in
0) PAQ_RUN;;
1) PAQ_TOU && PAQ_RUN;;
esac
printf "\r \r"
fi
cd .. && rm -rf Paqdeb
exit 0
Code : Tout sélectionner
sudo bash paq.sh