2 #BANNER#######################################
4 ____ ____ __ _ _ _ __ __ _
5 (__ )( __)( ( \( \/ ) / _\ ( ( \
6 / _/ ) _) / // \/ \/ \/ /
7 (____)(____)\_)__)\_)(_/\_/\_/\_)__) v1.5
9 Zenity based frontend for pacman
10 <~Harvie (http://blog.harvie.cz)
15 #HELP/FEATURES################################
17 if [ "$1" == '--help' ]; then
20 - zenman --help prints this help
21 - when zenman started, kills last zenman runned by this user
22 - you can kill zenman by zenman --stop (click on tray icon or wait after this)
23 - last pid is stored in ~/.config/zenman/zenman.pid
24 - shows splashscreen (can be disabled...)
25 - shows tray icon for each state (on mouse over shows state)
26 - system is up to date
27 - refreshing pacman database
29 - shows notification when updates available and listing them
30 - clicking on icon will begin upgrade in new xterm
31 - this is disabled only when refreshing
32 - if pacman db is locked it will be automaticaly unlocked
33 - only if there is any pacman related process running
34 - if there is some pacman related operation, error message appears
35 - auto refreshing of pacman db is disabled (somebody will want to use cron)
36 - all settings are hardcoded to zenman (/usr/bin/zenman)
37 - all settings can be overrided
38 - system wide: /etc/zenman.conf
39 - single user only: ~/.config/zenman/zenman.conf
40 - you can also write your own translation to this files
43 ( Don't shy and get involved! ;o)
44 - Bugtracking/Bugfixing
45 - Port to another package managers
50 - Localization to your native language
55 #SETTINGS#####################################
56 zenman_caption
='ZenMan';
57 zenman_interval
=$
[10*60];
59 zenman_autorefresh
=false
;
60 zenman_configdir
=~
/.config
/zenman
;
61 zenman_pid
="$zenman_configdir/zenman.pid";
62 zenman_true_ico
='/usr/share/icons/gnome/scalable/status/software-update-urgent.svg'; #software-update-available.svg
63 zenman_false_ico
='/usr/share/icons/gnome/scalable/emotes/face-cool.svg';
64 zenman_refresh_ico
='/usr/share/icons/gnome/scalable/actions/view-refresh.svg';
66 gksu
='gksu'; #gksu/gksudo/...
67 pacman
='/usr/bin/pacman'; #want to use pacman-color, yaourt or powerpill instead?
68 xterm
='xterm'; #xterm/...
69 pacman_refresh
='-Syuw'; # -Sy ?
70 pacman_upgrade
='-Syu'; # -Syuf ?
72 pacman_lock
='/var/lib/pacman/db.lck'; #file to delete, when pacman locked (only if not running)
74 zenman_true
='New package(s) found! ;-)\n\nPacman output follows:\n';
75 zenman_false
='No packages to update. ;-(';
76 zenman_refreshing
='Refreshing pacman database. ;-) Please wait...';
77 zenman_upgrade
="[*] ZenMan will now execute full system upgrade! ;-)\n'$pacman' '$pacman_upgrade'\n\n";
78 zenman_close
='[*] Press [ENTER] to close window...';
79 zenman_config
='[*] Loading configuration from: ';
82 zenman_locked
="ZenMan can't execute system upgrade! ;-(
83 Please stop all pacman related applications and try again.";
85 zenman_start
="ZenMan started! ;-)
87 For more informations please visit:
88 http://blog.harvie.cz/";
90 mkdir
-p "$zenman_configdir"
91 touch "$zenman_configdir/zenman.conf"
92 #read configuration files (can contain localization also)...
95 "$zenman_configdir/zenman.conf"\
97 echo "$zenman_config" "$i";
98 source "$i" >/dev
/null
2>&1;
102 if [ ! -e "$zenman_true_ico" ]; then zenman_true_ico
='warning'; fi;
103 if [ ! -e "$zenman_false_ico" ]; then zenman_false_ico
='info'; fi;
104 if [ ! -e "$zenman_refresh_ico" ]; then zenman_false_ico
='question'; fi;
107 #CODE#########################################
109 if [ -e "$zenman_pid" ]; then
110 kill $
(cat "$zenman_pid") >/dev
/null
2>&1;
111 kill -KILL $
(cat "$zenman_pid") >/dev
/null
2>&1;
113 if [ "$1" == '--stop' ]; then
117 echo "$$" > "$zenman_pid";
120 echo '[i]' "$0" '--stop' to
kill zenman
121 echo '[i]' "$0" '--help' to show
help
122 if "$zenman_splash"; then
123 notify-send
-i info
--expire-time=5000 "$zenman_caption" "$zenman_start";
127 zenman_force_unlock
() {
128 if [ -e "$pacman_lock" ]; then #check if db locked...
129 ps
-eo comm |
grep -i '^\(pacman\|yaourt\|powerpill\|gtkpacman\|pacupdate\|kpacupdate\|guzuta\|YAPG\|Shaman\)' >/dev
/null
; #check if pacman is running...
131 "$gksu" "rm -rf '$pacman_lock'";
133 return 1; #gksu failed ;-(
135 return 0; #unlocked!!!
138 return 1; #pacman is running ;-(
141 return 0; #no locked!!!
146 #uncomment next line if not running -Syuw from cron (and you better set higher zenman_interval)
147 if "$zenman_autorefresh"; then
148 echo -ne "$zenman_refreshing ";
149 zenity
--notification --text "$zenman_refreshing" --window-icon="$zenman_refresh_ico" &
151 "$gksu" "'$pacman' $pacman_refresh --noconfirm" >/dev
/null
2>&1
152 kill $
! >/dev
/null
2>&1;
153 kill -KILL $
! >/dev
/null
2>&1;
156 #check for new packages
157 pacman_new_packages
=$
("$pacman" $pacman_check --noconfirm 2>&1);
161 notify-send
-i info
"$zenman_caption" "$(echo -e "$zenman_true" "$pacman_new_packages")"
162 zenity
--notification --timeout="$zenman_interval" --text "$(echo -e "$zenman_true" "$pacman_new_packages")" --window-icon="$zenman_true_ico";
164 #no packages to update
166 zenity
--notification --timeout="$zenman_interval" --text "$zenman_false" --window-icon="$zenman_false_ico";
169 #run full system upgrade if notification icon clicked
171 #try to unlock pacman db if locked and pacman is not running
176 -T "$zenman_caption"\
177 -e "echo -ne '${zenman_upgrade}'; '$gksu' '\"${pacman}\" $pacman_upgrade'; echo -e '\n${zenman_close}'; $zenman_block";
180 #show error if locked
181 notify-send
-i error
"$zenman_caption" "$zenman_locked";
This page took 1.845978 seconds and 4 git commands to generate.