OpenPKG Quick Reference ======================= Legend: "$" : shell prompt of any non-root user "#" : shell prompt of root user "" : variable text; to be substituted suitable according to context o Global decision on OpenPKG filesystem path and user/group ID: All the following steps assume a permanent and unchanging filesystem path to OpenPKG and all its subsequently installed software packages. Choose the OpenPKG path and user/group ID carefully when starting with a clean system! $ opkg_root=/openpkg $ opkg_ugid=openpkg $ _ The example code snippets in this reference use shell variables for added convenience, but feel free to substitute actual commands in their place. o Boostrapping OpenPKG from scratch: An OpenPKG instance lives in its own self-contained and self-controlled dedicated filesystem hierarchy ($opkg_root). To use OpenPKG on a machine without existing OpenPKG instance, bootstrap OpenPKG by downloading the latest openpkg--.src.sh from ftp://ftp.openpkg.org/release//SRC/. When executed, this script establishes the OpenPKG hierarchy. This shell script can be executed by any user, but requires development tools like cc(1) and make(1). After the hierarchy is established, installation continues with a second script called openpkg--.--.sh. Unlike the first script, this one dows not requires development tools. Installation requires root privileges to expand capabilities to the fullest extend. It will be installable and usable as a unprivileged user with limited functionality. $ ftp ftp.openpkg.org ftp> cd release/./SRC ftp> ls openpkg-*.src.sh ftp> get openpkg--.src.sh ftp> bye $ sh openpkg--.src.sh --prefix=$opkg_root --user=$opkg_ugid --group=$opkg_ugid $ su - # sh openpkg--.--.sh # exit $ _ o Updating OpenPKG to the latest version: On a machine with an existing OpenPKG instance, or after bootstrapping OpenPKG from scratch (see the previous procedure), use OpenPKG to update OpenPKG! Download the latest openpkg--.src.rpm from ftp://ftp.openpkg.org/release/./, and follow the instructions to rebuild a binary package from source. Alternatively, get the latest openpkg--.--.rpm, and follow the instructions to update or install a binary package. o Find a package in the package repository: To find a package and its version information you have to look for the package files at ftp://ftp.openpkg.org/release/./. Alternative to this path, similar packages can be found at ftp://ftp.openpkg.org/current/. These packages may be less stable, however. o Prepare your shell environment: To more conveniently work with OpenPKG, modify the shell environment to meet the needs of the installed OpenPKG packages. Note that while such modifications may be convinient, the installed OpenPKG packages do not depend on them for successful operation. In fact, this step can be entirely skipped if only RPM operations are needed. In such a limited case, simply execute "$opkg_root/bin/openpkg rpm". To modify the shell environment, simply add the following command to your Bourne-Shell profile. Alternatively, the same command can be entered manually at the interactive shell prompt: $ eval `/cw/etc/rc --eval all env` $ _ o To install OpenPKG packages: The most typical approach installing packages with OpenPKG involves doing 'Fetch and build a binary package from source' and then 'Install or update a binary package' as described by the following sections. Do not ignore the second section regardless of how a binary package is obtained. o Fetch and build a binary package from source: Before any installation can occur, the files in a source package must be built into binaries (if such a binary package already exists, skip to the next bullet item.) The product of this building process is a binary package with a name like foo--.--.rpm, The binary package is found in $opkg_root/RPM/PKG/. The following command will produce a binary package from source: $ openpkg rpm --rebuild ftp://ftp.openpkg.org/release/./foo--.src.rpm $ _ Alternatively, to perform the steps behind the --rebuild option manually, enter the following commands: $ openpkg rpm -Uvh ftp://ftp.openpkg.org/release/./foo--.src.rpm $ cd $opkg_root/RPM/SRC/foo $ openpkg rpm -bb foo.spec $ _ This procedure allows the spec file to be altered. o Install or update a binary package: $ su - # openpkg rpm -Uvh $opkg_root/RPM/PKG/foo--.--.rpm # exit $ _ Attention! When updating a package with a previously hand-modified configuration file, then OpenPKG first backs up this modified configuration file to filename.rpmsave. RPM announces this questionable act with a warning message. Unfortunately, this condition cannot be automatically resolved by RPM. Instead, each configuration file must be remodified by carefully comparing the package's default configuration with the earlier version's own modifications. Just moving back the file will result in the loss of any vendor configuration changes. o Downgrading a binary package: In case the latest version of a package does not work as expected, it is possible to revert to an older version. To downgrade a package to an older version, run the following command: $ su - # openpkg rpm -Uvh --oldpackage $opkg_root/RPM/PKG/foo--.--.rpm # exit $ _ o Configuring a package: Package configuration is package dependent. However, if a package uses a configuration file, it is always placed in $opkg_root/etc/foo/. RPM tags such files as configuration files in order to treat them specially in later update operations, so feel free to edit these files. Adjustments to these configuration files will not be lost in subsequent package updates. o Running a package: A package can be manipulated by issuing "run commands" (rc) which are found in $opkg_root/etc/rc.d/rc.foo. These can be executed on system startup and shutdown time, on a regular interval (cron!), or manually by the OpenPKG user (you): $ su - # $opkg_root/etc/rc foo restart $ exit $ _ Additionally, these RC scripts are controlled by various configuration variables. The variable names and their defaults can be listed by running the following command: $ $opkg_root/etc/rc --config $ _ Environment variables can be set by writing shell script code in $opkg_root/etc/rc.conf which by default is created empty. o Query information about binary packages: - To list information about binary package: $ openpkg rpm -qpi $opkg_root/RPM/PKG/foo--.--.rpm - To list all files a binary package will install: $ openpkg rpm -qplv $opkg_root/RPM/PKG/foo--.--.rpm o Query information about installed packages: - To list all installed packages and their versions: $ openpkg rpm -qa - To list information about an installed package: $ openpkg rpm -qi foo - To list all files a package has installed: $ openpkg rpm -qlv foo o Verify the integrity of a package: RPM records summary information about each installed file and can use this information to verify the integrity of the package(s). - To check the integrity of all packages: $ openpkg rpm -Va - To check the integrity of a particular package: $ openpkg rpm -V foo - To check all package dependencies only: $ openpkg rpm -Va --nofiles o Deinstall (erase) a package: $ su - # openpkg rpm -e foo # exit $ _ o Automating package building and installation with dependencies Use the "openpkg build" mechanism in openpkg-tools. To install the tools including their requirements of make, binutils and gcc, run $ su - # openpkg install openpkg-tools To create a shell script of commands to build and install a certain package including it's dependencies, run $ su - # openpkg build foo | sh Update all packages in dependency order $ su - # openpkg build -Ua | sh Explore the power of this tool by running "openpkg man build"