10.05
0
The zypper utility has a very feature-richsearch utility built in that allows you to quicklyandefficiently search through all, or certain, repositories for packages. Having the searchutility right at your fingertips adds to making software maintenance very easy. Table 2-6shows some of the most useful search commands for zypper.
  
Table 2-6: Useful zypper Search Commands

Command               Abbreviation       Description
search                        se                          Use with a search pattern to narrow the search query or without to see all available packages. Use –t to specify a resolvable to limit searching to.
patches                      pch                      Search for and display all known patches.
patch-info                                              Include the patch name in the command to display full information about that patch.

Continued

Table 2-6: Useful zypper Search Commands(continued)

Command
Abbreviation
Description
info
if
Include the package name to show full information about that package.
list-updates
lu
List all available updates.

The following example shows how to add a repository and search for packages and patches using the zypper command. In this example, we’ll tackle software drivers for wireless networking cards, because you often require extra repositories to find drivers for wireless cards, and because the drivers get patched frequently. If your system sportsa wireless card, you’ll often want to install driver packages for your card, or downloadpatches to update those drivers.

The Madwifi (http://madwifi.org/) project provides a SUSE repository of packagesforthe popular Atheros chipset, a chipset used in wireless networkingcards from manyvendors. For installing wireless networking kernel drivers, having a repository customtailored for your SUSE system can be very handy.

Start by adding the Madwifi install location using the zypper command in the same way as the previous example. Make sure you are adding the correct install location fortheversion of openSUSE you are running. Because we are using openSUSE 10.3 for this chapter, we’ll add the 10.3 install location (change this for your version if neces- sary) and name the repository madwifi.

 zypper ar  http://madwifi.org/suse/10.3/  madwifi

You can now use the zypper command to perform a case-insensitive search of anything you want. You can see in the results that the search returned case-insensitive results for the original term.

 zypper se  wIFi
 Reading installed packages  [100%]

S  | Repository            | Type        | Name                       | Version                       | Arch
--+-----------------+---------+-----------------+-------------------+-----
...
| testcdrom              | package | iwlwifi-kmp-x...|  0.1.16_2.6.22....| i586
| http://downlo...| package | madwifi                            |  0.9.3.99-35               | i586
| madwifi                  | package | madwifi                      | 0.9.3.2-1                    |  i586
...

If you search for something more generic, you’ll see that zypper searches across all enabled repositories, and reports back with the packages and repositories where the search query was found:

 zypper se util
 Reading installed packages  [100%]

S  | Repository            | Type        | Name                       | Version                    | Arch
--+-----------------+---------+-----------------+-----------------+------- v  | openSUSE-10.3...|  package | alsa-utils                |  1.0.14-25                                                                          | i586
i | http://downlo...| package | alsa-utils                      |  1.0.14-27              | i586 v  | testcdrom           | package |  alsa-utils          | 1.0.14-25                      | i586
| openSUSE-10.3...|  package | apache2-utils...| 2.2.4-66                       |  i586
| http://downlo...| package | apache2-utils...| 2.2.4-70                        |  i586
...

In the first column of the output is the package Status. A v or i in this columnindicates that another version of the package is installed, or the package, as listed, is already installed. The second column shows in which Zypper repository the search word was found. The Type describes the type of resolvable the line refers to. Nameand Version are obvious, and Arch  lists whether this package is compiled for a specific system architecture.

Zypper uses something called resolvables to designate the different types of resources you want it to work with. A resolvable can be a package, patch, pattern, language,or product. You can select the different types of resolvables using the –t flag along with the resolvable you want to act on:

 zypper se  -t  patch
S  | Repository            | Type    | Name                      | Version         | Arch
--+-----------------+-------+-----------------+-----------+-------
| openSUSE-10.3...| patch | fetchmsttfont...|  4347-0          | noarch i |           |  patch  | update-test-a...|2609-0   |  noarch

To limitthe patch search to a specific piece of software, you could add a search pattern to the
zypper command:

 zypper se  -t patch msttfont
 Reading installed packages  [100%]

S  | Repository                           | Type    | Name                          | Version | Arch
--+-------------------------+-------+-------------------+---------+-------
| openSUSE-10.3-Updates...| patch | fetchmsttfonts.sh |  4347-0   | noarch
  
To search the language resolvables, use the –t language command to show just language resolvables instead of packages. To look for the Estonian language packs, for example, you would use a zypper command such as:

 zypper se  -t language et
 Reading installed packages  [100%]

S  | Repository | Type           | Name | Version         | Arch
--+------------+----------+------+-----------+------- i |     | language | et        |              |  noarch

You can also use the zypper command to list available software patches by way of the
pch command:

 zypper  pch
 Reading repository ‘openSUSE-10.3-DVD  10.3’  cache
 Reading repository  ‘madwifi’ cache
 Reading repository  ‘ftp.gwdg.de’  cache
 Reading repository  ‘Main Repository (NON-OSS)’   cache
 Reading repository ‘openSUSE-10.3-Updates’ cache
 Reading repository  ‘testcdrom’  cache
 Reading repository  ‘Main Repository (OSS)’ cache
 Reading installed packages  [100%]

Repository:          | Name                          | Version | Category | Status
---------------+-------------------+---------+----------+----------- openSUSE-10....| fetchmsttfonts.sh  | 4347-0   |  optional | Not  Needed

To view more information about the fetchmsttfonts.sh patch, you can issue the patch-info command to zypper along with the field from the Name column. It must match the Name column exactly:

 zypper patch-info fetchmsttfonts.sh
 Reading repository ‘openSUSE-10.3-DVD  10.3’  cache
...
Name:   fetchmsttfonts.sh
Version:   4347-0
Arch:  noarch Status:  Not  Needed Category:  optional
Created  On:  Fri 21  Aug 1970   02:15:19 AM   CDT
...

You can also view similarinformation about a package (rather than a patch) by issuing the
info command with zypper:

 zypper info alsa-utils
...
Information for  package alsa-utils:

Repository:  Main  Repository  (OSS)  Name:  alsa-utils
Version:  1.0.14-27
Arch:  i586
Installed: Yes Status: up-to-date Installed Size:  1.6 M
Summary:    Advanced Linux  Sound   Architecture Utilities
Description:
<!--  DT:Rich -->
<p>This package contains  utility programs supporting  ALSA,  Advanced Linux  Sound
Architecture.
</p>

You can also use the zypper command to list all available updates it knows about:

 zypper lu
 Reading repository ‘openSUSE-10.3-DVD  10.3’  cache
 Reading repository  ‘madwifi’ cache
 Reading repository  ‘Guru’s RPM  site’  cache
 Reading repository  ‘Main Repository (NON-OSS)’   cache
 Reading repository ‘openSUSE-10.3-Updates’ cache
 Reading repository  ‘testcdrom’  cache
 Reading repository  ‘Main Repository (OSS)’ cache

 Reading installed  packages [100%] No updates  found.

0 komentar:

Posting Komentar