Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.debian.user > #191051 > unrolled thread

scriptable way to list packages that are not installed

Started byVasyl Vavrychuk <vvavrychuk@gmail.com>
First post2018-01-14 05:00 +0100
Last post2018-01-14 16:00 +0100
Articles 17 — 12 participants

Back to article view | Back to linux.debian.user


Contents

  scriptable way to list packages that are not installed Vasyl Vavrychuk <vvavrychuk@gmail.com> - 2018-01-14 05:00 +0100
    Re: scriptable way to list packages that are not installed john doe <johndoe65534@mail.com> - 2018-01-14 07:40 +0100
      Re: scriptable way to list packages that are not installed john doe <johndoe65534@mail.com> - 2018-01-14 07:50 +0100
        Re: scriptable way to list packages that are not installed Vasyl Vavrychuk <vvavrychuk@gmail.com> - 2018-01-14 21:20 +0100
          Re: scriptable way to list packages that are not installed Michael Lange <klappnase@freenet.de> - 2018-01-14 23:10 +0100
          Re: scriptable way to list packages that are not installed davidson <davidson@freevolt.org> - 2018-01-16 20:40 +0100
            Re: scriptable way to list packages that are not installed davidson@freevolt.org - 2018-01-16 21:00 +0100
              Re: scriptable way to list packages that are not installed Charlie Gibbs <cgibbs@surfnaked.ca> - 2018-01-17 03:20 +0100
                Re: scriptable way to list packages that are not installed The Wanderer <wanderer@fastmail.fm> - 2018-01-17 05:20 +0100
                  Re: scriptable way to list packages that are not installed John Hasler <jhasler@newsguy.com> - 2018-01-17 05:50 +0100
                Re: scriptable way to list packages that are not installed Darac Marjal <mailinglist@darac.org.uk> - 2018-01-17 20:40 +0100
                  Re: scriptable way to list packages that are not installed davidson <davidson@freevolt.org> - 2018-01-17 21:10 +0100
                  Re: scriptable way to list packages that are not installed Charlie Gibbs <cgibbs@surfnaked.ca> - 2018-01-18 07:20 +0100
            Re: scriptable way to list packages that are not installed davidson <davidson@freevolt.org> - 2018-01-16 22:40 +0100
    Re: scriptable way to list packages that are not installed Eduardo M KALINOWSKI <eduardo@kalinowski.com.br> - 2018-01-14 11:40 +0100
    Re: scriptable way to list packages that are not installed Roberto C. Sánchez <roberto@debian.org> - 2018-01-14 14:00 +0100
    Re: scriptable way to list packages that are not installed Bernd Gruber <begruber@mnet-online.de> - 2018-01-14 16:00 +0100

#191051 — scriptable way to list packages that are not installed

FromVasyl Vavrychuk <vvavrychuk@gmail.com>
Date2018-01-14 05:00 +0100
Subjectscriptable way to list packages that are not installed
Message-ID<v7HCF-6FF-1@gated-at.bofh.it>
I would like to list not installed packages in my script. Currently I do

    dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n'
$PACKAGES | grep -v "^ii" | awk '{print $2}'

Problem is that dpkg-query outputs information about no matching
packages in stderr in a not suitable for scripts way, for example

    dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n' git gawk cmake
    un cmake
    ii git
    dpkg-query: no packages found matching gawk

I there any scriptable way to get information about unmatching packages?

Thanks in advance,
Vasyl

[toc] | [next] | [standalone]


#191054

Fromjohn doe <johndoe65534@mail.com>
Date2018-01-14 07:40 +0100
Message-ID<v7K7v-8kR-1@gated-at.bofh.it>
In reply to#191051
On 1/14/2018 4:52 AM, Vasyl Vavrychuk wrote:
> I would like to list not installed packages in my script. Currently I do
> 
>      dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n'
> $PACKAGES | grep -v "^ii" | awk '{print $2}'
> 

As an aside; you don't need grep in this command:

$ <CMD> | awk '!/^ii/{print $2}'

> Problem is that dpkg-query outputs information about no matching
> packages in stderr in a not suitable for scripts way, for example
> 
>      dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n' git gawk cmake
>      un cmake
>      ii git
>      dpkg-query: no packages found matching gawk
> 
> I there any scriptable way to get information about unmatching packages?
> 

You could try to redirect STDERR  to STDOUT:

$ dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n' git gawk 
cmake 2>&1 | awk '{print $6}'
git
gawk
cmake

Note that my mailer is folding the command.

-- 
John Doe

[toc] | [prev] | [next] | [standalone]


#191055

Fromjohn doe <johndoe65534@mail.com>
Date2018-01-14 07:50 +0100
Message-ID<v7Khb-8o5-3@gated-at.bofh.it>
In reply to#191054
On 1/14/2018 7:28 AM, john doe wrote:
> On 1/14/2018 4:52 AM, Vasyl Vavrychuk wrote:
>> I would like to list not installed packages in my script. Currently I do
>>
>>      dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n'
>> $PACKAGES | grep -v "^ii" | awk '{print $2}'
>>
> 
> As an aside; you don't need grep in this command:
> 
> $ <CMD> | awk '!/^ii/{print $2}'
> 
>> Problem is that dpkg-query outputs information about no matching
>> packages in stderr in a not suitable for scripts way, for example
>>
>>      dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n' git 
>> gawk cmake
>>      un cmake
>>      ii git
>>      dpkg-query: no packages found matching gawk
>>
>> I there any scriptable way to get information about unmatching packages?
>>
> 
> You could try to redirect STDERR  to STDOUT:
> 
> $ dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n' git gawk 
> cmake 2>&1 | awk '{print $6}'
> git
> gawk
> cmake
> 
> Note that my mailer is folding the command.
> 

$ dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n' awk git gawk 
cmake 2>&1 | awk '!/^ii/ || !/^un/{print $6}'
git
gawk
cmake

-- 
John Doe

[toc] | [prev] | [next] | [standalone]


#191096

FromVasyl Vavrychuk <vvavrychuk@gmail.com>
Date2018-01-14 21:20 +0100
Message-ID<v7WV4-85f-5@gated-at.bofh.it>
In reply to#191055
Hi, John,

On Sun, Jan 14, 2018 at 8:48 AM, john doe <johndoe65534@mail.com> wrote:
> On 1/14/2018 7:28 AM, john doe wrote:
>
> $ dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n' awk git gawk
> cmake 2>&1 | awk '!/^ii/ || !/^un/{print $6}'
> git
> gawk
> cmake

I also tried to parse stderr, but then I realized that relying on the output

   dpkg-query: no packages found matching

is not correct since it might be localized and is not suitable for scripting.

[toc] | [prev] | [next] | [standalone]


#191102

FromMichael Lange <klappnase@freenet.de>
Date2018-01-14 23:10 +0100
Message-ID<v7YDv-KC-1@gated-at.bofh.it>
In reply to#191096
Hi,

On Sun, 14 Jan 2018 22:18:26 +0200
Vasyl Vavrychuk <vvavrychuk@gmail.com> wrote:

> Hi, John,
> 
> On Sun, Jan 14, 2018 at 8:48 AM, john doe <johndoe65534@mail.com> wrote:
> > On 1/14/2018 7:28 AM, john doe wrote:
> >
> > $ dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n' awk git
> > gawk cmake 2>&1 | awk '!/^ii/ || !/^un/{print $6}'
> > git
> > gawk
> > cmake
> 
> I also tried to parse stderr, but then I realized that relying on the
> output
> 
>    dpkg-query: no packages found matching
> 
> is not correct since it might be localized and is not suitable for
> scripting.

if you need the English output messages you can get these simply with

LC_ALL=C dpkg-query ...

Maybe you could alternatively use the apt list command (however it
should be noted that the developers still say the apt command
should be used only with care in scripts (see man apt)).

The output of apt list here looks like:

$ LC_ALL=C apt list gawk git cmake konsole foobar 2> /dev/null | grep installed
cmake/stable,now 3.7.2-1 amd64 [installed]
gawk/stable,now 1:4.1.4+dfsg-1 amd64 [installed]
git/stable,stable,now 1:2.11.0-3+deb9u2 amd64 [installed]

$ LC_ALL=C apt list gawk git cmake konsole foobar 2> /dev/null | grep -v installed
Listing...
konsole/stable 4:16.12.0-4 amd64

The non-existing "foobar" package simply appears in neither of these
commands' output.
Not sure what exactly you want to achieve, maybe this might be a way to go.

Best regards

Michael

.-.. .. ...- .   .-.. --- -. --.   .- -. -..   .--. .-. --- ... .--. . .-.

You're too beautiful to ignore.  Too much woman.
		-- Kirk to Yeoman Rand, "The Enemy Within", stardate
                   unknown

[toc] | [prev] | [next] | [standalone]


#191205

Fromdavidson <davidson@freevolt.org>
Date2018-01-16 20:40 +0100
Message-ID<v8Ffr-4O1-7@gated-at.bofh.it>
In reply to#191096
On Sun, 14 Jan 2018, Vasyl Vavrychuk wrote:

> Hi, John,
>
> On Sun, Jan 14, 2018 at 8:48 AM, john doe <johndoe65534@mail.com> wrote:
>> On 1/14/2018 7:28 AM, john doe wrote:
>>
>> $ dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n' awk git gawk
>> cmake 2>&1 | awk '!/^ii/ || !/^un/{print $6}'
>> git
>> gawk
>> cmake
>
> I also tried to parse stderr, but then I realized that relying on the output
>
>   dpkg-query: no packages found matching
>
> is not correct since it might be localized and is not suitable for scripting.

You could just discard the stderr, and take the complement of the hits
from dpkg-query, relative to the supplied arguments:

show-installed () {
     dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n' "$@" |
     awk '/^ii/ {print $2}'
}

show-absent () {
     universe=("$@")
     diff <( IFS=$'\n' ; sort <<<"${universe[*]}" ) \
 	<( show-installed "${universe[@]}" 2>/dev/null ) |
     sed -n 's/^< //p'
}

$ dpkg-query -l not-a-real-package exim4 mksh xorg bash xterm chromium
Desired=Unknown/Install/Remove/Purge/Hold
| Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
|/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
||/ Name                   Version          Architecture     Description
+++-======================-================-================-=================================================
ii  bash                   4.4-5            amd64            GNU Bourne Again SHell
un  exim4                  <none>           <none>           (no description available)
ii  mksh                   54-2+b4          amd64            MirBSD Korn Shell
ii  xorg                   1:7.7+19         amd64            X.Org X Window System
ii  xterm                  327-2            amd64            X terminal emulator
dpkg-query: no packages found matching not-a-real-package
dpkg-query: no packages found matching chromium

$ show-installed !*
show-installed not-a-real-package exim4 mksh xorg bash xterm chromium
dpkg-query: no packages found matching not-a-real-package
dpkg-query: no packages found matching chromium
bash
mksh
xorg
xterm

$ show-absent !*
show-absent not-a-real-package exim4 mksh xorg bash xterm chromium
chromium
exim4
not-a-real-package

(It is above my pay grade to tell whether "sort" needs its flags
tweaked to sort identically to dpkg on arbitary package names.)

[toc] | [prev] | [next] | [standalone]


#191206

Fromdavidson@freevolt.org
Date2018-01-16 21:00 +0100
Message-ID<v8FyN-4Uy-5@gated-at.bofh.it>
In reply to#191205
On Tue, 16 Jan 2018, davidson wrote:

> On Sun, 14 Jan 2018, Vasyl Vavrychuk wrote:
>
>> Hi, John,
>> 
>> On Sun, Jan 14, 2018 at 8:48 AM, john doe <johndoe65534@mail.com> wrote:
>>> On 1/14/2018 7:28 AM, john doe wrote:
>>> 
>>> $ dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n' awk git gawk
>>> cmake 2>&1 | awk '!/^ii/ || !/^un/{print $6}'
>>> git
>>> gawk
>>> cmake
>> 
>> I also tried to parse stderr, but then I realized that relying on the 
>> output
>>
>>   dpkg-query: no packages found matching
>> 
>> is not correct since it might be localized and is not suitable for 
>> scripting.
>
> You could just discard the stderr, and take the complement of the hits
> from dpkg-query, relative to the supplied arguments:
>
> show-installed () {
>    dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n' "$@" |
>    awk '/^ii/ {print $2}'
> }
>
> show-absent () {
>    universe=("$@")
>    diff <( IFS=$'\n' ; sort <<<"${universe[*]}" ) \
> 	<( show-installed "${universe[@]}" 2>/dev/null ) |
>    sed -n 's/^< //p'
> }
>
> $ dpkg-query -l not-a-real-package exim4 mksh xorg bash xterm chromium

Er, the history expansions entered at the two prompts below don't work
as shown, with the command line at the prompt immediately above.

If you must know, (and you don't, but I'll tell you anyway!) in
actuality I used a one-word alias defined as "dpkg-query -l", which
prevented the "-l" flag from getting included in the "!*" expansions.

Is there a natural law or something, that every email message sent
must contain at least one distracting error that is totally beside the
point?

Anyways, over and out.

> Desired=Unknown/Install/Remove/Purge/Hold
> | 
> Status=Not/Inst/Conf-files/Unpacked/halF-conf/Half-inst/trig-aWait/Trig-pend
> |/ Err?=(none)/Reinst-required (Status,Err: uppercase=bad)
> ||/ Name                   Version          Architecture     Description
> +++-======================-================-================-=================================================
> ii  bash                   4.4-5            amd64            GNU Bourne Again 
> SHell
> un  exim4                  <none>           <none>           (no description 
> available)
> ii  mksh                   54-2+b4          amd64            MirBSD Korn 
> Shell
> ii  xorg                   1:7.7+19         amd64            X.Org X Window 
> System
> ii  xterm                  327-2            amd64            X terminal 
> emulator
> dpkg-query: no packages found matching not-a-real-package
> dpkg-query: no packages found matching chromium
>
> $ show-installed !*
> show-installed not-a-real-package exim4 mksh xorg bash xterm chromium
> dpkg-query: no packages found matching not-a-real-package
> dpkg-query: no packages found matching chromium
> bash
> mksh
> xorg
> xterm
>
> $ show-absent !*
> show-absent not-a-real-package exim4 mksh xorg bash xterm chromium
> chromium
> exim4
> not-a-real-package
>
> (It is above my pay grade to tell whether "sort" needs its flags
> tweaked to sort identically to dpkg on arbitary package names.)
>

[toc] | [prev] | [next] | [standalone]


#191218

FromCharlie Gibbs <cgibbs@surfnaked.ca>
Date2018-01-17 03:20 +0100
Message-ID<v8Luy-rE-3@gated-at.bofh.it>
In reply to#191206
On 16/01/18 12:15 PM, davidson@freevolt.org wrote:

> Is there a natural law or something, that every email message sent
> must contain at least one distracting error that is totally beside the
> point?
>
> Anyways, over and out.

"Over" means "My transmission is finished; I expect a reply."
"Out" means "My transmission is finished; I do not expect a reply."

One more distracting error... :-)

-- 
cgibbs@surfnaked.ca (Charlie Gibbs)

[toc] | [prev] | [next] | [standalone]


#191219

FromThe Wanderer <wanderer@fastmail.fm>
Date2018-01-17 05:20 +0100
Message-ID<v8NmF-1K1-1@gated-at.bofh.it>
In reply to#191218

[Multipart message — attachments visible in raw view] — view raw

On 2018-01-16 at 21:17, Charlie Gibbs wrote:

> On 16/01/18 12:15 PM, davidson@freevolt.org wrote:
> 
>> Is there a natural law or something, that every email message sent
>> must contain at least one distracting error that is totally beside the
>> point?
>>
>> Anyways, over and out.
> 
> "Over" means "My transmission is finished; I expect a reply."
> "Out" means "My transmission is finished; I do not expect a reply."
> 
> One more distracting error... :-)

I usually think of "Over and out" as being effectively equivalent to
"You can respond if you want to, but I'm not going to be listening".

-- 
   The Wanderer

The reasonable man adapts himself to the world; the unreasonable one
persists in trying to adapt the world to himself. Therefore all
progress depends on the unreasonable man.         -- George Bernard Shaw

[toc] | [prev] | [next] | [standalone]


#191220

FromJohn Hasler <jhasler@newsguy.com>
Date2018-01-17 05:50 +0100
Message-ID<v8NPH-1UY-1@gated-at.bofh.it>
In reply to#191219
The Wanderer writes:
> I usually think of "Over and out" as being effectively equivalent to
> "You can respond if you want to, but I'm not going to be listening".

If I say that I mean "I am done transmitting.  I will listen for your
final transmission."  If you have nothing more to say you should respond
with "Roger  Out" or possibly just "Out."

If I was done transmitting and did not expect a reply I would simply end
my transmission with "Out." You would then not respond at all.
-- 
John Hasler 
jhasler@newsguy.com
Elmwood, WI USA

[toc] | [prev] | [next] | [standalone]


#191233

FromDarac Marjal <mailinglist@darac.org.uk>
Date2018-01-17 20:40 +0100
Message-ID<v91IZ-3m9-11@gated-at.bofh.it>
In reply to#191218

[Multipart message — attachments visible in raw view] — view raw

On 17/01/18 02:17, Charlie Gibbs wrote:
> On 16/01/18 12:15 PM, davidson@freevolt.org wrote:
>
>> Is there a natural law or something, that every email message sent
>> must contain at least one distracting error that is totally beside the
>> point?
>>
>> Anyways, over and out.
>
> "Over" means "My transmission is finished; I expect a reply."
> "Out" means "My transmission is finished; I do not expect a reply."
>
> One more distracting error... :-)
>
Surely it depends on your context. If you're communicating over a radio,
then sure, they mean what you mean. But perhaps it's a quotation
(wiktionary states that "over and out" is mostly used in TV and films).
Perhaps it's a reference to cricket (as in "The over is complete, AND
the batsman is out").

[toc] | [prev] | [next] | [standalone]


#191234

Fromdavidson <davidson@freevolt.org>
Date2018-01-17 21:10 +0100
Message-ID<v92c1-3MU-3@gated-at.bofh.it>
In reply to#191233
On Wed, 17 Jan 2018, Darac Marjal wrote:
> On 17/01/18 02:17, Charlie Gibbs wrote:
>> On 16/01/18 12:15 PM, davidson@freevolt.org wrote:
>>
>>> Is there a natural law or something, that every email message sent
>>> must contain at least one distracting error that is totally beside
>>> the point?
>>>
>>> Anyways, over and out.
>>
>> "Over" means "My transmission is finished; I expect a reply."

Ah. Like on television news shows: "Over to you, Chris!"

>> "Out" means "My transmission is finished; I do not expect a reply."

Got it.

>> One more distracting error... :-)

Noooes! It's errors all the way down!

Making errors, so I can learn from them, so I can make more errors....

> Surely it depends on your context. If you're communicating over a
> radio, then sure, they mean what you mean. But perhaps it's a
> quotation (wiktionary states that "over and out" is mostly used in
> TV and films).  Perhaps it's a reference to cricket (as in "The over
> is complete, AND the batsman is out").

My own exposure to the phrase comes entirely from television
entertainment programming, and by it I meant only to say "my
contributions end here".

But I'm glad to learn it has a more rigorous, contradictory meaning.

Thanks, all!

-- 

Wolff's book seems to occupy a middle ground: between the writing of
White House newspaper reporters, who exercise preternatural restraint
when writing about the Administration, and the late-night comedians,
who offer a sense of release from that restraint because they are not
held to journalistic standards of veracity. That middle ground, where
there is neither restraint nor accuracy, shouldn't exist.

Masha Gessen
https://www.newyorker.com/news/our-columnists/fire-and-fury-is-a-book-all-too-worthy-of-the-president

[toc] | [prev] | [next] | [standalone]


#191255

FromCharlie Gibbs <cgibbs@surfnaked.ca>
Date2018-01-18 07:20 +0100
Message-ID<v9bIm-1Ad-7@gated-at.bofh.it>
In reply to#191233
On 17/01/18 11:38 AM, Darac Marjal wrote:

> On 17/01/18 02:17, Charlie Gibbs wrote:
 >
>> On 16/01/18 12:15 PM, davidson@freevolt.org wrote:
>>
>>> Is there a natural law or something, that every email message sent
>>> must contain at least one distracting error that is totally beside the
>>> point?
>>>
>>> Anyways, over and out.
>>
>> "Over" means "My transmission is finished; I expect a reply."
>> "Out" means "My transmission is finished; I do not expect a reply."
>>
>> One more distracting error... :-)
>
> Surely it depends on your context. If you're communicating over a radio,
> then sure, they mean what you mean. But perhaps it's a quotation
> (wiktionary states that "over and out" is mostly used in TV and films).

The reason it's mostly used in TV and films is that the writers don't 
know any better.  Or they're pandering to viewers don't know any better. 
  But it is not, and has never been, proper procedure for anyone who 
uses a radio in real life.

And don't call me Shirley.

> Perhaps it's a reference to cricket (as in "The over is complete, AND
> the batsman is out").

An interesting back-formation...

What a delightfully distracting error this is turning into!

-- 
cgibbs@surfnaked.ca (Charlie Gibbs)

[toc] | [prev] | [next] | [standalone]


#191212

Fromdavidson <davidson@freevolt.org>
Date2018-01-16 22:40 +0100
Message-ID<v8H7A-61i-1@gated-at.bofh.it>
In reply to#191205
On Tue, 16 Jan 2018, davidson wrote:

> On Sun, 14 Jan 2018, Vasyl Vavrychuk wrote:
>
>> Hi, John,
>> 
>> On Sun, Jan 14, 2018 at 8:48 AM, john doe <johndoe65534@mail.com> wrote:
>>> On 1/14/2018 7:28 AM, john doe wrote:
>>> 
>>> $ dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n' awk git gawk
>>> cmake 2>&1 | awk '!/^ii/ || !/^un/{print $6}'
>>> git
>>> gawk
>>> cmake
>> 
>> I also tried to parse stderr, but then I realized that relying on the 
>> output
>>
>>   dpkg-query: no packages found matching
>> 
>> is not correct since it might be localized and is not suitable for 
>> scripting.
>
> You could just discard the stderr, and take the complement of the hits
> from dpkg-query, relative to the supplied arguments:
>
> show-installed () {
>    dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n' "$@" |
>    awk '/^ii/ {print $2}'
> }
>
> show-absent () {
>    universe=("$@")
>    diff <( IFS=$'\n' ; sort <<<"${universe[*]}" ) \
> 	<( show-installed "${universe[@]}" 2>/dev/null ) |
>    sed -n 's/^< //p'
> }

Further testing shows that the above has a lot of problems.

Would not recommend.

Sorry for the noise.

[toc] | [prev] | [next] | [standalone]


#191057

FromEduardo M KALINOWSKI <eduardo@kalinowski.com.br>
Date2018-01-14 11:40 +0100
Message-ID<v7NRL-2b5-1@gated-at.bofh.it>
In reply to#191051
On 14-01-2018 01:52, Vasyl Vavrychuk wrote:
> I would like to list not installed packages in my script.
aptitude search '!~i'
is a start

It's possible to configure the output, see the manpage.

-- 
Any excuse will serve a tyrant.
		-- Aesop

Eduardo M KALINOWSKI
eduardo@kalinowski.com.br

[toc] | [prev] | [next] | [standalone]


#191061

FromRoberto C. Sánchez <roberto@debian.org>
Date2018-01-14 14:00 +0100
Message-ID<v7Q3f-3uI-1@gated-at.bofh.it>
In reply to#191051
On Sun, Jan 14, 2018 at 05:52:45AM +0200, Vasyl Vavrychuk wrote:
> I would like to list not installed packages in my script. Currently I do
> 
>     dpkg-query -W -f='${db:Status-Abbrev}${binary:Package}\n'
> $PACKAGES | grep -v "^ii" | awk '{print $2}'
> 

You may want to consider libdpkg-perl, python-debian, or ruby-debian
instead.  If it really has to be something you can access fro a shell
script, then you can write a small wrapper that does what you need.

Regards,

-Roberto

-- 
Roberto C. Sánchez

[toc] | [prev] | [next] | [standalone]


#191065

FromBernd Gruber <begruber@mnet-online.de>
Date2018-01-14 16:00 +0100
Message-ID<v7RVn-4GI-9@gated-at.bofh.it>
In reply to#191051
Vasyl Vavrychuk wrote:

> I would like to list not installed packages in my script. 

could this help you (if I understood right, that you want to know, if some 
of the packages (in this case) gawk, git, cmake  are not installed:

dpkg -l gawk git cmake |  awk /^un/'{print $2}'

cmake
git

Bernd

[toc] | [prev] | [standalone]


Back to top | Article view | linux.debian.user


csiph-web