slapt-get : Retrieve a list o updated packages not as root

Other talk about Salix
Post Reply
User avatar
zAchAry
Posts: 804
Joined: 11. May 2010, 09:02
Location: Israel

slapt-get : Retrieve a list o updated packages not as root

Post 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?
Last edited by zAchAry on 30. Apr 2011, 11:36, edited 1 time in total.
Image
Help to make Slackware easier Donate to Salix
User avatar
gapan
Salix Wizard
Posts: 6354
Joined: 6. Jun 2009, 17:40

Re: Retrieve a list o updated packages not as root

Post by gapan »

You can setup sudo so that it doesn't ask for a root password for that particular command.
Image
Image
User avatar
JRD
Salix Warrior
Posts: 950
Joined: 7. Jun 2009, 22:52
Location: Lyon, France

Re: Retrieve a list o updated packages not as root

Post by JRD »

Code: Select all

/usr/sbin/slapt-get -s --upgrade
Image
User avatar
zAchAry
Posts: 804
Joined: 11. May 2010, 09:02
Location: Israel

Re: Retrieve a list o updated packages not as root

Post by zAchAry »

Edit: Originally Posted: 1. Sep 2010, 12:32
JRD wrote:

Code: Select all

/usr/sbin/slapt-get -s --upgrade
Yup, 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

/usr/bin/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
Image
Help to make Slackware easier Donate to Salix
User avatar
zAchAry
Posts: 804
Joined: 11. May 2010, 09:02
Location: Israel

Re: slapt-get : Retrieve a list o updated packages not as ro

Post 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?
Image
Help to make Slackware easier Donate to Salix
Post Reply