[HowTo] Displaying packages needed to be updated

Discussions Regarding Software

Moderator: Moderators

[HowTo] Displaying packages needed to be updated

Postby Ryuno-Ki » Sat Dec 15, 2012 22:59

The following script works with equo-152 or higher.

Code: Select all
#!/usr/bin/env bash
UPD="$(equo query updates)"
UP="$(echo $UPD|cut -d':' -f3)"
echo "$UP" packages needed to be updated!


I split the command, because equo needs some time for executing.
You can embed it into conky for example. Maybe you just want to print $UP.
Oh, and don't forget to make the script (here: .packageupdate.sh) executable:

Code: Select all
chmod u+x .packageupdate.sh


Enjoy!
HP-Pavilion ◆ AMD Athlon™ 64 Processor 4000+ ◆ GeForce 6150SE nForce 430 ◆ 1 GiB RAM
German Wiki translator ◆ Want to contribute on the wiki? Ask the Bureaucrats!
Please, mark solved threads ◆ Posts unread and unansweredPackage requests ◆ Sabayon XI with MATE
Ryuno-Ki
Technological Hen
 
Posts: 411
Joined: Mon Feb 27, 2012 22:15
Location: Southern Germany

Re: [HowTo] Displaying packages needed to be updated

Postby svantoviit » Sun Dec 16, 2012 9:04

Hi Ryuno-Ki,

your script shows "Packages to remove". See below:

Before upgrade:
Code: Select all
$ equo query updates
>>  @@ Available Updates
>>  Packages to update:  39
>>  Packages to remove:  42
$ packageupdate.sh
 42 packages needed to be updated!

After upgrade:
Code: Select all
$equo query updates
>>  @@ Available Updates
>>  Packages to update:  0
>>  Packages to remove:  43
$ packageupdate.sh
 43 packages needed to be updated!


You actually need to get the second line line of the equo query output: "Packages to update".

Edit: So I altered the script a little bit
Code: Select all
#!/bin/bash
UP="$(equo query updates | awk 'NR==2 {print $5}')"
echo "$UP" packages needed to be updated!

...but you don't need to do anything like that, it's enough to run equo query with the -q argument for quiet output:
Code: Select all
equo query updates -q
0
User avatar
svantoviit
Technological Hen
 
Posts: 396
Joined: Sun Feb 28, 2010 17:55
Location: Europe

Re: [HowTo] Displaying packages needed to be updated

Postby Ryuno-Ki » Mon Dec 17, 2012 6:54

Oops!
Yes, you're right. Thanks for the hint!
HP-Pavilion ◆ AMD Athlon™ 64 Processor 4000+ ◆ GeForce 6150SE nForce 430 ◆ 1 GiB RAM
German Wiki translator ◆ Want to contribute on the wiki? Ask the Bureaucrats!
Please, mark solved threads ◆ Posts unread and unansweredPackage requests ◆ Sabayon XI with MATE
Ryuno-Ki
Technological Hen
 
Posts: 411
Joined: Mon Feb 27, 2012 22:15
Location: Southern Germany


Return to Software in General

Who is online

Users browsing this forum: No registered users and 2 guests