Bootstrapping pkgsrc
From NetBSD Wiki
After fetching pkgsrc, you need to install the basic tools of pkgsrc, so that you can install and deinstall packages. This is called bootstrapping.
Bootstrap options
In the pkgsrc directory, there is a directory bootstrap/, which contains the bootstrap script and a lot README files. Be sure to read the generic README and then the README.OPSYS that applies to your operating system.
Now you are ready to run the bootstrap script. It has several command line options:
$ ./bootstrap/bootstrap --help
===> bootstrap command: ./bootstrap/bootstrap --help
===> bootstrap started: Sun Feb 17 20:48:20 CET 2008
Usage: ./bootstrap/bootstrap
[ --workdir <workdir> ]
[ --prefix <prefix> ]
[ --pkgdbdir <pkgdbdir> ]
[ --pkgmandir <pkgmandir> ]
[ --sysconfdir <sysconfdir> ]
[ --varbase <varbase> ]
[ --fetch-cmd <ftp command> ]
[ --ignore-case-check ]
[ --unprivileged | --ignore-user-check ]
[ --preserve-path ]
[ --compiler <compiler> ]
[ --mk-fragment <mk.conf> ]
[ --binary-kit <tarball> ]
[ --gzip-binary-kit <tarball> ]
[ --binary-macpkg <pkg> ]
[ --full ]
[ --quiet ]
[ --help ]
Most of the options are optional, so you don't need to know them. Some others are pretty important:
- --unprivileged selects whether you intend to run pkgsrc as root or as an unprivileged user. The default values for the other settings depend on this option. Using pkgsrc as root is convenient, since there are a few packages that require root privileges to build. On the other hand, this means that the build instructions for the packages are run as root user and thus may harm your system. Using pkgsrc as unprivileged user works for most packages as well.
- --prefix=dir selects the directory where pkgsrc is installed. The default directory is /usr/pkg in privileged mode, and $HOME/pkg in unprivileged mode.
- --varbase=dir selects the directory where those files are installed that may change after installing the package. In privileged mode, the default is /var, and in unprivileged mode, it is $prefix/var.
- --sysconfdir=dir selects the directory where configuration files are installed. The default is $prefix/etc.
Bootstrapping
To run the bootstrap script, the current directory must be writable, or you need to add the --workdir option.
$ ./bootstrap/bootstrap --unprivileged --workdir=/tmp/pkgsrc-bootstrap
Bootstrapping pkgsrc takes a while, and when it has finished, you can see that there are a few files in the directory $prefix. The exact set of files depends on your operating system. The pkgsrc configuration file is called mk.conf, and it is located in $sysconfdir. In this file, you can further configure pkgsrc as needed.
