This document is a LFS hint.
Trip is a simple package manager, mainly designed for LFS users. It is a quite low level tool, probably with bugs and rough edges. It will safely monitor file alterations during compilation and installation from a source package. It will manage packages with tarball and text files. It will let the user do what it wants to do, no matter if that is a mistake or not.
Trip is not RPM nor DPKG (to name only two). It will not fetch packages automatically for you from internet. It will not check dependencies. It will not split packages into various pieces automatically (executables, devel, libs, etc.). It will not allow you to upgrade your whole system automagically.
All that said, trip won't be in you way when you decide to do something, and trip will not require tons of dependencies to run.
Trip -h should give something like that :
+ Trip, a Trivial Package manager, using Unionfs. You are using version 0.3 + usage : trip -i, --install <binary package file> [--no-conflict] + (install from a pre-built binary package) + -u, --uninstall <package name> + (uninstall a package installed with trip) + -b, --build <source package directory> + (create a binary package from sources) + -r, --rebuild <package name> + (rebuild a binary package from an installed package) + -w, --wizard + (ask some questions, create a source package, build it and install it) + -l, --list [<package name>|<binary package file>] + (list installed packages, files from an installed package or files from a binary package) + -f, --find-file <file> + (find the package(s) containing "file") + -bbi, --batch-build-install <package list> + (build and install a set of packages from "package list") + -bu, --batch-uninstall <package list> + (uninstall a set of packages from "package list") + --upgrade-bd-from-0.1-to-0.2 + --upgrade-bd-from-0.2-to-0.3 + (migrate data from a previous package database format) + -c, --config-dir <dir> + (specify an alternate configuration directory) + -t, --trip-path <path> + (specify an alternate path to this trip shell script) + -v, --verbose-level <0|1|2|3> + (verbosity where 0=quiet, 1=errors, 2=errors/warnings, 3=errors/warnings/infos) + -h, --help + (print this short help, see also http://www.pierrox.net/trip/ for more)
The essential switches are -b, -i, -u : build, install and uninstall a package.
Additionally trip provides some other usefull switches :
Finally the behaviour of trip can be impacted by the use of these switches :
The idea of trip is to use two filesystems in a union filesystem. See http://www.unionfs.org/. One filesystem is the target filesystem on which the user wants to do "make install", and is used read-only, the second is an empty filesystem merged with the first, and used read-write.
Let's take an example fstab :
/dev/hda1 / ext3 defaults 1 1 /dev/hdc1 /mnt/pkg ext3 defaults 0 0 unionfs /mnt/union unionfs dirs=/mnt/pkg:/=ro,noauto 0 0
The result of this is :
Hence a chroot in /mnt/union gives these benefits :
This principle being expressed, the work of trip is to manage the execution of build/install steps of a source package, and put all created/modified files in a tarball, so that they can be copied later into the real filesystem, if everything goes well.
Installing trip involves two steps.
mkdir -p /mnt/pkg /mnt/union
/dev/hdc1 /mnt/pkg ext3 defaults 0 0 unionfs /mnt/union unionfs dirs=/mnt/pkg:/=ro,noauto 0 0Modify /dev/hdc1 according to your system. The option "dirs=/mnt/pkg:/=ro" means that /mnt/pkg and / are layered, and as / is specified as read-only (ro), all file modifications will take place into /mnt/pkg.
mount /mnt/union && ls -l /mnt/union(you should see the content of / and /mnt/pkg merged)
WARNING : before to build a binary package, trip removes all files in /mnt/pkg.
WARNING : Trip wont work as expected if your system is based on several filesystems, for example / and /usr. In this case /usr will not be visible inside /mnt/union and so a lot of things will probably not work. Work is in progress to drop this limitation.
TRIP=trip-0.3 wget -O - http://www.pierrox.net/trip/$TRIP.tar.gz | tar xvz ./$TRIP/src/trip -v 3 -c $PWD/$TRIP/src/conf -t $PWD/$TRIP/src/trip -b $TRIP ./$TRIP/src/trip -v 3 -c $PWD/$TRIP/src/conf -i $TRIP-1.noarch.tar.gz
This will dowload trip, construct an installable trip package from the trip source package, and finally install the package. You can have a look at the list of installed files using trip -l trip. You may have to edit $TRIP/src/conf/conf if you named the mount points other than /mnt/pkg or /mnt/union.
Trip as been designed from the ground to build a packaged LFS, starting at the creation of directories till the last package Vim. LFS-6.2 is used as an example, but the process may be applied to other versions of LFS, even CLFS (tested on ARM).
Follow the LFS book till the chapter "6.1 Introduction". At this stage the $LFS/tools directory is ready.
When used to build a LFS system, trip requires a special configuration and directory layout. As trip must be reachable from $LFS the same way it would be from /, it will be put in $LFS/trip and a symlink will be created into / (the same way it has previously be done for $LFS/tools). Once the new LFS system is up and ready, trip can be installed and used as explain in the previous paragraph "Trip installation". For now use these commands to install trip in a temporary way :
TRIP=trip-0.3 wget -O - http://www.pierrox.net/trip/$TRIP.tar.gz | tar xvz -C $LFS mv $LFS/$TRIP $LFS/trip ln -s $LFS/trip /trip mkdir /trip/tmp /trip/pkg
This will download trip and copy files into a temporary location into $LFS. The trip shell script is now located at /trip/src/trip, and the configuration directory is now located at /trip/src/conf.
Finally edit /trip/src/conf/conf and use these values, where path are adjusted to your $LFS :
# TRIP configuration file # TRIP is a TRIvial Packager # copyright 2006-2007 Pierre Hebert# http://www.pierrox.net/trip/ # the real root filesystem, in which resides the operating system TRIP_FS_ROOT=/mnt/lfs # the filesystem on which are temporarily created the files during the install phase TRIP_FS_PKG=/mnt/pkg # the union filesystem mergin $TRIP_FS_ROOT(ro) and $TRIP_FS_PKG(rw) TRIP_FS_UNION=/mnt/union # where to install binary packages TRIP_INSTALL_DIR=/mnt/lfs # installed package db location TRIP_DB=/mnt/lfs/var/lib/trip # the mode tell if we use /tools or / as build environment (hosted = build from /tools, normal=/) TRIP_MODE=hosted # the location of the trip shell script TRIP_PATH=/trip/src/trip # root location of temporary files TRIP_TMPDIR=/trip/tmp
cd /trip/pkg wget -O - http://www.pierrox.net/trip/source-packages-lfs-6.2.tar.gz | tar xvz
mkdir -p $LFS/{dev,proc,sys,bin,tmp} mknod -m 600 $LFS/dev/console c 5 1 mknod -m 666 $LFS/dev/null c 1 3 ln -s /tools/bin/bash $LFS/bin/bash ln -s bash $LFS/bin/sh
When using trip during the LFS system building, trip can be executed this way :
/trip/src/trip -c /trip/src/conf -b foo-1.2.3
Alternatively some environments variables can be adjusted to simplify the command line :
PATH=$PATH:/trip/src export TRIP_CONFIG_DIR=/trip/src/conf trip -b foo-1.2.3
(We will use this second form)
Now that your host system is ready to build the new LFS system using trip, it is time to start the easy job. Issue the following command to construct the very first package :
cd /trip/pkg trip -b lfs-base-6.2
It will create a package named "lfs-base-6.2-1.noarch.tar.gz" in the current directory, containing the standard directory structure. Install it with :
trip -i lfs-base-6.2-1.noarch.tar.gz
trip -b linux-libc-headers-2.6.12.0 && trip -i linux-libc-headers-2.6.10-1.i386.tar.gz trip -b man-pages-2.34 && trip -i man-pages-2.34-1.noarch.tar.gz
(if you don't build for i386 architecture edit the linux-libc-headers-2.6.12.0 package)
ln -s /tools/bin/{cat,grep,pwd,stty} $LFS/bin ln -s /tools/bin/perl $LFS/usr/bin ln -s /tools/lib/libgcc_s.so{,.1} $LFS/lib
trip -b glibc-2.3.6 && trip -i glibc-2.3.6-1.i686.tar.gz
(replace i686 with your architecture)
chroot "$LFS" /tools/bin/env -i HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h mv /tools/bin/{ld,ld-old} mv /tools/$(gcc -dumpmachine)/bin/{ld,ld-old} mv /tools/bin/{ld-new,ld} ln -s /tools/bin/ld /tools/$(gcc -dumpmachine)/bin/ld gcc -dumpspecs | \ perl -p -e 's@/tools/lib/ld-linux.so.2@/lib/ld-linux.so.2@g;' \ -e 's@\*startfile_prefix_spec:\n@$_/usr/lib/ @g;' > \ `dirname $(gcc --print-libgcc-file-name)`/specs exit
We will use the "--batch-build-install" option to automate the process :
cat << EOF > pkg_list binutils-2.16.1 gcc-4.0.3 db-4.4.20 coreutils-5.96 iana-etc-2.10 m4-1.4.4 bison-2.2 ncurses-5.5 procps-3.2.6 sed-4.1.5 libtool-1.5.22 perl-5.8.8 readline-5.1 zlib-shared-1.2.3 zlib-static-1.2.3 autoconf-2.59 automake-1.9.6 bash-3.1 bzip2-1.0.3 diffutils-2.8.1 e2fsprogs-1.39 file-4.17 findutils-4.2.27 flex-2.5.33 grub-0.97 gawk-3.1.5 gettext-0.14.5 grep-2.5.1a groff-1.18.1.1 gzip-1.3.5 inetutils-1.4.2 iproute2-2.6.16-060323 kbd-1.12 less-394 make-3.80 man-db-2.4.3 mktemp-1.5 module-init-tools-3.2.2 patch-2.5.4 psmisc-22.2 shadow-4.0.15 sysklogd-1.4.1 sysvinit-2.86 tar-1.15.1 texinfo-4.8 udev-096 util-linux-2.12r vim-7.0 lfs-bootscripts-6.2 lfs-configuration-6.2 EOF trip --no-conflict --batch-build-install pkg_list
Note that we use the "--no-conflict" option because the installation of some packages overwrite manually created symlinks, like cat,grep,pwd,stty.
The "shadow" package requires some manual configuration :
chroot "$LFS" /tools/bin/env -i HOME=/root TERM="$TERM" PS1='\u:\w\$ ' \ PATH=/bin:/usr/bin:/sbin:/usr/sbin:/tools/bin /tools/bin/bash --login +h pwconv grpconv rm /etc/{passwd-,group-,shadow-,gshadow-} passwd root
You also need to build your kernel. It is possible to package linux, but as you will probably want to choose your own configuration depending on your hardware, it is probably easier to keep it under a well known location like /usr/src/linux. Follow the LFS instructions about it.
The last two packages lfs-bootscripts-6.2 and lfs-configuration-6.2 contains some default configurations that you will certainly want to change. So have a look at the content of these packages in order to adapt them to your needs. At this point come back to the LFS book at "7.5. Configuring the setclock Script" for the last steps. You will in particular need to :
The source package describes how to build and install a software. Its name should be composed on the <name>-<version> schema, for example "glibc-2.3.6". Inside the package directory are located two subdirectories : "src" and "support".
The build.sh and install.sh scripts are executed in a chrooted environment inside the /mnt/union filesystem. If these two scripts complete sucessfully, trip will build a binary archive with all created/modified files, the identification file and {pre,post}_{un,}install.sh scripts if available (see Binary package below).
When building a binary package from a source package, trip sets some environment variables that can be used in build.sh and install.sh :
A binary package is a gzipped tar archive containinig the files to install, meta-data and eventually {pre,post}_{un,}install.sh scripts.
Files are stored in an uncompressed archive named "files.tar". Other files are stored in a directory named "support". Running "tar tvf lfs-base-6.2-1.noarch.tar.gz" will show :
drwxr-xr-x root/root 0 2007-07-30 15:18:24 lfs-base-6.2-1.noarch/ drwxr-xr-x root/root 0 2007-07-30 15:18:24 lfs-base-6.2-1.noarch/support/ -rw-r--r-- root/root 162 2007-07-30 15:18:24 lfs-base-6.2-1.noarch/support/identification -rw-r--r-- root/root 51200 2007-07-30 15:18:24 lfs-base-6.2-1.noarch/files.tar
The location of this database is specified by the TRIP_DB variable in the configuration file. Its default value is /var/lib/trip.
The list of installed packages is stored in $TRIP_DB/list (one package per line), sorted by installation date ascending.
Each installed package has a subdirectory of its name in $TRIP_DB. The subdirectory contains the following files :
There are two ways to access trip versions and packages : HTTP and Subversion. Please use HTTP, except if you plan to do regular updates.
IMPORTANT : when building or installing binary packages, you should follow a specified order, as trip currently does not handle dependencies :