You are not logged in.

#1 2011-05-16 20:48:23

aericson
Member
Registered: 2011-03-22
Posts: 49

Aarchup a fork from archup

Added a few features to archup that I wanted it to have.
Will share it in the hope that it can be useful to anyone besides me.
I'm not very experienced so any criticism and opinions are welcome.

Edited: I don't have any features in mind so probably no new versions
will come unless someone finds a bug or suggests a feature.

AUR: http://aur.archlinux.org/packages.php?ID=49100
GIT: https://github.com/aericson/aarchup

yTNvg.png

aarchup-1.6.3 (09/07/2011)
    * Bug fixes (Fail to read /etc/pacman.conf when options like ShowSize is uncomment)
aarchup-1.6.2 (08/07/2011)
    * will read /etc/pacman.conf and won't notify for IgnorePkg updates
      You can add aur packages there too probably won't have any trouble.
      Please use IgnorePkg only once and separate packages with space
    * code refactoring
aarchup-1.6.1 (26/06/2011)
    * better debug messages can grep now using "info" or "error"
    * fixed buffer problem where it was not possible to redirect output to a file.
    * fixed bug regarding notification not being showed if it was showed before an enviroment restart.
aarchup-1.6 (22/06/2011)
    * wont notify about new updates when "pacman -Sy" fail, probably you don't have internet connection.
      You can change this behavior with --ignore-disconnect. Forcing the check for updates even after "pacman -Sy" fail.
    * better arguments parsing with getopt(GNU)
    * you can now optionaly use /etc/aarchup.conf instead of passing a bunch of arguments to the command-line.
      Check manpages for details.
aarchup-1.5.7 (04/06/2011)
    * added --ftimeout(with loop-time only) option, workaround for gnome not using --timeout.
    * will close notifications after next run if upgraded system and no notification was found(with loop-time only).
aarchup-1.5.6 (29/05/2011)
    * changed titles for notifications
    * added subdivision for regular updates and AUR updates
    more info: https://bbs.archlinux.org/viewtopic.php … 66#p940866
aarchup-1.5.5 (22/05/2011)
    * bug fixes and edited cronhourly.example
aarchup-1.5.4 (22/05/2011)
    * fixed a bug that was delaying notifications until next run in --loop-time option. thanks lucke
aarchup-1.5.3 (21/05/2011)
    * added -d to print debug info
aarchup-1.5.2 (21/05/2011)
    * fixed typo in cronhourly.example
aarchup-1.5.1 (15/05/2011)
    * fixed memory allocation errors noted by rck at (https://bbs.archlinux.org/viewtopic.php … 32#p875332)
aarchup-1.5 (15/05/2011)
    * added --loop-time flag to allow use without cronjob, check man pages for advantages
    * added default icon
    * added --aur flag to allow checking for updates in AUR. Will need cower installed.
### ORIGINAL ARCHUP ###
archup-1.4
    * added --icon|-p flag to show an icon in the notification
archup-1.3 (03/04/2010)
        * some code cleanup, updated docs, ...
        * added --uid|-i flag to allow dropping the rights if executed as root-cronjob
        * added --command|-c flag to allow a custom updatelist retrival command
        * added --urgency|-u flag to choose the urgencylevel and thus the color of the notification
archup-1.2 (21/03/2010)
        * improved sourcecode documentation
        * added commandline options (--help,--version,--timeout|-tm,--maxentries|-m)
        * moved timeout and maxentries values from compiletime-options to runtime-options
        * replaced the static memory managment with a dynamic one using realloc
        * added manpage
        * added $DESTDIR support in the make install and make uninstall commands
archup-1.1 (20/03/2010)
archup-1.0 (no public release)

Last edited by aericson (2011-08-09 20:39:03)

Offline

#2 2011-05-21 21:26:28

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Aarchup a fork from archup

It's a very nice app, but it doesn't quite work for me. If I use --loop-time, the messages stop showing after some time, even though pacman -Sy commands are run. cron approach also fails - if I manually try running "su $arch_user -c" commands, as given in the example file, it works in the gnome-terminal, not in the virtual console, "su - $arch_user -c" commands don't work at all - the failed attempts return "GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed". I can't quite pinpoint the issue. I'm using gnome 3.

Offline

#3 2011-05-21 21:46:52

aericson
Member
Registered: 2011-03-22
Posts: 49

Re: Aarchup a fork from archup

lucke wrote:

It's a very nice app, but it doesn't quite work for me. If I use --loop-time, the messages stop showing after some time, even though pacman -Sy commands are run. cron approach also fails - if I manually try running "su $arch_user -c" commands, as given in the example file, it works in the gnome-terminal, not in the virtual console, "su - $arch_user -c" commands don't work at all - the failed attempts return "GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed". I can't quite pinpoint the issue. I'm using gnome 3.

What do you get if you run
su - YOUR_USER -c "XAUTHORITY=/home/YOUR_USER/.Xauthority DISPLAY=:0.0 /usr/bin/aarchup --uid $(id -u YOUR_USER) --icon /usr/share/aarchup/archlogo.svg"
in a terminal?
PS:
You will need to type the password of that username.
change YOUR_USER.

and what happens if you run:
/usr/bin/aarchup --loop-time 60 --icon /usr/share/aarchup/archlogo.svg

Also check if there are any updates avaliable in pacman.

Thanks.

Last edited by aericson (2011-05-21 21:47:45)

Offline

#4 2011-05-21 22:12:19

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Aarchup a fork from archup

I've described it in the first post: in the terminal in the running X session I get:

su - lucke -c "XAUTHORITY=/home/lucke/.Xauthority DISPLAY=:0.0 /usr/bin/aarchup --uid $(id -u lucke) --icon /usr/share/aarchup/archlogo.svg"
Password: 

(process:2394): GLib-GObject-CRITICAL **: g_object_unref: assertion `G_IS_OBJECT (object)' failed

"/usr/bin/aarchup --loop-time 60 --icon /usr/share/aarchup/archlogo.svg"  works nicely just after I run it and for some time afterwards, but breaks at some point. Maybe when I suspend and resume? I haven't pinpointed it yet. I've been more or less observing its behaviour since you posted the app. Now I've had it running on my desktop for some time and it stopped showing messages at some point, although pacman -Sy was being run periodically and updates were available. Interestingly, I've just had to kill gnome-shell after resume and aarchup has run and shown the message just afterwards.

Offline

#5 2011-05-21 22:40:22

aericson
Member
Registered: 2011-03-22
Posts: 49

Re: Aarchup a fork from archup

I tried running the "su - user -c" one in different ways to see if I can get the same error message, and it's weird. That command works for me even if I am in tty1(Ctrl+Alt+F1) logged as root. Whenever I change back to :0(Ctrl+Alt+F7) The notification will be there.
The only way for me to get the "assertion `G_IS_OBJECT (object)' failed" message is running /usr/bin/aarchup logged in as root, but that error is expected since there is no display.
I didn't really understand what you said. It did work at gnome-terminal but didn't in virtual console(tty) right?
And about suspension, I haven't notice anything weird about it. The only thing I noticed is that if the screen is locked notifications won't appear(libnotify limitations) however when unlocked they will appear after the next check.

I will keep thinking on how to reproduce the problem that you're having, if you notice anything else please tell me.

Also if it happens again(the loop one) instead of killing gnome-shell try Alt+F2 and type restart. See if aarchup comes back to work after it.

Last edited by aericson (2011-05-21 22:54:17)

Offline

#6 2011-05-21 23:06:25

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Aarchup a fork from archup

"su -" both in the virtual console and in gnome-terminal in X fail with the posted error, "su" (without -) works in X, but not in the virtual console.

I've been trying on two PCs. I will observe more.

For some reason, I can't use the restart/r command in the Alt+F2 prompt on my desktop PC anymore (command not found).

Offline

#7 2011-05-21 23:14:08

aericson
Member
Registered: 2011-03-22
Posts: 49

Re: Aarchup a fork from archup

lucke wrote:

"su -" both in the virtual console and in gnome-terminal in X fail with the posted error, "su" (without -) works in X, but not in the virtual console.

I've been trying on two PCs. I will observe more.

For some reason, I can't use the restart/r command in the Alt+F2 prompt on my desktop PC anymore (command not found).

What about "XAUTHORITY=/home/lucke/.Xauthority DISPLAY=:0.0 /usr/bin/aarchup --uid $(id -u lucke)"?

Offline

#8 2011-05-21 23:25:55

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Aarchup a fork from archup

"XAUTHORITY=/home/lucke/.Xauthority DISPLAY=:0.0 /usr/bin/aarchup --uid $(id -u lucke)" works run both as user and root in gnome-terminal, but running it in the virtual console as either one prints the pasted error.

I've just stumbled upon another error, which I've observed before. I've killed aarchup, changed the loop time to 10 minutes in aarchupstartup.sh and run it. Before 1:00 the only package to be updated was xz, when I restarted aarchup at 1:00 it showed only xz, ten minutes later it showed xz and systemd, but "pacman -Qu" showed that calligre update was also available.

-edit-

I had to kill gnome-shell, because testing in the virtual console broke it for me, and the message surely didn't appear afterwards, at 1:40 (I'm not sure about 1:30, I didn't see any message then, but I was killing gnome-shell around that time).

-edit-

Just a note in case it looks that restarting gnome-shell is the culprit: I have such problems with aarchup on my netbook as well, and I'm not forced to kill gnome-shell there,

Last edited by lucke (2011-05-22 00:13:23)

Offline

#9 2011-05-22 01:30:58

aericson
Member
Registered: 2011-03-22
Posts: 49

Re: Aarchup a fork from archup

I have added -d option to print some information that might help you to found out what is going wrong with the --loop-time option.
It's on AUR version 1.5.3-1
Thanks for trying to found out whats wrong.
I appreciate.

Offline

#10 2011-05-22 11:14:48

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Aarchup a fork from archup

Here's what happened on the desktop, with suspending and killing gnome-shell between the first and second aarchup run.

 DEBUG: loop-time is on, running pacman -Sy                                                                                                                
:: Synchronizing package databases...
 pfkernel                                                                               3.8K  544.9K/s 00:00:00 [-------------------------------------------------------------------] 100%
 testing is up to date
 core is up to date
 extra is up to date
 community-testing is up to date
 community is up to date
DEBUG: Found update calibre 0.8.1-1
DEBUG: Found update systemd 27-1
DEBUG: Found update xz 5.0.2-1
DEBUG: Got updates will show notification
DEBUG: Notification was shown with sucess.
DEBUG: Time now Sun May 22 12:53:47 2011
DEBUG: Next run will be in 10 minutes
DEBUG: loop-time is on, running pacman -Sy
:: Synchronizing package databases...
 pfkernel                                                                               3.8K  557.9K/s 00:00:00 [-------------------------------------------------------------------] 100%
 testing is up to date
 core is up to date
 extra is up to date
 community-testing is up to date
 community is up to date
DEBUG: Found update calibre 0.8.1-1
DEBUG: Found update systemd 27-1
DEBUG: Found update xz 5.0.2-1
DEBUG: Got updates will show notification
DEBUG: Notification failed, reason:
    [2]GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name :1.108 was not provided by any .service files
DEBUG: Time now Sun May 22 13:03:59 2011
DEBUG: Next run will be in 10 minutes
DEBUG: loop-time is on, running pacman -Sy
:: Synchronizing package databases...
 pfkernel                                                                               3.8K  551.1K/s 00:00:00 [-------------------------------------------------------------------] 100%
 testing is up to date
 core is up to date
 extra is up to date
 community-testing is up to date
 community                                                                            444.3K  425.6K/s 00:00:01 [-------------------------------------------------------------------] 100%
DEBUG: Found update calibre 0.8.1-1
DEBUG: Found update systemd 27-1
DEBUG: Found update xz 5.0.2-1
DEBUG: Got updates will show notification

(process:10796): libnotify-CRITICAL **: notify_notification_show: assertion `error == NULL || *error == NULL' failed
DEBUG: Notification failed, reason:
    [2]GDBus.Error:org.freedesktop.DBus.Error.ServiceUnknown: The name :1.108 was not provided by any .service files
DEBUG: Time now Sun May 22 13:14:09 2011
DEBUG: Next run will be in 10 minutes

The suspension alone didn't seem to break it on the netbook. I'll post if I stop getting messages there.

Last edited by lucke (2011-05-22 11:17:09)

Offline

#11 2011-05-22 18:20:22

aericson
Member
Registered: 2011-03-22
Posts: 49

Re: Aarchup a fork from archup

Seems to be a bug with libnotify. Honestly I haven't come across it yet.
Do you use gdm? and also what method do you use to start it at boot(if you do) inittab or daemon?
(https://wiki.archlinux.org/index.php/Di … ay_manager)

Offline

#12 2011-05-22 18:38:58

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Aarchup a fork from archup

I use gdm, started from inittab.

Now I've set my desktop to restart aarchup after resuming and I saw the thing with not showing available updates again - the pacman -Sy was run, the message didn't pop out, but the updates were there. One hour later the message popped out with said updates, but when I actually updated, there was one more additional package to update, which was not mentioned in the message. I didn't manage to see what debug reveals in that case, though, as it was after resuming and restart of aarchup was done in the pm-utils script, i.e. I didn't run it in the terminal and didn't see its output.

There seem to be two issues: restarting gnome-shell stops the messages from popping out and even if the notification part works properly, sometimes it just doesn't trigger when it should or show what it should - perhaps there's some race issue with "pacman -Sy" and triggering notifications?

Offline

#13 2011-05-22 19:07:37

aericson
Member
Registered: 2011-03-22
Posts: 49

Re: Aarchup a fork from archup

Have  you copied the /usr/share/doc/aarchup/aarchup.desktop to  ~/.config/autostart/? that should run aarchup again after gnome-shell restarts.
If you are running archup from a script like /usr/share/aarchup/aarchupstartup.sh you can add >> file at the end to redirect output to a file.
ex:
/usr/bin/aarchup -d --loop-time 60 --aur --icon /usr/share/aarchup/archlogo.svg >> /home/lucke/aarchup.log

Offline

#14 2011-05-22 19:21:26

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Aarchup a fork from archup

I'm not sure if restarting gnome-shell would make it start apps in autostart again.

I know I can log things like that and I guess I will.

I updated my system after aarchup ran at 19:38. The last aarchup ran at 20:38 and I didn't see any message, but "pacman -Qu" shows there are updates available. I suspect I will see a notification about them at 21:38.

Offline

#15 2011-05-22 20:13:06

aericson
Member
Registered: 2011-03-22
Posts: 49

Re: Aarchup a fork from archup

The delay on showing notifications was my fault, sorry about it, new version on aur.
Thanks for the help.

as for the cron.example
try using:
su - $arch_user -c "XAUTHORITY=$(/usr/bin/find /var/run/gdm -path "*${arch_user}*/database") DISPLAY=:0.0 /usr/bin/aarchup --uid $(id -u $arch_user) --icon /usr/share/aarchup/archlogo.svg"

Last edited by aericson (2011-05-23 00:12:12)

Offline

#16 2011-05-29 15:31:16

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Aarchup a fork from archup

Hm, I didn't see your edit, but I've noticed you updated aarchup - good find with gdm, it seems to work fine.

Some other things:

a) I don't know if it's nature of gnome 3 notifications or some aarchup problem, but the notifications don't disappear from the notification bar after timeout.
b) it has aggravated me also in the original archup - the message says "Archlinux", while the distro is called "Arch Linux".
c) I don't know what would work better, but "arch_update_check" next to the icon on the notification bar doesn't sound that great.
d) I don't know how you keep time in --loop-time, but it might nice if it ran shortly after resuming (to give time for the network to connect) if the PC was suspended for longer than the specified --loop-time.

Offline

#17 2011-05-29 22:46:56

aericson
Member
Registered: 2011-03-22
Posts: 49

Re: Aarchup a fork from archup

lucke wrote:

Hm, I didn't see your edit, but I've noticed you updated aarchup - good find with gdm, it seems to work fine.

Some other things:

a) I don't know if it's nature of gnome 3 notifications or some aarchup problem, but the notifications don't disappear from the notification bar after timeout.
b) it has aggravated me also in the original archup - the message says "Archlinux", while the distro is called "Arch Linux".
c) I don't know what would work better, but "arch_update_check" next to the icon on the notification bar doesn't sound that great.
d) I don't know how you keep time in --loop-time, but it might nice if it ran shortly after resuming (to give time for the network to connect) if the PC was suspended for longer than the specified --loop-time.

a) Yep, gnome 3 won't take it into account. Try for example "notify-send --expire-time 30 hello" You will see that it ignores it.
b) Changed it.
c) Changed it.
d) I do use sleep() from unistd.h. What it does is "pause" the program execution for a number of seconds. If the computer goes into suspend the program won't know about it. So for example:
- Would now pause for 10 seconds.
- After 3 seconds(7 left) PC goes into suspended.
- After no matter how long computer comes back from suspension.
- Program still thinks that only 3 seconds(7 seconds) have passed.
- After 7 seconds will run again.
So it is kind of like suspension never have happened.
I could keep track of PC clock time alternating with small sleep times but it's kind of not worth the trouble in my opinion and also would eat a bit more of processing.

The changes you asked will soon be on AUR also if you have --aur option and there are new updates in it, the notification will separate them from regular updates.

Offline

#18 2011-06-04 01:13:58

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Aarchup a fork from archup

It works very nicely for me now, with restarting it on resuming or establishing network connection, so I'd get notifications just after I start using the PC. The only other thing I'd like is to be able to remove the notification after updating, without having to click on it manually. One can use org.freedesktop.Notifications.CloseNotification to close the notification, passing to it the id which is returned when creating the notification. Perhaps it'd be possible to have some switch in the aarchup command to remove its notifications? Well, even exporting the id of the created notification somewhere to the filesystem would do it for me, because the id is all I need to remove it. The only way I've found so far to get the id is to grab it when creating the notification.

Last edited by lucke (2011-06-04 01:14:28)

Offline

#19 2011-06-04 01:20:16

aericson
Member
Registered: 2011-03-22
Posts: 49

Re: Aarchup a fork from archup

lucke wrote:

It works very nicely for me now, with restarting it on resuming or establishing network connection, so I'd get notifications just after I start using the PC. The only other thing I'd like is to be able to remove the notification after updating, without having to click on it manually. One can use org.freedesktop.Notifications.CloseNotification to close the notification, passing to it the id which is returned when creating the notification. Perhaps it'd be possible to have some switch in the aarchup command to remove its notifications? Well, even exporting the id of the created notification somewhere to the filesystem would do it for me, because the id is all I need to remove it. The only way I've found so far to get the id is to grab it when creating the notification.

Would closing it in 'next check' for updates when there aren't any updates be good?

Offline

#20 2011-06-04 01:24:44

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Aarchup a fork from archup

Yeah, it'd be a step forward. That wouldn't be really needed if those notifications could timeout - I kind of wonder why gnome 3 doesn't support that. I guess it's either "persistent" or "transient" for them, without middle ground.

Offline

#21 2011-06-04 04:04:30

Rasi
Member
From: Germany
Registered: 2007-08-14
Posts: 1,839
Website

Re: Aarchup a fork from archup

lucke wrote:

Yeah, it'd be a step forward. That wouldn't be really needed if those notifications could timeout - I kind of wonder why gnome 3 doesn't support that. I guess it's either "persistent" or "transient" for them, without middle ground.

But transient notifications can have a defined timeout:

notify-send --hint=int:transient:1 -t 2000 "bla" "blub"

Last edited by Rasi (2011-06-04 04:05:24)


He hoped and prayed that there wasn't an afterlife. Then he realized there was a contradiction involved here and merely hoped that there wasn't an afterlife.

Douglas Adams

Offline

#22 2011-06-04 04:09:53

aericson
Member
Registered: 2011-03-22
Posts: 49

Re: Aarchup a fork from archup

Rasi wrote:
lucke wrote:

Yeah, it'd be a step forward. That wouldn't be really needed if those notifications could timeout - I kind of wonder why gnome 3 doesn't support that. I guess it's either "persistent" or "transient" for them, without middle ground.

But transient notifications can have a defined timeout:

notify-send --hint=int:transient:1 -t 2000 "bla" "blub"
notify-send --hint=int:transient:1 "bla" "blub"

and

notify-send --hint=int:transient:1 -t 999999999 "bla" "blub"

last same amount of time here(5 secs or so).

Last edited by aericson (2011-06-04 04:10:46)

Offline

#23 2011-06-04 04:12:50

aericson
Member
Registered: 2011-03-22
Posts: 49

Re: Aarchup a fork from archup

On 1.5.7 if you upgrade your system, the notification will be closed on next iteration of loop-time(no updates found).
Also added --ftimeout [value] flag that should work.
A few notes about this option:
    - Just use it if --timeout does not work for you
    - Don't use it without(or before) --loop-time
            (will fix the before part eventually)
    - The value of it has to be less than --loop-time value
Hope it helps.

Last edited by aericson (2011-06-04 04:34:54)

Offline

#24 2011-06-04 10:14:06

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Aarchup a fork from archup

Thanks, I'll see how it works for me.

Offline

#25 2011-06-22 23:22:20

lucke
Member
From: Poland
Registered: 2004-11-30
Posts: 4,018

Re: Aarchup a fork from archup

When I asked Rorschach for a way to deal with packages in IgnorePkg, he added the -c option to archup, but I didn't really figure out a nice way to filter those ignored packages out then and decided against using archup anyway. Now I have things in IgnorePkg again and it forces me to stop using aarchup. Perhaps you could add some option allowing to filter them out to aarchup itself or maybe you have an idea for a (shell) script returning contents of pacman -Qu without ignored packages?

Offline

Board footer

Powered by FluxBB