3 #pacman zenity-based GUI
6 TEXTEDITOR
=$
(cat ~
/.pacmangui
/texteditor
)
7 MIRRORFILE
=$
(cat ~
/.pacmangui
/mirrorlistfile
)
8 TERMINAL
=$
(cat ~
/.pacmangui
/terminal
)
13 USETERM
="gnome-terminal -x"
19 USETERM
="xfce4-terminal -x"
28 $USETERM sudo pacman
-Syu
30 until [ ! $
(pidof sudo
) ]; do
33 while [ -e /var
/lib
/pacman
/db.lck
]; do
36 ##### forma vieja #####
38 #while [ -e /var/lib/pacman/db.lck ]; do
42 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "PacGUI - Finished." "You may look up the log file anytime from the application menu or /var/log/pacman.log"
43 tail -n 50 /var
/log
/pacman.log |
tac | zenity
--text-info --height=600 --width=600
47 ######################
50 INST
=$
(zenity
--entry --title="Install package." --width=350 --text="Type in the package name (or names) you wish to install") || main
51 $USETERM sudo pacman
-S $INST
54 until [ ! $
(pidof sudo
) ]; do
57 while [ -e /var
/lib
/pacman
/db.lck
]; do
60 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "PacGUI - Finished" "You may look up the log file anytime from the application menu or /var/log/pacman.log"
61 tail -n 50 /var
/log
/pacman.log |
tac | zenity
--text-info --height=600 --width=600
66 BUSCA_I
=$
(zenity
--entry --title="Repository search." --width=350 --text="Type in as many keywords as you want to search for.") || main
67 RES_BUSCA_I
=$
(pacman
-Ss $BUSCA_I)
68 RES_BUSCA_I_SORT
=$
(echo $RES_BUSCA_I |
grep / |
tr -s [:blank
:] "\n" |
grep / |
tr -s "/" " ")
70 echo "$RES_BUSCA_I" | zenity
--text-info --width=500 --height=500 --title="Packages found for "\"$BUSCA_I""\" &
72 CHECK
=$
(zenity
--list --checklist --title="Package installation." --text="Select packages to be installed" --width=350 --height=500 --column=Instalar
--column=Paquete
$RES_BUSCA_I_SORT) || busca_inst
75 CHECK_INST
=$
(echo $CHECK |
tr "|" " ")
76 $USETERM sudo pacman
-S $CHECK_INST
79 until [ ! $
(pidof sudo
) ]; do
82 while [ -e /var
/lib
/pacman
/db.lck
]; do
86 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "PacGUI - Finished." "You may look up the log file anytime from the application menu or /var/log/pacman.log"
87 tail -n 50 /var
/log
/pacman.log |
tac | zenity
--text-info --height=600 --width=600
91 ######################
94 LOCFILE
=$
(zenity
--file-selection --title="Select the local package to be installed") || main
95 $USETERM sudo pacman
-U $LOCFILE
98 until [ ! $
(pidof sudo
) ]; do
101 while [ -e /var
/lib
/pacman
/db.lck
]; do
105 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "PacGUI - Finished." "You may look up the log file anytime from the application menu or /var/log/pacman.log"
106 tail -n 50 /var
/log
/pacman.log |
tac | zenity
--text-info --height=600 --width=600
110 ######################
113 PKGDIR
=$
(zenity
--file-selection --directory --title="Select the directory where the PKGBUILD file is located.") || main
117 gnome-terminal
-t "Package compilation" --working-directory=$PKGDIR -x sudo makepkg
-s -r --asroot
120 konsole
--working $PKGDIR -e sudo makepkg
-s -r --asroot
123 xfce4-terminal
--working-directory=$PKGDIR -x sudo makepkg
-s -r --asroot
126 zenity
--info --title="D'oh" --text="Sorry, this option isn't available using xterm yet :("
131 if [ ! $
(ls $PKGDIR |
grep pkg.
tar.gz
) ]
133 zenity
--error --title="PacGUI makpkg error" --text="There was an error so package couldn't be created. Try again manually running from a terminal in the corresponding directory the following command: \n\n sudo makepkg -s -r --asroot"
135 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "PacGUI - Finished" "Package created in $PKGDIR"
136 zenity
--question --title="Local package successfully created" --text="Do you wish to install the new package?" || main
137 #gnome-terminal -t "Instalación de paquete local" -x sudo pacman -U $PKGDIR/*.pkg.tar.gz
138 $USETERM sudo pacman
-U $PKGDIR/*.pkg.
tar.gz
141 until [ ! $
(pidof sudo
) ]; do
144 while [ -e /var
/lib
/pacman
/db.lck
]; do
148 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "PacGUI - Finished." "You may look up the log file anytime from the application menu or /var/log/pacman.log"
149 tail -n 50 /var
/log
/pacman.log |
tac | zenity
--text-info --height=600 --width=600
153 ######################
156 BUSCA
=$
(zenity
--entry --title="Repository search" --width=350 --text="Type in as many keywords as you want to search for") || main
157 RES_BUSCA
=$
(pacman
-Ss $BUSCA)
158 RES_BUSCA_SORT
=$
(echo $RES_BUSCA |
grep / |
tr -s [:blank
:] "\n" |
grep /)
159 echo "$RES_BUSCA" | zenity
--text-info --width=500 --height=500 --title="Results for "\"$BUSCA""\" &
161 INFO
=$
(zenity
--list --title="Select package" --text="Select package to\nshow detailed info about it" --width=350 --height=500 --column=Paquete
$RES_BUSCA_SORT) || busca
162 INFO_SORT
=$
(echo $INFO |
tr "|" " ")
163 zenity
--info --title="Info for "\"$INFO""\" --text="$(echo "$
(pacman
-Si $INFO_SORT)" | grep -v Packager)"
167 ######################
169 function busca_local
{
170 BUSCA
=$
(zenity
--entry --title="Local search" --width=350 --text="Type in as many keywords as you want to search for") || main
171 RES_BUSCA
=$
(pacman
-Qs $BUSCA)
172 RES_BUSCA_SORT
=$
(echo $RES_BUSCA |
grep / |
tr -s [:blank
:] "\n" |
grep /)
173 echo "$RES_BUSCA" | zenity
--text-info --width=500 --height=500 --title="Resuls for "\"$BUSCA""\" &
175 INFO
=$
(zenity
--list --title="Select un package" --text="Select package to\nshow detailed info about it" --width=350 --height=500 --column=Paquete
$RES_BUSCA_SORT) || busca_local
176 INFO_SORT
="$(echo "$INFO" | tr -s / "\n")"
177 zenity
--info --title="Información para "\"$INFO""\" --text="$(echo "$
(pacman
-Qi $INFO_SORT)" | grep -v Packager)"
180 ######################
183 DESINST
=$
(zenity
--entry --title="Remove package" --width=350 --text="Type in the page name (or names) you wish to remove") || main
184 #gnome-terminal -t "Desinstalación de paquete(s)" -x sudo pacman -Rcs $DESINST
185 $USETERM sudo pacman
-Rcs $DESINST
188 until [ ! $
(pidof sudo
) ]; do
191 while [ -e /var
/lib
/pacman
/db.lck
]; do
196 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "PacGUI - Finished." "You may look up the log file anytime from the application menu or /var/log/pacman.log"
197 tail -n 50 /var
/log
/pacman.log |
tac | zenity
--text-info --height=600 --width=600
200 ######################
202 function busca_elim
{
203 BUSCA_E
=$
(zenity
--entry --title="Repository search." --width=350 --text="Type in as many keywords as you want to search for.") || main
204 RES_BUSCA_E
=$
(pacman
-Qs $BUSCA_E)
205 RES_BUSCA_E_SORT
=$
(echo $RES_BUSCA_E |
grep / |
tr -s [:blank
:] "\n" |
grep / |
tr -s "/" " ")
207 echo "$RES_BUSCA_E" | zenity
--text-info --width=500 --height=500 --title="Packages found for "\"$BUSCA_E""\" &
209 CHECK
=$
(zenity
--list --checklist --title="Package removal" --text="Select packages to be removed" --width=350 --height=500 --column=Instalar
--column=Paquete
$RES_BUSCA_E_SORT) || busca_elim
212 CHECK_INST
=$
(echo $CHECK |
tr "|" " ")
213 #gnome-terminal -t "Desinstalación de paquete(s)" -x sudo pacman -Rcs $CHECK_INST
214 $USETERM sudo pacman
-Rcs $CHECK_INST
217 until [ ! $
(pidof sudo
) ]; do
220 while [ -e /var
/lib
/pacman
/db.lck
]; do
224 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "PacGUI - Finished." "You may look up the log file anytime from the application menu or /var/log/pacman.log"
225 tail -n 50 /var
/log
/pacman.log |
tac | zenity
--text-info --height=600 --width=600
228 ######################
232 CACHE
=$
(zenity
--list --title="Clean downloaded pacages cache" --text="Select an option" --width=600 --column=" " --column="Option" "1" "Clean only old packages" "2" "Clean all packages") || main
237 #gnome-terminal -t "Eliminando cache" -x sudo pacman -Sc
238 $USETERM sudo pacman
-Sc
240 until [ ! $
(pidof sudo
) ]; do
243 while [ -e /var
/lib
/pacman
/db.lck
]; do
247 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "PacGUI - Finished" "Old packages cache cleaned."
251 #gnome-terminal -t "Eliminando cache" -x sudo pacman -Scc
252 $USETERM sudo pacman
-Scc
254 until [ ! $
(pidof sudo
) ]; do
257 while [ -e /var
/lib
/pacman
/db.lck
]; do
261 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "PacGUI - Finished" "Whole packages cache cleaned."
269 #####################
272 $USETERM sudo pacman-optimize
273 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "PacGUI - Finished" "Pacman database has been optimized."
281 #####################
284 ACTION
=$
(zenity
--list --title="Rankmirrors" --width=500 --text="WARNING: These actions may take several minutes, depending on the active mirrors number" --column=" " --column="Select an option" "1" "Check active mirrors" "2" "Check mirrors and rank 'rankmirrors' file again.") || main
287 #MIRROR=$(zenity --file-selection --title="Rankmirrors" --text="Seleccione el archivo de mirrors" --filename="/etc/pacman.d/mirrorlist")
290 echo "# Ranking mirrors.\n\nPlease wait, this can take several minutes.\n"
291 rankmirrors
-v "$MIRRORFILE" > "$TEMP"
293 primera | zenity
--progress --title="Ranking mirrors" --pulsate --auto-close --auto-kill
294 cat "$TEMP" | zenity
--text-info --title="Mirrors results" --height=600 --width=800
300 #MIRROR2=$(zenity --file-selection --title="Rankmirrors" --text="Seleccione el archivo de mirrors" --filename="/etc/pacman.d/mirrorlist")
303 echo "# Ranking mirrors and sorting mirrorlist.\n\nPlease wait, This may take several minutes.\n"
304 rankmirrors
"$MIRRORFILE" > "$TEMP"
306 segunda | zenity
--progress --title="Ranking mirrors" --pulsate --auto-close --auto-kill
307 cat "$TEMP" | zenity
--text-info --title="New mirrorlist preview" --height=600 --width=800
308 zenity
--question --title="Modify mirrorlist" --text="Are you sure you want to modify the\nmirrorlist file with the obtained resultset?" || main
309 gksu
cp "$TEMP" "$MIRRORFILE"
311 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "PacGUI - Finished" "Rankmirrors file modified."
333 ######################
336 #RANK=$(zenity --file-selection --title="Editar mirrors de pacman" --text="Seleccione el archivo de mirrors que quiere editar" --filename="/etc/pacman.d/mirrorlist") || main
337 gksu
$TEXTEDITOR $MIRRORFILE
341 ######################
344 zenity
--text-info --height=600 --width=800 --filename=/var
/log
/pacman.log
348 ######################
351 CONFIG
=$
(zenity
--list --title="Configuration" --text="WARNING: For these changes to take effect, you must restart the application" --width=600 --height=210 --column=" " --column="Opción" "1" "Change text editor. Currently: $TEXTEDITOR" "2" "Change the mirrorlist file. Currently: $MIRRORFILE" "3" "Change the terminal emulator to be used. Currently: $TERMINAL") || main
356 zenity
--entry --text="Type in yor default text editor" --title="Default Editor" --entry-text="$TEXTEDITOR" > ~
/.pacmangui
/texteditor
361 zenity
--file-selection --title="Select the default mirror file" --filename="$MIRRORFILE" > ~
/.pacmangui
/mirrorlistfile
365 zenity
--list --radiolist --height=250 --text="Select the terminal emulator to be used" --column="" --column="Available terminals" "1" "Gnome-terminal" "2" "Konsole" "3" "Xfce-terminal" "4" "Xterm" > ~
/.pacmangui
/terminal
373 ######################
376 zenity
--info --title="About..." --text="Zenity PacGUI is a small GUI based on zenity\n for pacman, easy to use and understand.\n\nConceived and created by jorchube.\n\nIf you have any question about any function of this application, visit:\n\nhttp://wiki.archlinux.org/index.php/Main_Page\n\n\n\nThans for their suggestions to:\n\n - Amuchamu (mktemp and text editor selection).\n\n - 4s|m3tr|ko0 (gksu)\n\n - resadent (compilation dependencies).\n\n\n\nProject web site:\nhttp://sourceforge.net/projects/zenitypacgui/\n\n\nEnglish translation: 4s|m3tr|ko0"
380 #####################
382 zenity
--question --title="WARNING" --text="This could be dangerous for your system.\n\nIf you are not sure, don't continue." || main
383 TEXT
=$
(cat /etc
/rc.conf |
grep "MODULES=(" |
tr -d "MODULES=(" |
tr -d ")" ) || main
384 MODS
=$
(zenity
--entry --width=950 --title="Modules on startup" --text="Modules on startup !<module>=blacklisted" --entry-text="$TEXT") || main
385 zenity
--question --title="Modules on startup" --text="THIS COULD BE DANGEROUS!!!\n\nApply changes?\n\n\nNew list of modules on startup:\n\n$MODS" || main
387 cp /etc
/rc.conf ~
/.pacmangui
/rc.conf.backup
388 $USETERM sudo
sed -i s
/"$TEXT"/"$MODS"/g
/etc
/rc.conf
389 #sudo va (sin &&, osea, sin nada antes), pero quiero darle un poco mas de info al user.
390 #con gksu para las dos cosas no va...pero los comandos en si funcionan. ya vorem como lo haces campeon!!!
391 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "Daemons on startup modified" "You can undo the last rc.conf modification at Arch Settings menu dialog"
397 zenity
--question --title="WARNING" --text="This could be dangerous for your system.\n\nIf you are not sure, don't continue." || main
398 TEXT
=$
(cat /etc
/rc.conf |
grep "DAEMONS=(" |
tr -d "DAEMONS=(" |
tr -d ")" ) || main
399 MODS
=$
(zenity
--entry --width=950 --title="Daemons on startup" --text="Daemons on startup !<daemon>=blacklisted @<daemon>=backgrounded" --entry-text="$TEXT") || main
400 zenity
--question --title="Daemons on startup" --text="THIS COULD BE DANGEROUS!!!\n\nApply changes?\n\n\nNew list of daemons on startup:\n\n$MODS" || main
402 cp /etc
/rc.conf ~
/.pacmangui
/rc.conf.backup
403 $USETERM sudo
sed -i s
/"$TEXT"/"$MODS"/g
/etc
/rc.conf
404 #sudo va (sin &&, osea, sin nada antes), pero quiero darle un poco mas de info al user.
405 #con gksu para las dos cosas no va...pero los comandos en si funcionan. ya vorem como lo haces campeon!!!
406 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "Daemons on startup modified" "You can undo the last rc.conf modification at Arch Settings menu dialog"
414 zenity
--question --title="Edit rc.conf" --text="THIS COULD BE DANGEROUS!!!\n\nAre you sure you want to edit the rc.conf file?" || main
415 cp /etc
/rc.conf ~
/.pacmangui
/rc.conf.backup
416 gksu
$TEXTEDITOR /etc
/rc.conf
417 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "Daemons on startup modified" "You can undo the last rc.conf modification at Arch Settings menu dialog"
423 zenity
--question --title="restore rc.conf" --text="You are going to restore your rc.conf file before the last modification done with zenity_pacgui.\n\nDo you want to continue?" || main
424 gksu
cp ~
/.pacmangui
/rc.conf.backup
/etc
/rc.conf
425 notify-send
-i /usr
/share
/icons
/gnome
/32x32
/apps
/system-software-update.png
-t 7500 "PacGUI - Finished" "Last modification in rc.conf undone"
431 #####################
433 function primeravez
{
435 if [ ! "$TEXTEDITOR" ]
441 if [ ! "$MIRRORFILE" ]
460 zenity
--info --title="Zenity PacGUI" --text="Hi there "$USER"!\n\nIt seems to be the first time you run this application.\n\nPlease go on to configure it, and run it again when config finished (Dont worry, this will be fast)."
462 zenity
--info --title="Configuration" --text="First, you need to type in your default text editor.\nIf you are unsure, try:\n\nIf you use Gnome:\tgedit\nIf you use KDE:\tkwrite\nIf you use XFCE:\tmousepad"
463 zenity
--entry --text="Please type in your default text editor." --title="Default Editor" > ~
/.pacmangui
/texteditor
464 zenity
--info --title="Configuration" --text="Next, you have to select your mirrorlist file.\n\nIf you are unsure, just select the default matched file."
465 zenity
--file-selection --title="Select the default mirrorlist file to be used" --filename="/etc/pacman.d/mirrorlist" > ~
/.pacmangui
/mirrorlistfile
466 zenity
--info --title="Configuration" --text="Finally, select your terminal emulator.\nIf you are unsure, select:\n\nIf you use Gnome:\tGnome-Terminal\nIf you use KDE:\tkonsole\nIf you use XFCE:\txfce4-terminal"
467 zenity
--list --title="Terminal selection" --radiolist --height=250 --text="Select the terminal emulator to be used" --column="" --column="Available terminals" "1" "Gnome-terminal" "2" "Konsole" "3" "Xfce-terminal" "4" "Xterm" > ~
/.pacmangui
/terminal
471 zenity
--info --title="Zenity PacGUI" --text="PacGUI wasn't successfully configured .\nPlease continue to configure it, and run it again when finished."
473 zenity
--info --title="Configuration" --text="First, you need to type in your default text editor.\nIf you are unsure, try:\n\nIf you use Gnome:\tgedit\nIf you use KDE:\tkwrite\nIf you use XFCE:\tmousepad"
474 zenity
--entry --text="Please type in your default text editor." --title="Default Editor" > ~
/.pacmangui
/texteditor
475 zenity
--info --title="Configuration" --text="Next, you have to select your mirrorlist file.\n\nIf you are unsure, just select the default matched file."
476 zenity
--file-selection --title="Select the default mirrorlist file to be used" --filename="/etc/pacman.d/mirrorlist" > ~
/.pacmangui
/mirrorlistfile
477 zenity
--info --title="Configuration" --text="Finally, select your terminal emulator.\nIf you are unsure, select:\n\nIf you use Gnome:\tGnome-Terminal\nIf you use KDE:\tkonsole\nIf you use XFCE:\txfce4-terminal"
478 zenity
--list --title="Terminal selection" --radiolist --height=250 --text="Select the terminal emulator to be used" --column="" --column="Available terminals" "1" "Gnome-terminal" "2" "Konsole" "3" "Xfce-terminal" "4" "Xterm" > ~
/.pacmangui
/terminal
488 ######################
491 ######################
495 ACCION1
=$
(zenity
--list --title="Zenity PacGUI 0.4" --text="Select your desired option" --height=310 --width=350 --column="" --column="Sections" "1" "Update/Install packages" "2" "Remove packages" "3" "Package search" "4" "Yaourt" "5" "Other operations" "6" "Arch settings" "7" "Configuration" "8" "About this app..." ) ||
exit
499 ACCION11
=$
(zenity
--list --title="Update/Install Packages" --text="Select your desired option" --height=225 --width=350 --column="Command" --column="Action" "Syu" "System update" "S" "Install package(s)" "Ss_S" "Find and install" "U" "Install local package" ) || main
508 busca_inst
#terminada
516 ACCION12
=$
(zenity
--list --title="Remove packages" --text="Select your desired option" --height=150 --width=350 --column="Command" --column="Action" "Rcs" "Remove package(s)" "Qs_Rcs" "Find and Remove package(s)" ) || main
523 busca_elim
#terminada
530 ACCION13
=$
(zenity
--list --title="Package search" --text="Select your desired option" --height=150 --width=350 --column="Command" --column="Action" "Ss" "Repository search" "Qs" "Local search" ) || main
537 busca_local
#terminada
543 ACCION14
=$
(zenity
--list --title="Other operations" --text="Select your desired option" --height=260 --width=465 --column="Command" --column="Action" "makepkg" "compile and create .pkg.tar.gz" "Sc/Scc" "Clean downloaded packages cache" "optimize" "Optimize the pacman database" "rankmirrors" "Rank pacman mirrors speed" "editrank" "Manually edit the pacman mirrors file" "showlog" "look up pacman performed operations logfile" ) || main
576 SET
=$
(zenity
--list --title="Arch settings" --text="Select your desired option" --height=225 --width=350 --column="" --column="Option" "1" "Modules on system startup" "2" "Daemons on system startup" "3" "Edit /etc/rc.conf manually" "4" "Undo last operation in rc.conf" ) || main
593 sh
/usr
/bin
/pacyaourt || main
600 primeravez
#Terminada