Forum |  HardWare.fr | News | Articles | PC | Prix | S'identifier | S'inscrire | Aide | Shop Recherche
2084 connectés 

  FORUM HardWare.fr
  Linux et OS Alternatifs
  Codes et scripts

   Script installation auto pour Linux Mint 19.1 Cinnamon 64 bit.

 



 Mot :   Pseudo :  
 
Bas de page
Auteur Sujet :

Script installation auto pour Linux Mint 19.1 Cinnamon 64 bit.

n°1417748
henri bel
Posté le 24-04-2018 à 00:53:32  profilanswer
 

Salut à tous.
Voici un script pour automatiser les taches d'installation ou de réinstallation d'applications, testé sur Linux Mint 19.1 Cinnamon 64 bit.
Copier le script ci-dessous et donnez lui un nom, ensuite le script se lance dans un terminal avec la commande : sudo bash <<nom du script>>.
 


#!/bin/bash  
 
# linux mint 19.1 cinnamon 64 bits.  
 
declare -A add=( ['lightning/addon-2313-latest.xpi']="{e2fda1a4-762b-4020-b5ad-a41df1933103}_1000k@,2" ['provider-for-google-calendar/addon-4631-latest.xpi']="{a62ef8ec-5fdc-40c2-873c-223b8a6925cc}_50k@,3" )
 
declare -A bed=( ['audacity']="@01" ['brasero']="@02" ['dcp750cw']="dcp750cw&@03" ['dropbox']="dropbox&@04" ['freefilesync']="freefilesync&@05" ['gparted']="@06" ['indicator-cpufreq']="@07" ['kaffeine']="@08" ['numlockx']="@09" ['radiotray']="radiotray&@10" ['spotify-client']="@11" ['thunderbird']="thunderbird&@12" )
 
declare -A com=( ['audacity']="a multi-track audio editor" ['brasero']="a simple application to burn, copy and erase cd and dvd" ['dcp750cw']="multifunction inkjet printers" ['dropbox']="a free service that lets you bring your photos, docs, and videos" ['freefilesync']="free software used for file synchronization" ['gparted']="uses libparted to detect and manipulate devices and partition tables" ['indicator-cpufreq']="applet for displaying and changing cpu frequency" ['kaffeine']="a media player based on vlc" ['numlockx']="utilities to enable the keyboard's numeric lock" ['radiotray']="this is a simple music streaming player that lives on the system tray" ['spotify-client']="streaming music client" ['thunderbird']="a full-featured email, RSS and newsgroup client" )
 
declare -A ico=( ['audacity']="audacity" ['brasero']="brasero" ['dcp750cw']="printer" ['dropbox']="dropbox" ['freefilesync']="freefilesync" ['gparted']="gparted" ['indicator-cpufreq']="jockey" ['kaffeine']="kaffeine" ['numlockx']="key_bindings" ['radiotray']="radiotray" ['spotify-client']="spotify" ['thunderbird']="thunderbird-old" )
 
declare -A img=( ['audacity']="audacity" ['brasero']="brasero" ['dcp750cw']="printer" ['dropbox']="dropbox" ['freefilesync']="ffs" ['gparted']="gparted" ['indicator-cpufreq']="jockey" ['kaffeine']="kaffeine" ['numlockx']="key_bindings" ['radiotray']="radiotray" ['spotify-client']="spotify" ['thunderbird']="thunderbird-old" )
 
declare -A url=( ['franceculture']="http://direct.franceculture.fr/live/franceculture-midfi.mp3@,2" ['franceinfo']="http://direct.franceinfo.fr/live/franceinfo-midfi.mp3@,3" ['franceinter']="http://direct.franceinter.fr/live/franceinter-midfi.mp3@,4" ['francemusique']="http://direct.francemusique.fr/live/francemusique-midfi.mp3@,5" )
 
declare -a wge=( 'https://www.dropbox.com/s/t0f3twqfhsu5ucv/ffs' 'https://www.dropbox.com/s/e6tak1ux6qgi1hn/franceculture' 'https://www.dropbox.com/s/jqggv26sqh8pa2u/franceinfo' 'https://www.dropbox.com/s/hc5nwktz849n0u3/franceinter' 'https://www.dropbox.com/s/xmafeabrnr8h5s3/francemusique' 'https://www.dropbox.com/s/ygu549rz3le60am/freefilesync' 'https://www.dropbox.com/s/vjr336hl0s7y974/lightning' 'https://www.dropbox.com/s/vaucjkq5v52pvbv/provider-for-google-calendar' )  
 
addons()  
{  
for zzz in ${!add[*]};do
thu="/usr/lib/$deb-addons/extensions"  
rm -Rf $thu/$(printf ${add[${zzz}]}|cut -d'_' -f1)  
done  
while read ddd; do  
wget -cq --show-progress --limit-rate=$(printf ${add[${ddd}]}|cut -d'_' -f2|cut -d'@' -f1) "https://addons.$deb.net/$deb/downloads/latest/$ddd"  
mkdir -p $thu/$(printf ${add[${ddd}]}|cut -d'_' -f1)  
unzip -q ~/.check-box/$(printf $ddd|cut -d'/' -f2) -d $thu/$(printf ${add[${ddd}]}|cut -d'_' -f1)  
num="$(printf ${bed[${deb}]}|cut -d'@' -f2)$(printf ${add[${ddd}]}|cut -d'@' -f2) "
prt=$(printf $ddd|cut -d'/' -f1)
print
done < .addons  
}  
autostart()  
{  
yad --warning --on-top --title=$deb --text-align=left --image=$ico --width=600 --height=100 --image-on-top --center --fixed \
--text="enable autostart ? (default $onf)." --timeout=10 --timeout-indicator=bottom --buttons-layout=edge --window-icon=$ico \
--button="yes!gtk-yes!:0" --button="no!gtk-no!:2" 2>/dev/null
case $? in  
0)  
enabled  
su -l $(who|cut -d' ' -f1) -c "notify-send -i $ico 'autostart $deb enabled.'";;  
2)  
disabled  
su -l $(who|cut -d' ' -f1) -c "notify-send -i $ico 'autostart $deb disabled.'";;  
70)  
$onf  
su -l $(who|cut -d' ' -f1) -c "notify-send -i $ico 'autostart $deb $onf.'";;  
esac  
}  
checklist()    
{  
run=$(($(wc -l .check|cut -d' ' -f1)+1))  
sed -i 's/\.//g' .check
sta="$(date +%H:%M:%S)"
bash -c "cat > .report <<-'eof'  
> start: $sta.
eof"    
{  
running  
} &  
printf "%s\n" "running." > .run  
while read deb;do
but=unselect-all
sel=TRUE
truncate -s 0 .prog-tmp
printf "%s\n" "prog." > .prog
{
sleep 0.3  
while [ "$(wc -l .prog|cut -d' ' -f1)" -lt 2 ];do
echo "#$(head -n $(wc -l .prog-tmp|cut -d' ' -f1) '.prog-tmp'|tail -n 1)"
done |
yad --progress --pulsate --on-top --title=$deb --image=${ico[${deb}]} --width=600 --height=100 \
--window-icon=${ico[${deb}]} --no-buttons --center --auto-close --fixed 2>/dev/null
} &
{
if (printf "${bed[${deb}]}"|grep -q '&');then
$(printf "${bed[${deb}]}"|cut -d'&' -f1)
elif !(printf "${bed[${deb}]}"|grep -q '&');then
apt-get -y install $deb  
num="$(printf ${bed[${deb}]}|cut -d'@' -f2) "
prt=$deb
print
fi
} >> .prog-tmp 2>&1
printf "%s\n" "prog." >> .prog
sleep 1
printf "%s\n" "running." >> .run
done < .check
printf "%s\n" "running." >> .run
sort -n -o .report .report
sed -i "s/[0-9][0-9] //g" .report
sed -i "s/[0-9][0-9],[0-9] /  /g" .report
fin="$(date +%H:%M:%S)"
bash -c "cat >> .report <<-'eof'  
> end: $fin.
eof"
dur=$(date -u -d @$(($(date -d $fin +%s)-$(date -d $sta +%s))) +%T)
bash -c "cat >> .report <<-'eof'  
> time: $dur.
eof"  
log  
}  
dcp750cw()  
{  
num="$(printf ${bed[${deb}]}|cut -d'@' -f2) "
prt=dcp750cw
print
dpkg --add-architecture i386  
apt-get -y update
num="$(printf ${bed[${deb}]}|cut -d'@' -f2),1 "
prt=architecture-i386
print
apt-get -y install libc6:i386  
num="$(printf ${bed[${deb}]}|cut -d'@' -f2),2 "
prt=libc6:i386
print
apt-get -y install libstdc++6:i386
num="$(printf ${bed[${deb}]}|cut -d'@' -f2),3 "
prt=libstdc++6:i386
print
[ -e /var/spool/lpd ]|| mkdir -p /var/spool/lpd  
bro="http://download.brother.com/welcome"
if ! (dpkg --get-selections|grep -qw 'brscan2');then  
wget -cq --show-progress --limit-rate=16k "$bro/dlf006637/brscan2-0.2.5-1.amd64.deb"
printf "%s\n" " "    
dpkg -i --force-all brscan2-0.2.5-1.amd64.deb  
brsaneconfig2 -a name=DCP750CW model=DCP-750CW ip=192.168.1.3  
cp -Rf /usr/lib64/* /usr/lib  
fi  
num="$(printf ${bed[${deb}]}|cut -d'@' -f2),4 "
prt=brscan2
print  
if ! (dpkg --get-selections|grep -qw 'brscan-skey');then  
wget -cq --show-progress --limit-rate=10k "$bro/dlf006652/brscan-skey-0.2.4-1.amd64.deb"  
printf "%s\n" " "  
dpkg -i --force-all brscan-skey-0.2.4-1.amd64.deb  
brscan-skey  
fi
num="$(printf ${bed[${deb}]}|cut -d'@' -f2),5 "
prt=brscan-skey
print
if ! (dpkg --get-selections|grep -qw 'dcp750cwlpr');then
wget -cq --show-progress --limit-rate=200k "$bro/dlf005471/dcp750cwlpr-1.0.1-1.i386.deb"
printf "%s\n" " "
dpkg -i --force-all dcp750cwlpr-1.0.1-1.i386.deb  
fi
num="$(printf ${bed[${deb}]}|cut -d'@' -f2),6 "
prt=dcp750cwlpr
print
if ! (dpkg --get-selections|grep -qw 'dcp750cwcupswrapper');then
wget -cq --show-progress --limit-rate=2.5k "$bro/dlf005473/dcp750cwcupswrapper-1.0.1-1.i386.deb"
printf "%s\n" " "
dpkg -i --force-all dcp750cwcupswrapper-1.0.1-1.i386.deb
fi
num="$(printf ${bed[${deb}]}|cut -d'@' -f2),7 "
prt=dcp750cwcupswrapper
print
if ! (lpstat -v 2>/dev/null|grep -q 192.168.1.3);then  
lpadmin -p 'DCP750CW' \
-v 'socket://192.168.1.3' \
-m 'DCP750CW series CUPS' \
-P '/usr/share/cups/model/brdcp750cw.ppd' \
-L 'Home' \
-o 'Two-Sided Printing=DuplexNoTumble' \
-o 'Color=Mono' \
-o 'Enhance Black Printing=ON' \
-o 'Skip Blank Page=ON' \
-o 'printer-is-shared=false' \
-E
lpadmin -d 'DCP750CW'
brprintconf_dcp750cw -pt A4
fi
}
disabled()  
{  
rm -f /etc/xdg/autostart/$deb.desktop
num="$(printf ${bed[${deb}]}|cut -d'@' -f2),1 "
prt=autostart-disabled
print
}  
dropbox()
{
ico=$deb
apt-get -y install $deb  
num="$(printf ${bed[${deb}]}|cut -d'@' -f2) "
prt=$deb
print
yad --warning --on-top --title=$deb --text-align=left --image=$ico --width=600 --height=100 --image-on-top --center --fixed \
--text="install nemo-$deb ? (default yes)." --timeout=10 --timeout-indicator=bottom --buttons-layout=edge --window-icon=$ico \
--button="yes!gtk-yes!:0" --button="no!gtk-no!:2" 2>/dev/null
case $? in  
0|70)
apt-get -y install nemo-$deb
num="$(printf ${bed[${deb}]}|cut -d'@' -f2),1 "
prt=nemo-$deb
print;;  
2);;
esac  
}
enabled()  
{  
cp -f /usr/share/applications/$deb.desktop /etc/xdg/autostart
num="$(printf ${bed[${deb}]}|cut -d'@' -f2),1 "
prt=autostart-enabled
print
}    
end()  
{  
cd ..  
rm -Rf .check-box  
apt-get -y remove xdotool yad >/dev/null 2>&1  
apt-get -y clean > /dev/null 2>&1  
timedatectl set-local-rtc 1 --adjust-system-clock  
}  
freefilesync()  
{  
if [ ! -e "/usr/share/FreeFileSync/FreeFileSync" ];then  
wget -cq --show-progress "https://www.dropbox.com/s/yspo94p1b81ra6p/$deb.tar.gz"  
tar xzf $deb.tar.gz -C /usr/share
cp $deb /usr/share/FreeFileSync
bash -c "cat > /usr/share/applications/FreeFileSync.desktop <<-'eof'
[Desktop Entry]
Type=Application
Name=FreeFileSync
GenericName=Folder Comparison and Synchronization
Exec=/usr/share/FreeFileSync/FreeFileSync
Icon=/usr/share/FreeFileSync/$deb
NoDisplay=false
Terminal=false
Categories=Utility;FileTools;
StartupNotify=true
eof"
fi
num="$(printf ${bed[${deb}]}|cut -d'@' -f2) "
prt=$deb
print
}  
log()
{
but=select-all
sel=FALSE
log="auto-install-$(date +%d-%m-%Y-$fin)."
[ -s .check ]||seltion
yad --text-info --filename=.report --title=auto-install --image=applications-utilities --width=300 --height=600 --image-on-top \
--text=$log --text-align=left --on-top --window-icon=applications-utilities --buttons-layout=edge --center --fixed \
--button="return!view-refresh!:0" --button="save!document-save!:2" --button="exit!document-export!:1" 2>/dev/null
case $? in
0)
seltion;;
1|252)  
end;;
2)  
cp -f .report ~/$log; chmod 777 ~/$log; chmod -x ~/$log
su -l $(who|cut -d' ' -f1) -c "notify-send -i document-save '$log saved!'"
seltion;;
esac
}
print()
{
printf "%s\n" " "  
printf "%s\n" "$num✔ $prt." >> .report
printf "%s\n" "✔ $prt."
sleep 1
printf "%s\n" " "  
}  
radios()  
{  
bash -c "cat > .url-tmp <<-'eof'  
<bookmarks>  
<group name='root'>  
eof"  
sed -i 's/\.//g' .radios  
while read kkk; do  
bash -c "cat >> .url-tmp <<-'eof'  
<bookmark name=\"$kkk\" url=\"$(printf ${url[${kkk}]}|cut -d'@' -f1)\"/>  
eof"
num="$(printf ${bed[${deb}]}|cut -d'@' -f2)$(printf ${url[${kkk}]}|cut -d'@' -f2) "
prt=$kkk
print  
done < .radios  
bash -c "cat >> .url-tmp <<-'eof'    
</group>  
</bookmarks>  
eof"
cp -f .url-tmp /usr/share/$deb/bookmarks.xml  
rm -Rf ~/.local/share/$deb
}  
radiotray()  
{  
ico=$deb  
onf=enabled  
swi=radtray
apt-get -y install $deb  
num="$(printf ${bed[${deb}]}|cut -d'@' -f2) "
prt=$deb
print
autostart  
radtray  
}  
radtray()  
{  
bash -c "cat > .radio-tray <<-'eof'  
#!/bin/bash  
yad --list --checklist --title=$deb --timeout=10 --timeout-indicator=bottom --width=600 --height=250 --on-top --image-on-top \\
--text=\"seclect radios : (default all).\" --text-align=left --separator=\" \" --image=$ico --window-icon=$ico --no-headers \\
--button=\"$but!edit-select-all!:2\" --button=\"validate!dialog-ok!:0\" --buttons-layout=edge --center --fixed \\
--column= --column=\":IMG\" --column= --print-column=3 \\
eof"  
for lll in $(printf "%s\n" ${!url[*]}|sort);do  
bash -c "cat >> .radio-tray <<-'eof'  
\"$sel\" \"$lll\" \"$lll.\" \\
eof"  
done  
bash -c "cat >> .radio-tray <<-'eof'  
2>/dev/null > .radios  
eof"  
bash .radio-tray  
case $? in  
0)  
radios;;  
2)  
switch;;    
70)  
for lll in $(printf "%s\n" ${!url[*]}|sort);do  
printf "$lll\n" >> .radios  
done  
radios;;  
esac  
}
running()  
{
while [ "$(wc -l .run|cut -d' ' -f1)" -le "$run" ];do  
echo "scale=2;($(wc -l .run|cut -d' ' -f1)*(($run/($run/100))/$run))"|bc
echo -e "#$(wc -l .run|cut -d' ' -f1)/$(wc -l .check|cut -d' ' -f1) in progress..."  
done |  
yad --progress --title=auto-install --center --image=applications-utilities --buttons-layout=center \
--auto-close --width=1000 --height=400 --window-icon=applications-utilities --fixed \
--button="listing.!gnumeric!:8" 2>/dev/null
case $? in  
8)  
su -l $(who|cut -d' ' -f1) -c "notify-send -i gnumeric '$((while read deb;do printf " $deb,";done < .check)|sed 's/.$//').'"  
running;;  
esac
}    
selection()  
{  
but=select-all  
sel=FALSE  
seltion  
}  
seltion()  
{  
swi=seltion
bash -c "cat > .liste <<-'eof'
#!/bin/bash
yad --list --checklist --title=auto-install --image=applications-utilities --on-top --no-headers --image-on-top --width=400 --height=400 --center \\
--text=\"select softwares :\" --text-align=left --separator=\" \" --tooltip-column=4 --window-icon=applications-utilities --buttons-layout=edge \\
--button=\"$but!edit-select-all!:2\" --button=\"validate!dialog-ok!:0\" --button=\"exit!document-export!:1\" --fixed \\
--column= --column=\":IMG\" --column= --column= --print-column=3 --hide-column=4 \\
eof"
for ggg in $(printf "%s\n" ${!bed[*]}|sort);do
bash -c "cat >> .liste <<-'eof'
\"$sel\" \"${img[${ggg}]}\" \"$ggg.\" \"${com[${ggg}]}.\" \\
eof"
done
bash -c "cat >> .liste <<-'eof'
2>/dev/null > .check
eof"
bash .liste
case $? in  
0)
if (grep -qw "dropbox." .check);then
sed -i '/dropbox./d' .check
bash -c "cat >> .check <<-'eof'  
dropbox.
eof"
fi    
checklist;;
1|252)  
end;;  
2)  
switch;;  
esac  
}  
start()    
{  
mkdir -p .check-box
cd .check-box
{
for www in ${wge[@]};do
wget -cq $www
done
} &  
rm -f /var/lib/dpkg/lock  
apt-get -y install xdotool yad >/dev/null 2>&1  
xdotool windowminimize $(xdotool getactivewindow)  
selection  
}  
switch()  
{  
if [ $sel = FALSE ];then  
but=unselect-all  
sel=TRUE  
else  
but=select-all  
sel=FALSE  
fi  
$swi  
}  
thunderbird()  
{  
ico=$deb-old  
onf=disabled  
swi=thunbird
apt-get -y install $deb  
num="$(printf ${bed[${deb}]}|cut -d'@' -f2) "
prt=$deb
print    
autostart  
thunbird  
}  
thunbird()  
{  
bash -c "cat > .thun-derbird <<-'eof'
#!/bin/bash
yad --list --checklist --title=$deb --text-align=left --image-on-top --no-headers --width=600 --height=250 --on-top \\
--text=\"select add-on : (default all).\" --timeout=10 --timeout-indicator=bottom --image=$ico --window-icon=$ico --center \\
--button=\"$but!edit-select-all!:2\" --button=\"validate!dialog-ok!:0\" --buttons-layout=edge --separator=\" \" \\
--column= --column=\":IMG\" --column= --column= --print-column=4 --hide-column=4 \\
eof"
for www in $(printf "%s\n" ${!add[*]}|sort);do
bash -c "cat >> .thun-derbird <<-'eof'
\"$sel\" \"$(printf $www|cut -d'/' -f1)\" \"$(printf $www|cut -d'/' -f1).\" \"$www\" \\
eof"
done
bash -c "cat >> .thun-derbird <<-'eof'
2>/dev/null > .addons
eof"
bash .thun-derbird
case $? in
0)
addons;;
2)
switch;;
70)
for www in $(printf "%s\n" ${!add[*]}|sort);do
printf "$www\n" >> .addons
done
addons;;
esac
}  
 
start  
 
exit 0  
 
# HB 29/04/2019.  


Message édité par henri bel le 29-04-2019 à 17:26:24
mood
Publicité
Posté le 24-04-2018 à 00:53:32  profilanswer
 

n°1417787
Phroby
Posté le 25-04-2018 à 09:45:30  profilanswer
 

Merci, ça m'a l'air très intéressant mais le paramétrage se fait comment ? il y a des dialogues une fois lancé ? ou il faut éditer

n°1417798
henri bel
Posté le 25-04-2018 à 16:19:58  profilanswer
 

Vous pouvez tester le script dans une machine virtuelle avant de le lancer sur une machine de production.


Message édité par henri bel le 22-04-2019 à 22:39:20
n°1433224
henri bel
Posté le 22-04-2019 à 22:39:59  profilanswer
 

Mise à jour le 29 avril 2019.


Message édité par henri bel le 29-04-2019 à 17:26:41

Aller à :
Ajouter une réponse
  FORUM HardWare.fr
  Linux et OS Alternatifs
  Codes et scripts

   Script installation auto pour Linux Mint 19.1 Cinnamon 64 bit.

 

Sujets relatifs
comment mettre a jour le kernel linux de lmde sans internet ?Script pour kill automatique les processus qui utilisent 60% du CPU
Installation de Lubuntu sur SSD - Msg d'erreur partitionnementScript de redémararge Wifi
Problème lors de l'installation de Kali Linux sur Virtual BoxProblème de reconnaissance matériel à l'installation de Ubuntu
sed multi occurences sous linux[W10] Installation sur SSD
Installation Xubuntu sur support USB externe 
Plus de sujets relatifs à : Script installation auto pour Linux Mint 19.1 Cinnamon 64 bit.


Copyright © 1997-2018 Hardware.fr SARL (Signaler un contenu illicite) / Groupe LDLC / Shop HFR