Ease package management with SUSE’s y2pmsh

26

Author: Liviu Damian

System and network administrators and packagers alike may find a handy tool in y2pmsh, a shell interface for SUSE Linux’s YaST2 package manager.

Like any package management tool, y2pmsh installs, removes, and upgrades RPM packages. SUSE doesn’t install y2pmsh by default, but you can install it using YaST2. Once it’s there, you can enter its shell by typing the y2pmsh command in your usual shell.

Managing installation sources

You must manage your installation sources before you can do any operations. The command source -s shows you the installation sources, which are numbered. Use the command source -a URL to add a new installation source. Unfortunately, y2pmsh supports only YaST2 repositories, and you’ll get an error if the URL is not a YaST2 repository. To remove an installation source, use the source -R ID command, where ID is the number of the source shown in the source list.

Many installation sources change frequently, so you should refresh the cached data before running other commands. You can either update a source manually using the source -u ID command or automatically using the source -A ID command. The latter refreshes the installation source every time you use y2pmsh. If you wish to stop autorefreshing, use the source -noautorefresh ID command.

You can also use source -e ID and source -d ID to enable or disable some installation sources.

Installing, removing, and upgrading the packages

Use the install, remove, or upgrade commands, followed by the package name, to perform operations of the same name. If you use the upgrade command with no parameters, all packages will be updated to the latest version (if a new version of the package exists).

y2pmsh doesn’t install, remove, or upgrade any packages immediately. With y2pmsh, you can install, remove, and upgrade packages simultaneously. Once you’ve specified what you want to do, you verify the dependences using the solve command. Finally, you commit the changes using the commit command.

The isc (install, solve, and commit) command is a cool feature that lets you do only an installation.

y2pmsh features a lot of options, including deselect (the name is self-explanatory); newer, which shows the packages with newer versions available; search, which searches for packages; and show, which shows the package information (equivalent to rpm -qi).

Making RPMs

This all-in-one tool can make packagers’ lives easier. Unlike users and administrators, packagers must edit two configuration files in the /etc/y2pmbuild directory before they can use y2pmsh: dists_common and the file for the version of SUSE for which they are making packages. All files have the same configuration options. The dists_common file is well documented.

You can modify buildrootbase="/var/tmp/build-root", rpm_sign_name, and rpm_sign_key in dists_common, and specify all other options in the distribution-specific configuration file, all of which are located in the dists subdirectory.

Once you modify the config files, you’re ready to go. Call the build script using the y2pmbuild-VERSION (e.g., y2pmbuild-10.0) command from the directory containing the spec files to build all the packages and generate the repositories.

y2pmsh is a great tool for doing day-to-day package management, as well as for creating packages. If you don’t want to use a graphical interface or the classic YaST2, y2pmsh is an excellent alternative.