rebellion
Utente Èlite
- Messaggi
- 1,596
- Reazioni
- 508
- Punteggio
- 117
finito lo script di aggiornamento pacchetti aur installati. una cosa semplice che metto in appindicator. va lanciato da terminale a es. tramite il comando:
Codice:
$ gnome-terminal --hide-menubar --title="AUR update" -e 'sh -c "sh /home/$USER/aur_update.sh"'
Codice:
#!/bin/bash
#script per aggiornare pacchetti installati, by rebellion
#nome dello script: aur_update.sh
#da lanciare da terminale tramite comando : gnome-terminal --hide-menubar --title="AUR update" -e 'sh -c "sh /home/$USER/aur_update.sh"'
if [[ $(readlink -f /proc/$(ps -o ppid:1= -p $$)/exe) != $(readlink -f "$SHELL") ]] ; then notify-send "applicazione da lanciare tramite terminale"
else
package_path="1"
while [ "$package_path" != "" ] ; do
dir=$(find /home/$USER -type d -name 'AUR')
package_path=$(zenity --file-selection --file-filter="*.tar.gz" --filename=$dir/ --title="Seleziona pacchetto.tar.gz AUR da aggiornare" 2>/dev/null)
if [ "$package_path" != "" ] ; then
package_name_tar=${package_path##*/}
lungh_package_name_tar=$((${#package_name_tar}+1))
package_dir=${package_path:0: -$lungh_package_name_tar}
package_name=${package_name_tar:0: -7}
package_dir_del=$package_dir"/"$package_name
package_path_old=$package_path"_old"
package_dir_del_old=$package_dir_del"_old"
search=$(find $package_dir -type d -name "$package_name")
if [ "$search" = "" ] ; then echo "Cartella del pacchetto "$package_name" scompattato assente in "$package_dir": aggiornamento fallito." ; read -p "premi invio per continuare.." ; clear
else
read -p "Confermi l'aggiornamento di $package_name? s/n" -n 1 reply
if [ $reply = "s" ] ; then
echo -e "Aggiornamento "$package_name" in corso..\nbackup "$package_dir_del"---> fatto\nbackup "$package_name_tar"---> fatto"
mv $package_path $package_path_old
mv $package_dir_del $package_dir_del_old
wget -P $package_dir https://aur.archlinux.org/cgit/aur.git/snapshot/$package_name_tar
tar -xvzf $package_path -C $package_dir
cd $package_dir_del
if makepkg ; then
sudo pacman -U $package_dir_del/*.pkg.tar.xz
rm $package_path_old && rm -r $package_dir_del_old
echo -e "\n$package_name aggiornato, premi invio per continuare." && read
else
rm -r $package_dir_del && mv $package_dir_del_old $package_dir_del
rm $package_path && mv $package_path_old $package_path
echo -e "\naggiornamento $package_name fallito.\nripristinato il backup del pacchetto.\npremi invio per continuare." && read
fi
else
clear
fi
fi
fi
done
fi
exit 0
Ultima modifica: