Pierre Malard
2018-Nov-08 19:52 UTC
[CentOS] A newbie question about searching an installed packet
Hi, I?m french and literally one. So I?m not really easy with Sheakespeare language. So, accept my apologies. As write in subject, I?m a newbie about CentOS an all RedHat declines. I wrote a Shell script for ours Debians (all sort of Debian like) which verify which packets are present before running. I thought I had found an equivalent with ? yum list installed | grep <packet> ? command but I have sometime alerts about a lock because an other instance of ? yum ? is running. I don?t understand why a simple ? yum list ? impose that! I suppose, like with ? aptitude search ?, it is an understanding scorie. I?m sure there is an other way to do what I want to do: just verify if a packet is, or not, installed. Help? Thanks -- Pierre Malard ? On ne peut pas pousser ? fond l'?ducation politique et l'?ducation tout court de masses sans l'accompagner d'un d?veloppement ?conomique, culturel et social parall?le. ? Romain Gary - "Les racines du ciel" |\ _,,,---,,_ /,`.-'`' -. ;-;;,_ |,4- ) )-,_. ,\ ( `'-' '---''(_/--' `-'\_) ?r perl -e '$_=q#: 3|\ 5_,3-3,2_: 3/,`.'"'"'`'"'"' 5-. ;-;;,_: |,A- ) )-,_. ,\ ( `'"'"'-'"'"': '"'"'-3'"'"'2(_/--'"'"' `-'"'"'\_): 24?r::#;y#:#\n#;s#(\D)(\d+)#$1x$2#ge;print' - --> Ce message n?engage que son auteur <-- -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 901 bytes Desc: Message signed with OpenPGP URL: <http://lists.centos.org/pipermail/centos/attachments/20181108/13005873/attachment-0001.sig>
Kenneth Porter
2018-Nov-08 20:02 UTC
[CentOS] A newbie question about searching an installed packet
On 11/8/2018 11:52 AM, Pierre Malard wrote:> As write in subject, I?m a newbie about CentOS an all RedHat declines. I wrote a Shell script for ours Debians (all sort of Debian like) which verify which packets are present before running. I thought I had found an equivalent with ? yum list installed | grep <packet> ? command but I have sometime alerts about a lock because an other instance of ? yum ? is running.Yum is a layer on top of the RPM package database. Yum manages dependencies and figures out which additional packages to install (or remove) when you want to install a new package. Yum regularly runs a cron job to check for updates to existing packages and that cron job locks the yum database. That's probably why your interactive job complains that it can't lock the database. To just query what's installed, you can use the lower-level RPM commands. They don't require a lock on the yum database. The RPM database is only locked when you actually install or remove a package. I use this to see if a package is installed: rpm -qa | grep -i package-name I use the same command when I can't remember the exact name and capitalization of a package. That's why I include the -i in the grep command.
Pierre Malard
2018-Nov-08 21:28 UTC
[CentOS] A newbie question about searching an installed packet
Thanks, I was sure there were a relevant solution. That?s exactly what I was looking for :-)> Le 8 nov. 2018 ? 21:02, Kenneth Porter <shiva at sewingwitch.com> a ?crit : > > On 11/8/2018 11:52 AM, Pierre Malard wrote: >> As write in subject, I?m a newbie about CentOS an all RedHat declines. I wrote a Shell script for ours Debians (all sort of Debian like) which verify which packets are present before running. I thought I had found an equivalent with ? yum list installed | grep <packet> ? command but I have sometime alerts about a lock because an other instance of ? yum ? is running. > > Yum is a layer on top of the RPM package database. Yum manages dependencies and figures out which additional packages to install (or remove) when you want to install a new package. Yum regularly runs a cron job to check for updates to existing packages and that cron job locks the yum database. That's probably why your interactive job complains that it can't lock the database. > > To just query what's installed, you can use the lower-level RPM commands. They don't require a lock on the yum database. The RPM database is only locked when you actually install or remove a package. > > I use this to see if a package is installed: > > rpm -qa | grep -i package-name > > I use the same command when I can't remember the exact name and capitalization of a package. That's why I include the -i in the grep command. > > > _______________________________________________ > CentOS mailing list > CentOS at centos.org > https://lists.centos.org/mailman/listinfo/centos-- Pierre Malard ? C'est bien plus beau lorsque c'est inutile ? E Rostand - "Cyrano de Bergerac" |\ _,,,---,,_ /,`.-'`' -. ;-;;,_ |,4- ) )-,_. ,\ ( `'-' '---''(_/--' `-'\_) ?r perl -e '$_=q#: 3|\ 5_,3-3,2_: 3/,`.'"'"'`'"'"' 5-. ;-;;,_: |,A- ) )-,_. ,\ ( `'"'"'-'"'"': '"'"'-3'"'"'2(_/--'"'"' `-'"'"'\_): 24?r::#;y#:#\n#;s#(\D)(\d+)#$1x$2#ge;print' - --> Ce message n?engage que son auteur <-- -------------- next part -------------- A non-text attachment was scrubbed... Name: signature.asc Type: application/pgp-signature Size: 901 bytes Desc: Message signed with OpenPGP URL: <http://lists.centos.org/pipermail/centos/attachments/20181108/2496dc79/attachment-0001.sig>