6.8. Creating Directories, Revisited

[Note]

Note

This section is completely optional.

If you wish to register the file system directories previously created, then first create a working directory:

mkdir -pv /sources/lfs-base-20150528-dpkg
cd /sources/lfs-base-20150528-dpkg

Repeat the creation of a standard directory tree, but this time create the directories in a staging directory:

mkdir -pv debian/tmp/{dev,proc,sys,run}
mkdir -pv debian/tmp/{bin,boot,etc/{opt,sysconfig},home,lib/firmware,mnt,opt}
mkdir -pv debian/tmp/{media/{floppy,cdrom},sbin,srv,var}
install -dv -m 0750 debian/tmp/root
install -dv -m 1777 debian/tmp/tmp debian/tmp/var/tmp
mkdir -pv debian/tmp/usr/{,local/}{bin,include,lib,sbin,src}
mkdir -pv debian/tmp/usr/{,local/}share/{color,dict,doc,info,locale,man}
mkdir -v  debian/tmp/usr/{,local/}share/{misc,terminfo,zoneinfo}
mkdir -v  debian/tmp/usr/libexec
mkdir -pv debian/tmp/usr/{,local/}share/man/man{1..8}

case $(uname -m) in
 x86_64) ln -sv lib debian/tmp/lib64
         ln -sv lib debian/tmp/usr/lib64
         ln -sv lib debian/tmp/usr/local/lib64 ;;
esac

mkdir -v debian/tmp/var/{log,mail,spool}
ln -sv debian/tmp/run debian/tmp/var/run
ln -sv debian/tmp/run/lock debian/tmp/var/lock
mkdir -pv debian/tmp/var/{opt,cache,lib/{color,misc,locate},local}

ln -sv /proc/self/mounts debian/tmp/etc/mtab

Create the package archive:

PRESERVE_LIB64=1 buildpkg --package=lfs-base --version=20150528-dpkg

Install the package:

dpkg -i ../lfs-base_20150528-dpkg_*.deb

Now, as usual, you may remove the working directory:

cd ..
rm -rf lfs-base-20150528-dpkg
[Note]

Note

It is not a good idea to add the other symbolic links from Section 6.6, “Creating Essential Files and Symlinks.” to the package: they are intended to be purely temporary links which will be overwritten later. If you do add them to the package, that will mean you will need to use --force-overwrite for each package that overwrites one of these links.

Likewise, it is not a good idea to add /etc/passwd, /etc/group, or the log files in /var/log to the package. The rationale here is: if you go back and upgrade this package using a future version of this book, then these files should not be overwritten. It will be up to you to maintain these files.