Package Making Issues
The intended use of pacman on non-ttylinux hosts is for assembling ttylinux packages.
Package making seems an easy task as ttylinux packages are tar archives compressed with bzip2. A complicating factor in using pacman to make ttylinux packages is that the package making operation is an exact inverse of package installation, and there is a controlling list of files that comprises the files in the package. This controlling list of files is the database file associated with the package.
A package database file is created by the pacman package installation operation; it is read by the pacman package making operation.
All the package database files are in the /etc/share/ttylinux directory, which your non-ttylinux host probably does not have, nor should you want that directory on your non-ttylinux host.
Also, package installation puts files in directories all over your system, and for the inverse operation of package making you do not want to get files from directories all over your system. Putting files all around your system's directories in order to make a ttylinux package is a bothersome at best, and risky at worst.
Ideally, you would have a staging area, with the ttylinux files for which you want to create a package, under a single convenient private directory. And the package database file in a convenient private directory.
Alternate Directories
pacman can use a user-specified root directory from which it gets the files to make a package, and it can use a user-specified directory to look for the package database file. These user-specified directories, file root and package database directories, are used by all the pacman operations except package download and query repo operations. With this capabilities, pacman can install, query and make packages all with an alternate private root directory, and using an alternate private directory for managing the package database files.
The appropriate way to use pacman on a non-ttylinux host is to set the pacman file root and package database directories to your own alternate private directories. This is done by using environment variables. It may be convenient to use shell scripts in which the environment variables that control the user-specified directories are set, and sequences of pacman commands work within this environment.
There are three environment variables that customize pacman behaviour.
PACMAN_FILES_ROOT_DIR This sets the root directory that pacman uses to install
files and also to look for files when making packages or
removing packages. The default that pacman uses when
this is not set is the system's root directory, /.
PACMAN_PACKAGE_DB_DIR This sets the directory in which to refer to, make or
remove the package database files. The default that
pacman uses when this is not set is /usr/share/ttylinux.
PACMAN_REPO_CACHE_DIR This sets the directory that pacman uses to make
repository cache files for all repository operations.
The default that pacman uses when this is not set is
/usr/share/ttylinux.
An example usage of these environment variables for using pacman on a non-ttylinux host is:
#!/bin/bash
# Script to merge the bash and busybox packages into one single package.
# The pacman script must be in the $PATH.
export PACMAN_FILES_ROOT_DIR=$(pwd)/p_root
export PACMAN_PACKAGE_DB_DIR=$(pwd)/p_root/usr/share/ttylinux
export PACMAN_REPO_CACHE_DIR=$(pwd)/p_root/usr/share/ttylinux
# Remove everything created by this script so that this script is repeatable.
#
rm -rf p_root
rm -rf new-stuff-i486.tbz
# Make an alternate root directory.
#
mkdir -p p_root/usr/share/ttylinux
pacman --repo=ttylinux.net --install --vers=9.1 bash-3.2.48-i486.tbz
#
# Now these two files are installed:
# $(pwd)/p_root/bash
# $(pwd)/p_root/sh -> bash
# And there is a package database file:
# $(pwd)/p_root/usr/share/ttylinux/pkg-bash-3.2.48-FILES
# And there is a repository cache file:
# $(pwd)/p_root/usr/share/ttylinux/repo-ttylinux.net
pacman --repo=ttylinux.net --install --vers=9.1 busybox-1.15.3-i486.tbz
#
# Now there are a bunch of files in:
# $(pwd)/p_root/bin/
# $(pwd)/p_root/sbin/
# $(pwd)/p_root/usr/bin/
# $(pwd)/p_root/usr/sbin/
# <etc>
# And there is a package database file:
# $(pwd)/p_root/usr/share/ttylinux/pkg-busybox-1.15.3-FILES
# And there is a repository cache file:
# $(pwd)/p_root/usr/share/ttylinux/repo-ttylinux.net
# Merge the two packages and make a new single package.
#
cat $(pwd)/p_root/usr/share/ttylinux/pkg-bash-3.2.48-FILES \
$(pwd)/p_root/usr/share/ttylinux/pkg-busybox-1.15.3-FILES \
>$(pwd)/p_root/usr/share/ttylinux/pkg-new-stuff-FILES
pacman --make new-stuff-i486.tbz
# Show the new package binary file.
#
ls -hl new-stuff-i486.tbz
exit 0