You are not logged in.
Pages: 1
I like my status bar in dwm displaying the number of pacman updates available. Its a nice constant reminder bugging me to update my system every once in a while.
At first, I simply had something like this in my status bar script "dwm-status":
sudo pacman -Qu | wc -l
This always displayed 0 updates because I was not syncing my local database. So I added something like this to .xinitrc:
sudo pacman -Sy
This did not work because sudo required a password, so I added something like this to my sudoers file:
%wheel NOPASSWD: /bin/pacman
Staying logged into X11, this was useless, so I made it a daily cron job, which is my current solution.
I'm worried about this being unsafe as described in here: https://bbs.archlinux.org/viewtopic.php?id=89328
This thread: https://bbs.archlinux.org/viewtopic.php?id=89484 discusses this topic a bit, and provides an ugly solution. something like this:
dir=/tmp/somedir
if [ ! -d ${dir}]
makedir ${dir}
sudo pacman -Sy --dbpath
ln -s /var/lib/pacman/local /tmp/somedir
sudo pacman -Qu --dbpath /tmp/somedir | wc -l
rm -r ${dir}
oh man is that messy for something that I feel like should be one line. Anyone have any better suggestion?
bonus:
a solution that allows me to take that nopasswd line out of my sudoers file
a solution that works with yoaurt too
EDIT: Formatting, spelling, etc..
Last edited by firyice (2011-06-02 18:21:12)
Offline
You don't need sudo for 'pacman -Qu'.
Offline
You don't need sudo for 'pacman -Qu'.
good call. still need it for 'pacman -Sy' though
Offline
I have pacman -Sy as a cronjob; just make sure to run -Syu (if there are updates) before installing anything and you shouldn't run into any problems. On the other hand, you can not bother updating and just be ready for breakage
Offline
I have pacman -Sy as a cronjob; just make sure to run -Syu (if there are updates) before installing anything
Umm, 'pacman -Syu' already installs packages, so the only thing that needs to be updated are the packages from AUR.
I think updating once a week is enough. You should always take care when updating so you may want to check the MLs, bugtarcker and forums beforehand.
Offline
ebirtaid wrote:I have pacman -Sy as a cronjob; just make sure to run -Syu (if there are updates) before installing anything
Umm, 'pacman -Syu' already installs packages, so the only thing that needs to be updated are the packages from AUR.
I mean run pacman -Syu before running pacman -S foo. If you have pacman -Sy as a cronjob and it shows updates, and you run pacman -S foo after the cronjob'd pacman -Sy but before pacman -Syu, then it is the equivalent of running pacman -Sy foo.
E: also it's been a while since I have used yaourt but wouldn't yaourt -Syu --aur display the amount of packages to be updated between both the repos and aur or just the aur packages?
Ex2: In any event if you install cower you can get what aur packages need to be updated with cower -u. Then if you put pacman -Sy as a cronjob and use 'sudo pacman -Qu | wc -l' to get the avilable pacman updates, you can then use 'cower -u|wc -l' to get the aur updates count to display as well.
Last edited by ebirtaid (2011-06-02 18:52:08)
Offline
http://code.google.com/p/pacupdate/ - I don't think it's all that unsafe, so why not give it a shot?
Offline
I have pacman -Sy as a cronjob; just make sure to run -Syu (if there are updates) before installing anything and you shouldn't run into any problems.
This is the solution I already have. As I stated, I'm hoping for a safer solution.
http://code.google.com/p/pacupdate/ - I don't think it's all that unsafe, so why not give it a shot?
I currently am running dwm without any system tray application. I'd prefer not to use a system tray if I can avoid it.
Last edited by firyice (2011-06-02 19:06:10)
Offline
pacupdate seems to do the same thing you are doing anyway, from the site:
Fetches ArchLinux package lists using pacman -Sy and parses output of pacman -Qu
The other way to do it using the code from your first post would be to create a directory in your home directory like ~/pacupdate. Run 'ln -s /var/lib/pacman/local ~/pacupdate'. Change the cronjob to 'pacman -Sy --dbpath /home/user/pacupdate' and the other to 'pacman -Qu --dbpath /home/user/pacupdate|wc -l' and in theory it should all work.
Offline
The other way to do it using the code from your first post would be to create a directory in your home directory like ~/pacupdate. Run 'ln -s /var/lib/pacman/local ~/pacupdate'. Change the cronjob to 'pacman -Sy --dbpath /home/user/pacupdate' and the other to 'pacman -Qu --dbpath /home/user/pacupdate|wc -l' and in theory it should all work.
So far, this seems like the best option
Last edited by firyice (2011-06-03 12:50:00)
Offline
why is it unsafe to do pacman -Sy in root's cronjob
and have your user's cronjob do pacman -Q without sudo?
Offline
why is it unsafe to do pacman -Sy in root's cronjob
and have your user's cronjob do pacman -Q without sudo?
because if a user runs 'pacman -S foo' after a sync, but before an update, pacman can bring in dependencies based upon a newer pacman database, which your system is not fully updated to. This can break programs. There is a more in-depth discussion on this in the two threads I linked to in the original post.
Offline
Pages: 1