---
name: "empbuilderlib"
section: "3"
platform: "linux"
package: "emdebian-rootfs"
version: "1.4.3"
release: "Debian 5.0 (Lenny)"
platforms: ["linux"]
url: "https://new.carta.tech/empbuilderlib"
---

# empbuilderlib(3)

Common functions for Emdebian chroots

## NAME

empbuilderlib - Common functions for Emdebian chroots

## DESCRIPTION

*empbuilderlib* is intended solely for use on the build machine. Do not use these functions in second\_stage\_install ! *empbuilderlib* requires **perl**!

## AUTOCLEAN\_APTCACHE

Same as the pbuilder option but run by default in **empdebuild** to remove obsolete .deb archives from the apt cache directories used by **empdebuild**.

## BASIC\_ETC\_FSTAB

Removing packages from the normal Debian debootstrap set can mean that certain critical files can be omitted. basic\_etc\_fstab creates a basic version of $TARGET/etc/fstab where it does not already exist.

## BASIC\_GROUP\_SETUP

Removing packages from the normal Debian debootstrap set can mean that certain critical files can be omitted. basic\_group\_setup creates a basic version of $TARGET/etc/group where it does not already exist.

## BASIC\_PASSWD\_SETUP

Removing packages from the normal Debian debootstrap set can mean that certain critical files can be omitted. basic\_passwd\_setup creates a basic version of $TARGET/etc/passwd where it does not already exist.

## BUSYBOX\_INITTAB

Note: this function overwrites an existing $TARGET/etc/inittab

busybox does not support runlevels and so the /etc/inittab file needs to be modified to support busybox. Currently, this function overwrites an existing $TARGET/etc/inittab - this is likely to change in future versions.

## BUSYBOX\_RCS

Note: this function overwrites an existing $TARGET/etc/init.d/rcS

busybox does not support runlevels and so the /etc/init.d/rcS script needs to be modified to support busybox. Currently, this function overwrites an existing $TARGET/etc/init.d/rcS - this is likely to change in future versions.

## CHECK\_DIRS

Check that the $BUILDPLACE, $BUILDRESULT and $APTCACHE directories exist (used by empdebuild).

## CHECKARCH

Calls check\_arch from Debian::DpkgCross using perl. The perl call dies if the specified string does not match a supported architecture.

## COPY\_HOST\_CONFIGURATION

Copy hosts, hostname and resolv.conf from the system /etc/ directory and adapts /etc/hostname to use a different name (emdebian-$ARCH).

## CREATE\_EMDEBIANTGZ

Modified version of the equivalent function in pbuilder-modules to extract the compressed chroot (used by empdebuild).

## DISABLE\_APT\_RECOMMENDS

Enforces a default of not installing recommended packages inside the chroot.

## EXTRA\_ETC\_RCD

Removing packages from the normal Debian debootstrap set can mean that certain critical files can be omitted. extra\_etc\_rcd creates a basic version of $TARGET/etc/rcS.d where it does not already exist.

## EXTRACTEMBUILDPLACE

Modified version of the equivalent function in pbuilder-modules to extract the compressed chroot (used by empdebuild).

## MAKE\_DPKG\_DIRS

Prepare for unpacking and general dpkg work by setting up $TARGET/var/lib/dpkg/status and $TARGET/var/lib/dpkg/available.

## PREPARE\_PROC

Ensure that $TARGET/proc and $TARGET/sys exist so that proc and sys can be mounted automatically.

## PREPARE\_VAR

Ensure that $TARGET/var/log/ and $TARGET/var/spool exist so that various installation routines can proceed.

## SET\_APPROX\_TIME

Normal Debian installations have a network connection and typical Debian desktop boxes also have a backup battery. Some embedded machines do not have either of these systems, making it impossible to store or retrieve even a vaguely close indication of the current time.

set\_approx\_time uses the systems available on the build machine to store an approximate indication of the time that the root filesystem was created and write that time to a file in the root filesystem itself. For most purposes, this is sufficient for the purposes of setting up the root filesystem to the point where a network connection can be created and a call can be made to an internet clock using **ntpdate-debian**.

## SET\_CDEBCONF\_DEFAULT

Adds "export DEBCONF\_USE\_CDEBCONF=true" to $TARGET/etc/profile for cdebconf support.

## SYMLINK\_RCS

Call repeatedly to create init symlinks, using the template $TARGET/etc/rcS.d/S$number$file

**file**

file is the filename in $TARGET/etc/init.d/

**number**

number is the number for the link in the init sequence.

## UNPACK\_DEBOOTSTRAP

Specialized routine that replaces the normal second stage of debootstrap (you may consider it a series of hacks if you prefer). unpack uses dpkg to extract the files from the .deb package and process the control information. Unlike **dpkg** **--unpack**, the unpack routine does **NOT** run any maintainer scripts which would inevitably fail in a cross built environment. Instead, it updates the relevant dpkg status and database files in the root filesystem and leaves the package in the unpacked state.

unpack\_debootstrap also sets up the busybox applets - future versions may split this functionality into a separate function.

unpack\_debootstrap also performs checks on /usr/sbin/invoke-rc.d and /usr/sbin/update-rc.d - future versions may split this functionality into a separate function.

Finally, unpack\_debootstrap removes all .deb package files from /var/cache/apt/archives. The remaining task (dpkg --configure -a) is performed via emsecondstage.

## X\_FEIGN\_INSTALL

Copied from debootstrap suite scripts to make a basic installation of a .deb package - although this is the basis of unpack\_debootstrap, it is only really used for dpkg itself.

## AUTHOR

*empbuilderlib* was written by Neil Williams \<codehelp@debian.org\>.

This manual page was written by Neil Williams \<codehelp@debian.org\>

## SEE ALSO

See also *apt-cross* (1), *dpkg-cross* (1), *emdebian-tools* (1).

## AUTHOR

**Emdebian**

**Neil Williams**

-

  Author.

## COPYRIGHT
