MrBW
December 20, 2020, 10:30am
1
How can I check if a package is installed by only checking the local system, not querying online repository and the like?
So fare I found this command:
zypper search --file-list fdisk
But it’s still very slow, 1.6 seconds
On my Debian box I can run:
dpkg-query --show --showformat=' ${db:Status-Status} ' fdisk
It’s done in 0.05 seconds!
(I’m checking for installed packages in scripts so the time matters)
Miuku
December 20, 2020, 10:44am
2
mariatest-gcn1:~ # time rpm -q mariadb
mariadb-10.4.13-4.1.x86_64
real 0m0.014s
user 0m0.013s
sys 0m0.000s
I win.
MrBW
December 20, 2020, 11:08am
3
YES, openSUSE always win lol!
Just switched from Debian - I cry for not moving to SUSE many year ago! It’s really an improvement in so many ways (server use, no idea about desktop)
mrmazda
December 21, 2020, 1:53am
4
I keep results I wouldn’t have interest in out of my search results, while versions are typically as much my interest as yes or no:
# cat /usr/local/bin/zypsei
#!/bin/sh
zypper --no-refresh se -s -i $* | egrep -v 'debug|devel|srcp|openSUSE-20' | egrep 'x86|noarch'| sort
# time zypsei fdisk
i | gptfdisk | package | 1.0.1-lp151.3.4 | x86_64 | OSS
i | libfdisk1 | package | 2.33.1-lp151.3.6.1 | x86_64 | Update
real 0m3.672s
user 0m2.571s
sys 0m0.065s
Miuku:
I win.
I would suggest a tie – “normal user” – not the user “root” –
> time rpm -q mariadb
mariadb-10.4.17-lp152.2.8.1.x86_64
real 0m0,017s
user 0m0,010s
sys 0m0,005s
>