Page 1 of 1
slapt-get : Retrieve a list o updated packages not as root
Posted: 30. Aug 2010, 20:23
by zAchAry
Is there a way to get a list of available updated packages with slapt-get or something else without the root privilege?
This is a script I used with Conky far back at Ubuntu (from:
Conky Hardcore!)
Code: Select all
#!/bin/bash
# Conky script for displaying available updates
# in Debian. This script assumes you are in the
# sudo group and require no password for root
# access. Add something as such to your conkyrc:
#${color}APT: ${color D7D3C5}${execi 28800 ~/bin/debupdates.sh}
sudo apt-get -qy update > /dev/null
NUMOFUPDATES=$(aptitude search "~U" | wc -l)
echo $NUMOFUPDATES Updates
I could use it without the command that is requiring a root privilege since the update process occurred automatically by default, and I only needed to update the existed list, and in order to get that list there is no need to be root.
Solutions?
Re: Retrieve a list o updated packages not as root
Posted: 30. Aug 2010, 20:26
by gapan
You can setup sudo so that it doesn't ask for a root password for that particular command.
Re: Retrieve a list o updated packages not as root
Posted: 1. Sep 2010, 11:27
by JRD
Re: Retrieve a list o updated packages not as root
Posted: 1. Oct 2010, 14:02
by zAchAry
Edit: Originally Posted: 1. Sep 2010, 12:32Yup, I was figuring it out a little while after George gave me his answer, and I
needed to investigate that earlier before submitting that in the forum, sorry about that.
Edit: Can also be found at line 39 of the zenity bash script salix-update-notifier.Code: Select all
if [[ `LANG=C /usr/sbin/slapt-get -s --upgrade | grep "Need to get"` ]]
[/i]
In return, I'll post a script, when I'll have the time, to display:
Code: Select all
The following packages have been EXCLUDED:
xf86-video-intel
The following packages will be upgraded:
gigolo
1 upgraded, 0 reinstalled, 0 newly installed, 0 to remove and 1 not upgraded.
Need to get 102.0kB of archives.
After unpacking 16.0kB disk space will be freed.
gigolo-0.4.0-i486-1gv is to be upgraded to version 0.4.1-i486-1gv
Done
in an ordered way (with the
tail and head commands) for Conky, with and without the excluded packages.
Thank you very much for replying.
Edit: A script to be used with conky. It can be better, though, displaying update when one package is available and updates when more than one update is available or displaying a shiny star (e.g. the letter "i" of the font poky click here) when update(s) available and nothing when there are no updates.Code: Select all
#!/bin/bash
# Conky script for displaying available updates in
# Salix OS. Add something as such to your conkyrc:
#${alignc}${if_match ${execi 80000 .scripts/slapt-get_updates.sh} != 0}Updates available${else}System is up to date!${endif}
NUMOFUPDATES=$(/usr/sbin/slapt-get -s --upgrade | grep version | wc -l)
echo $NUMOFUPDATES
Re: slapt-get : Retrieve a list o updated packages not as ro
Posted: 30. Apr 2011, 11:49
by zAchAry
I'm not sure whether it is a bug with Conky or a problem with my configurations.
Bash script
Code: Select all
#!/bin/bash
# Conky script for displaying available updates in
# Salix OS. Add something as such to your conkyrc:
# ${color}slapt-get: ${color2}${execi 1800 ~/bin/slaptupdates.sh}
#
# http://www.salixos.org/forum/viewtopic.php?f=24&t=1188
NUMOFUPDATES=$(/usr/sbin/slapt-get -s --upgrade | grep version | wc -l)
echo $NUMOFUPDATES
Conkyrc:
Code: Select all
${if_match ${execi 1800 slaptupdates.sh} != 0}U-${execi 1800 slaptupdates.sh}${endif}
Conky will sometimes display just:
U-
It should not display it, of course, because the number of updates is zero.
Does anybody has a solution to show the number of updates with Conky?