slim down the package to just multistrap

git-svn-id: http://emdebian.org/svn/current@7045 563faec7-e20c-0410-992a-a66f704d0ccd
This commit is contained in:
codehelp 2010-04-05 20:03:39 +00:00
parent 0435ea7b19
commit 16fde96c97
27 changed files with 1125 additions and 4263 deletions

5
debian/changelog vendored
View file

@ -1,8 +1,9 @@
emdebian-rootfs (2.1.0) experimental; urgency=low multistrap (2.1.0) experimental; urgency=low
* Experimental branch to replace pbuilder support in Crush. * Experimental branch to replace pbuilder support in Crush.
* Drop emsandbox and use experimental multistrap.
-- Neil Williams <codehelp@debian.org> Mon, 05 Apr 2010 20:41:47 +0100 -- Neil Williams <codehelp@debian.org> Mon, 05 Apr 2010 20:46:43 +0100
emdebian-rootfs (2.0.9) unstable; urgency=low emdebian-rootfs (2.0.9) unstable; urgency=low

39
debian/control vendored
View file

@ -1,41 +1,23 @@
Source: emdebian-rootfs Source: multistrap
Section: utils Section: utils
Priority: extra Priority: optional
Maintainer: Neil Williams <codehelp@debian.org> Maintainer: Neil Williams <codehelp@debian.org>
Uploaders: Wookey <wookey@debian.org> Uploaders: Wookey <wookey@debian.org>
Build-Depends: cdbs, debhelper (>= 5), po4a (>= 0.37.1), po-debconf Build-Depends: cdbs, debhelper (>= 5), po4a (>= 0.37.1), po-debconf
Build-Depends-Indep: devscripts, docbook-xml, docbook-xsl, gnupg, Build-Depends-Indep: devscripts, gnupg, intltool
libxml2-utils, xml-core, xsltproc, intltool
Standards-Version: 3.8.4 Standards-Version: 3.8.4
Homepage: http://www.emdebian.org/ Homepage: http://www.emdebian.org/
Vcs-Browser: http://buildd.emdebian.org/svn/browser/current/host/trunk/emdebian-rootfs/trunk/ Vcs-Browser: http://buildd.emdebian.org/svn/browser/current/host/trunk/emdebian-rootfs/trunk/
Vcs-Svn: http://buildd.emdebian.org/repos/current/host/trunk/emdebian-rootfs/trunk/ Vcs-Svn: http://buildd.emdebian.org/repos/current/host/trunk/emdebian-rootfs/trunk/
Package: emdebian-rootfs
Architecture: all
Depends: ${perl:Depends}, ${misc:Depends}, apt, apt-cross (>= 0.5.0),
binutils-multiarch, debootstrap (>= 1.0.4), dpkg-cross (>= 2.1.0),
devscripts, emdebian-archive-keyring, multistrap, pbuilder, sudo, ucf,
libparse-debian-packages-perl
Replaces: emdebian-tools (<= 1.4.3)
Recommends: gcc
Suggests: deb-gview, debian-xcontrol, screen | minicom
Description: emdebian root filesystem support
Scripts for preparing root filesystems of Emdebian for specific
machines and variants.
.
Root filesystem tarballs created with emsandbox need minimal
configuration on the embedded device before the first boot.
.
Supports customisation of package selection and of files created
within the root filesystem.
Package: multistrap Package: multistrap
Section: admin Section: admin
Architecture: all Architecture: all
Depends: ${perl:Depends}, ${misc:Depends}, apt, realpath, Depends: ${perl:Depends}, ${misc:Depends}, apt, realpath,
libconfig-auto-perl, libparse-debian-packages-perl libconfig-auto-perl, libparse-debian-packages-perl
Replaces: emdebian-rootfs (<= 1.6.0) Replaces: emdebian-rootfs (<= 2.0.9)
Conflicts: emdebian-rootfs (<= 2.0.9)
Provides: emdebian-rootfs
Description: multiple repository bootstrap based on apt Description: multiple repository bootstrap based on apt
A debootstrap replacement with multiple repository support, A debootstrap replacement with multiple repository support,
using apt to handle all dependency issues and conflicts. using apt to handle all dependency issues and conflicts.
@ -49,3 +31,12 @@ Description: multiple repository bootstrap based on apt
. .
Unlike debootstrap, multistrap relies on working versions of Unlike debootstrap, multistrap relies on working versions of
dpkg and apt outside the final filesystem. dpkg and apt outside the final filesystem.
.
Multistrap supercedes emdebian-rootfs and includes support
for preparing root filesystems for specific machines and variants.
Also included is the previous emdebian-rootfs support for
customisation of package selection and of files created
within the root filesystem.
.
Root filesystems created with multistrap need minimal
configuration on the embedded device before the first boot.

View file

@ -1,17 +0,0 @@
emsandbox ./usr/sbin
embootstrap ./usr/share/emdebian-tools/
empbuilderlib ./usr/share/emdebian-tools/
emsecondstage ./usr/share/emdebian-tools/
update-rc.d ./usr/share/emdebian-tools/
emrootfslib ./usr/share/emdebian-tools/
emdebian.crossd ./usr/share/emdebian-tools/
emdebian.gtk ./usr/share/emdebian-tools/
emdebian.grip ./usr/share/emdebian-tools/
emdebian.gpe ./usr/share/emdebian-tools/
emdebian.coreutils ./usr/share/emdebian-tools/
doc/emdebian-rootfs/man/* ./usr/share/man/
examples/packages.conf ./usr/share/doc/emdebian-rootfs/examples/
examples/setup.sh ./usr/share/doc/emdebian-rootfs/examples/
examples/config.sh ./usr/share/doc/emdebian-rootfs/examples/
examples/README ./usr/share/doc/emdebian-rootfs/examples/
emdebian-rootfs ./etc/bash_completion.d/

View file

@ -1,3 +0,0 @@
# See 555330 - bug in the lintian test.
emdebian-rootfs: manpage-has-errors-from-man *

View file

@ -1,35 +0,0 @@
#! /bin/sh
# clear out the now unsupported emsandbox conf file.
set -e
case "$1" in
configure)
if [ -f '/etc/emsandbox.conf' ]; then
# Remove the configuration files
if [ -e /usr/bin/ucf ]; then
ucfr --purge emdebian-rootfs /etc/emsandbox.conf
ucf --purge /etc/emsandbox.conf
fi
rm /etc/emsandbox.conf
rm -f /etc/emsandbox.conf.ucf-old
rm -f /etc/emsandbox.conf.ucf-new
rm -f /etc/emsandbox.conf.ucf-dist
fi
;;
remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear)
;;
*)
echo "postinst called with unknown argument \`$1'" >&2
exit 1
;;
esac
# dh_installdeb will replace this with shell code automatically
# generated by other debhelper scripts.
#DEBHELPER#
exit 0

View file

@ -1,9 +1,11 @@
em_multistrap ./usr/sbin/
multistrap ./usr/sbin/ multistrap ./usr/sbin/
doc/multistrap/man/* ./usr/share/man/ doc/multistrap/man/* ./usr/share/man/
examples/multistrap-example.conf ./usr/share/doc/multistrap/examples/ examples/multistrap-example.conf ./usr/share/doc/multistrap/examples/
examples/sid.conf ./usr/share/multistrap/ examples/sid.conf ./usr/share/multistrap/
examples/squeeze.conf ./usr/share/multistrap/ examples/squeeze.conf ./usr/share/multistrap/
examples/lenny.conf ./usr/share/multistrap/ examples/lenny.conf ./usr/share/multistrap/
examples/setup.sh ./usr/share/doc/multistrap/examples/
examples/config.sh ./usr/share/doc/multistrap/examples/
update-rc.d ./usr/share/multistrap/
check-deps.sh ./usr/share/multistrap/ check-deps.sh ./usr/share/multistrap/
bash/multistrap ./etc/bash_completion.d/ bash/multistrap ./etc/bash_completion.d/

View file

@ -1,3 +0,0 @@
/usr/share/man/pt/man1/em_multistrap.1 /usr/share/man/pt/man1/multistrap.1
/usr/share/man/fr/man1/em_multistrap.1 /usr/share/man/fr/man1/multistrap.1
/usr/share/man/man1/em_multistrap.1 /usr/share/man/man1/multistrap.1

View file

@ -1,146 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE refentry PUBLIC "-//OASIS//DTD DocBook XML V4.1.2//EN" "http://www.oasis-open.org/docbook/xml/4.1.2/docbookx.dtd" [
<!ENTITY emsandbox SYSTEM "emsandbox.1.xml">
<!ENTITY empbuilderlib SYSTEM "empbuilderlib.3.xml">
<!ENTITY emrootfslib SYSTEM "emrootfslib.3.xml">
]>
<book label="Index" status="1.8.0">
<bookinfo>
<title>emdebian-rootfs</title>
<date>Sun 11 Jan 2009 19:55:45 GMT</date>
<releaseinfo>Release: 1.8.0</releaseinfo>
<orgname>Emdebian</orgname>
<author>
<firstname>Neil</firstname>
<surname>Williams</surname>
<personblurb>
<para>Debian and Emdebian developer.</para>
</personblurb>
</author>
<legalnotice id="GPL">
<title>The GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007</title>
<para>This documentation is part of emdebian-tools.</para>
<para>emdebian-tools is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 3 of the License, or
(at your option) any later version.</para>
<para>This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.</para>
<para>You should have received a copy of the GNU General Public License
along with this program. If not, see
<ulink url="http://www.gnu.org/licenses/">http://www.gnu.org/licenses/</ulink>.
</para>
<note>
<para>In Debian you can find a copy of the GNU General
Public Licence in <filename>/usr/share/common-licenses/GPL-3</filename></para>
</note>
</legalnotice>
</bookinfo>
<preface id="preface">
<title>Emdebian Tools Reference</title>
<formalpara>
<title>Purpose</title>
<para>This documentation consists primarily of the manpages for <emphasis>emdebian-tools</emphasis>
but also contains useful references and links to further reading on a variety of topics related
to Emdebian and cross building. It is intended to be read alongside the
<ulink url="http://www.emdebian.org/">Emdebian website</ulink> and
<ulink url="http://wiki.debian.org/Embedded_Debian">Emdebian Wiki</ulink>.
</para>
</formalpara>
<para>Some scripts embed the manpage content in the perl script as pod content. These manpages
are listed separately in the HTML versions.
</para>
</preface>
<chapter label="1" id="manpages"><title>Emdebian Tools manpages</title>
&emsandbox;
&empbuilderlib;
&emrootfslib;
</chapter>
<chapter label="2" id="others">
<title>Other manpages and external links</title>
<para>These manpages are generated from perl instead of XML and are not currently listed
in the main table of contents. The HTML version is hosted separately:
</para>
<refsect1 id="compare">
<title>Debian::Packages::Compare</title>
<para><ulink url="DebianPackagesCompare.html">Debian::Packages::Compare</ulink>
manpage.</para>
</refsect1>
<refsect1 id="dh_gentdeb">
<title>dh_gentdeb</title>
<para><ulink url="dh_gentdeb.html">dh_gentdeb</ulink> manpage.</para>
</refsect1>
<refsect1 id="dpkg-gentdeb">
<title>dpkg-gentdeb</title>
<para><ulink url="dpkg-gentdeb.html">dpkg-gentdeb</ulink> manpage.</para>
</refsect1>
<refsect1 id="emtargetcmp">
<title>emtargetcmp</title>
<para><ulink url="emtargetcmp.html">emtargetcmp</ulink> manpage</para>
</refsect1>
<refsect1 id="emprunecross">
<title>emprunecross</title>
<para><ulink url="emprunecross.html">emprunecross</ulink> manpage</para>
</refsect1>
<refsect1 id="module">
<title>Emdebian::Tools</title>
<para><ulink url="EmdebianTools.html">Emdebian::Tools</ulink> function
reference.
</para>
</refsect1>
<refsect1 id="eminstalltdeb">
<title>em_installtdeb</title>
<para><ulink url="em_installtdeb.html">em_installtdeb</ulink> manpage</para>
</refsect1>
<refsect1 id="emrecent">
<title>emrecent</title>
<para><ulink url="emrecent.html">emrecent</ulink> manpage</para>
</refsect1>
<refsect1 id="emgrip">
<title>emgrip</title>
<para><ulink url="emgrip.html">emgrip</ulink> manpage</para>
</refsect1>
<refsect1 id="em_autogrip">
<title>em_autogrip</title>
<para><ulink url="em_autogrip.html">em_autogrip</ulink> manpage</para>
</refsect1>
<refsect1 id="emdebcheck">
<title>emdebcheck</title>
<para><ulink url="emdebcheck.html">emdebcheck</ulink> manpage</para>
</refsect1>
<refsect1 id="emcache">
<title>emcache</title>
<para><ulink url="emcache.html">emcache</ulink> manpage</para>
</refsect1>
<refsect1 id="emdepends">
<title>emdepends</title>
<para><ulink url="emdepends.html">emdepends</ulink> manpage</para>
</refsect1>
<refsect1 id="splitout_tdeb">
<title>splitout_tdeb</title>
<para><ulink url="splitout_tdeb.html">dplitout_tdeb</ulink> manpage.</para>
</refsect1>
<refsect1>
<title>WWW references</title>
<itemizedlist>
<listitem>
<para>
<ulink url="http://www.emdebian.org/">Emdebian.org website</ulink>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://www.linux.codehelp.co.uk/emdebian/depends.html">Emdebian dependency maps</ulink>
</para>
</listitem>
<listitem>
<para>
<ulink url="http://www.linux.codehelp.co.uk/emdebian/">Emdebian presentation</ulink>
</para>
</listitem>
</itemizedlist>
</refsect1>
</chapter>
</book>

View file

@ -1,77 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<refentry id="empbuilderlib">
<refentryinfo>
<productname>empbuilderlib</productname>
<productnumber/>
</refentryinfo>
<refmeta>
<refentrytitle>empbuilderlib</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo class="source">EMDEBIAN-ROOTFS</refmiscinfo>
<refmiscinfo class="manual">EMDEBIAN-ROOTFS</refmiscinfo>
</refmeta>
<refnamediv id="name">
<refname>empbuilderlib</refname>
<refpurpose>Common functions for Emdebian chroots</refpurpose>
</refnamediv>
<refsect1 id="description">
<title>DESCRIPTION</title>
<para><emphasis>empbuilderlib</emphasis> is intended solely for use on
the build machine. Do not use these functions in second_stage_install !
<emphasis>empbuilderlib</emphasis> requires <emphasis role="bold">perl</emphasis>!
</para>
<para><emphasis>empbuilderlib</emphasis> is a shell library which
requires perl and pbuilder (which means bash!).
<emphasis>empbuilderlib</emphasis> draws in POSIX shell functions
from emrootfslib to be able to call in functions from
first_stage_install within debootstrap. The only reasons to continue
putting new functions in here are if:</para>
<orderedlist>
<listitem>
<para>The functions are only useful to create cross-building chroots OR</para>
</listitem>
<listitem>
<para>the functions need to call pbuilder code directly and are not
necessary within first_stage_install.
</para>
</listitem>
</orderedlist>
<para>There should be no need to call pbuilder code within scripts that
generate a root filesystem.</para>
</refsect1>
<refsect1 id="autoclean_aptcache">
<title>autoclean_aptcache</title>
<para>Same as the pbuilder option but run by default in <command>empdebuild</command>
to remove obsolete .deb archives from the apt cache directories used by
<command>empdebuild</command>.
</para>
</refsect1>
<refsect1 id="copy_host_configuration">
<title>copy_host_configuration</title>
<para>Copy hosts, hostname and resolv.conf from the system /etc/
directory and adapts /etc/hostname to use a different
name (emdebian-$ARCH).
</para>
</refsect1>
<refsect1 id="extractembuildplace">
<title>extractembuildplace</title>
<para>Modified version of the equivalent function in pbuilder-modules
to extract the compressed chroot (used by empdebuild).</para>
</refsect1>
<refsect1>
<title>Author</title>
<para><emphasis>empbuilderlib</emphasis> was written
by Neil Williams <email>codehelp@debian.org</email>.
</para>
<para>This manual page was written by Neil Williams
<email>codehelp@debian.org</email>
</para>
</refsect1>
<refsect1 id="seealso">
<title>SEE ALSO</title>
<para>See also <filename>apt-cross</filename> (1),
<filename>dpkg-cross</filename> (1), <emphasis>emdebian-tools</emphasis> (1),
<filename>emrootfslib</filename> (3).
</para>
</refsect1>
</refentry>

View file

@ -1,214 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<refentry id="emrootfslib">
<refentryinfo>
<productname>emrootfslib</productname>
<productnumber/>
</refentryinfo>
<refmeta>
<refentrytitle>emrootfslib</refentrytitle>
<manvolnum>3</manvolnum>
<refmiscinfo class="source">EMDEBIAN-ROOTFS</refmiscinfo>
<refmiscinfo class="manual">EMDEBIAN-ROOTFS</refmiscinfo>
</refmeta>
<refnamediv id="name">
<refname>emrootfslib</refname>
<refpurpose>Common functions for Emdebian root filesystems</refpurpose>
</refnamediv>
<refsect1 id="description">
<title>DESCRIPTION</title>
<para><emphasis>emrootfslib</emphasis> is intended solely for use on
the build machine. Do not use these functions in second_stage_install !
<emphasis>emrootfslib</emphasis> requires <emphasis role="bold">perl</emphasis>!
</para>
<para>There should be no need to call pbuilder code within scripts that
generate a root filesystem and bash code must not be used in
<emphasis>emrootfslib</emphasis>.</para>
</refsect1>
<refsect1 id="basic_etc_fstab">
<title>basic_etc_fstab</title>
<para>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.
</para>
</refsect1>
<refsect1 id="basic_group_setup">
<title>basic_group_setup</title>
<para>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.
</para>
</refsect1>
<refsect1 id="basic_passwd_setup">
<title>basic_passwd_setup</title>
<para>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.
</para>
</refsect1>
<refsect1 id="busybox_inittab">
<title>busybox_inittab</title>
<para>Note: this function overwrites an existing $TARGET/etc/inittab
</para>
<para>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.
</para>
</refsect1>
<refsect1 id="busybox_rcS">
<title>busybox_rcS</title>
<para>Note: this function overwrites an existing $TARGET/etc/init.d/rcS
</para>
<para>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.
</para>
</refsect1>
<refsect1 id="check_dirs">
<title>check_dirs</title>
<para>Check that the $BUILDPLACE, $BUILDRESULT and $APTCACHE directories
exist (used by empdebuild).</para>
</refsect1>
<refsect1 id="checkarch">
<title>checkarch</title>
<para>Calls check_arch from Debian::DpkgCross using perl.
The perl call dies if the specified string does not match a
supported architecture.</para>
</refsect1>
<refsect1 id="create_emdebiantgz">
<title>create_emdebiantgz</title>
<para>Modified version of the equivalent function in pbuilder-modules
to extract the compressed chroot (used by empdebuild).</para>
</refsect1>
<refsect1 id="disable_apt_recommends">
<title>disable_apt_recommends</title>
<para>Enforces a default of not installing recommended packages inside the
chroot.
</para>
</refsect1>
<refsect1 id="extra_etc_rcd">
<title>extra_etc_rcd</title>
<para>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.
</para>
</refsect1>
<refsect1 id="make_dpkg_dirs">
<title>make_dpkg_dirs</title>
<para>Prepare for unpacking and general dpkg work by setting up
$TARGET/var/lib/dpkg/status and $TARGET/var/lib/dpkg/available.
</para>
</refsect1>
<refsect1 id="prepare_proc">
<title>prepare_proc</title>
<para>Ensure that $TARGET/proc and $TARGET/sys exist so that
proc and sys can be mounted automatically.
</para>
</refsect1>
<refsect1 id="prepare_var">
<title>prepare_var</title>
<para>Ensure that $TARGET/var/log/ and $TARGET/var/spool exist so
that various installation routines can proceed.
</para>
</refsect1>
<refsect1 id="set_approx_time">
<title>set_approx_time</title>
<para>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.
</para>
<para>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 <command>ntpdate-debian</command>.
</para>
</refsect1>
<refsect1 id="set_cdebconf_default">
<title>set_cdebconf_default</title>
<para>Adds "export DEBCONF_USE_CDEBCONF=true" to
$TARGET/etc/profile for cdebconf support.
</para>
</refsect1>
<refsect1 id="symlink_rcS">
<title>symlink_rcS</title>
<para>Call repeatedly to create init symlinks, using the template
$TARGET/etc/rcS.d/S$number$file
</para>
<variablelist remap="TP">
<varlistentry>
<term>
<option>file</option>
</term>
<listitem>
<para>file is the filename in $TARGET/etc/init.d/
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>number</option>
</term>
<listitem>
<para>number is the number for the link in the init sequence.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="unpack_debootstrap">
<title>unpack_debootstrap</title>
<para>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 <command>dpkg</command>
<option>--unpack</option>, the unpack routine does
<emphasis role="bold">NOT</emphasis> 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.
</para>
<para>unpack_debootstrap also sets up the busybox applets - future
versions may split this functionality into a separate function.
</para>
<para>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.
</para>
<para>Finally, unpack_debootstrap removes all .deb package files
from /var/cache/apt/archives. The remaining task (dpkg --configure -a)
is performed via emsecondstage.</para>
</refsect1>
<refsect1 id="x_feign_install">
<title>x_feign_install</title>
<para>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.
</para>
</refsect1>
<refsect1>
<title>Author</title>
<para><emphasis>empbuilderlib</emphasis> was written
by Neil Williams <email>codehelp@debian.org</email>.
</para>
<para>This manual page was written by Neil Williams
<email>codehelp@debian.org</email>
</para>
</refsect1>
<refsect1 id="seealso">
<title>SEE ALSO</title>
<para>See also <filename>apt-cross</filename> (1),
<filename>dpkg-cross</filename> (1), <emphasis>emdebian-tools</emphasis> (1),
<filename>empdebuilderlib</filename> (3).
</para>
</refsect1>
</refentry>

View file

@ -1,452 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<refentry id="emsandbox">
<refentryinfo>
<productname>emsandbox</productname>
<productnumber/>
</refentryinfo>
<refmeta>
<refentrytitle>emsandbox</refentrytitle>
<manvolnum>1</manvolnum>
<refmiscinfo class="source">EMDEBIAN-TOOLS</refmiscinfo>
<refmiscinfo class="manual">EMDEBIAN-TOOLS</refmiscinfo>
</refmeta>
<refnamediv id="name">
<refname>emsandbox</refname>
<refpurpose>create Emdebian root filesystems</refpurpose>
</refnamediv>
<refsynopsisdiv>
<cmdsynopsis>
<command>emsandbox</command>
<group>
<arg>-a</arg>
<arg>--arch </arg>
<replaceable> ARCHITECTURE</replaceable>
</group>
<group>
<arg>--create</arg>
<arg>create</arg>
</group>
<group>
<group>
<arg>-s</arg>
<arg>--script</arg>
</group>
<replaceable> FILENAME</replaceable>
</group>
<group>
<arg>-S</arg>
<arg>--suite</arg>
<replaceable> NAME</replaceable>
</group>
<group>
<arg>--machine-path</arg>
<replaceable>PATH</replaceable>
</group>
<group>
<arg>-m</arg>
<arg>--machine</arg>
<replaceable> NAME</replaceable>
<group>
<arg>-v</arg>
<arg>--variant</arg>
<replaceable> NAME</replaceable>
</group>
</group>
</cmdsynopsis>
</refsynopsisdiv>
<refsect1 id="shell">
<title>SHELL INTERPRETERS</title>
<para><command>emsandbox</command> is bash code and uses
<command>embootstrap</command> which is bash code and also sources
pbuilder code which is also bash code. <command>debootstrap</command>
re-executes itself with the default shell and then tries to source the
suite script which fails because the re-executed copy of debootstrap is
now running under the default shell, not bash.
</para>
<para>This problem can show up as a failure within <command>debootstrap</command>
</para>
<programlisting>
I: Retrieving zlib1g
I: Validating zlib1g
</programlisting>
<para>The next line should be:</para>
<programlisting>
I: Extracting base-passwd...
</programlisting>
<para>Unfortunately, this is a result of the default shell
interpreter in Debian being changed after the scripts were written
and it is a non-trivial problem. It is not possible for
<command>embootstrap</command> could migrate to cdebootstrap currently.
</para>
<para>The only current solution is to change your default shell to
/bin/bash inside the environment running <command>emsandbox</command>.
</para>
</refsect1>
<refsect1 id="description">
<title>DESCRIPTION</title>
<para><command>emsandbox</command> supports customised generation of
basic root filesystems from cross-built Emdebian packages, ready for
unpacking and configuring on an embedded device.
</para>
<para>Note that <filename>emsandbox</filename> does not support all the
options available to <filename>debootstrap</filename>. Some of the
debootstrap options that are supported are implemented as machine
specific configuration files in your Emdebian work directory.
(See <option>--machine</option> and <option>--variant</option>.)
</para>
<para><filename>emsandbox</filename> is a wrapper for debootstrap to prepare
an Emdebian root filesystem, using Emdebian packages and a native chroot
via 'debootstrap --foreign' and code from pbuilder.
</para>
<para>The Emdebian rootfs, as generated by <command>emsandbox</command>
is not fully configured - packages are unpacked and certain support
files are created but none of the packages are configured (not even
the pre-install scripts). This last stage is the only process that
<emphasis>must</emphasis> be run on the actual device
<emphasis>before the first boot</emphasis>, using the <command>emsecondstage</command>
script which requires a working <command>chroot</command> environment.
Typically, <command>emsecondstage</command> is run from some kind of
minimal bootloader environment that has sufficient support for mounting
subsystems like proc and filesystems like the root filesystem partition
and can chroot into the root filesystem. This method means that the
majority of the work of creating the root filesystem can be done on
the build machine.
</para>
<para>The tarball created by <command>emsandbox</command> should be
copied onto the target device and unpacked using:
</para>
<programlisting>
# cd /mnt/target/dir
# tar -xzpf emdebian-arm.tgz
</programlisting>
<para>Immediately after unpacking, start the package configuration
by running <command>./emsecondstage</command> on the target device.
(Configuration involves running the cross-built binaries and is the
only part of the process that must be run on the target device.)
</para>
<para><command>emsecondstage</command> should <emphasis>always</emphasis>
be run from the directory into which it was installed.
</para>
<programlisting>
# ./emsecondstage
</programlisting>
</refsect1>
<refsect1 id="commands">
<title>COMMANDS</title>
<variablelist remap="TP">
<varlistentry>
<term><option>--create</option>|<option>create</option></term>
<listitem>
<para>Runs <command>debootstrap</command> <option>--foreign</option>
with a modified suite rule set to create a basic Emdebian rootfs.
</para>
<para>Checks for an existing chroot and exits if one is found.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-h</option>|<option>--help</option></term>
<listitem>
<para>print the usage message and exit.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--version</option>
</term>
<listitem>
<para>print the usage message and exit.</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="options">
<title>OPTIONS</title>
<variablelist remap="TP">
<varlistentry>
<term><option>-a</option>|<option>--arch</option><replaceable> ARCHITECTURE</replaceable></term>
<listitem>
<para>Override the <command>dpkg-cross</command> default architecture
for this operation on the chroot.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-s</option>|<option>--script</option><replaceable> FILENAME</replaceable></term>
<listitem>
<para>Override the default package selection and installation
script with a customised debootstrap suite script (written in shell
and compatible with whichever shell interpreter is to be installed
on the target).
</para>
<para>Some customised scripts are provided with emdebian-tools. The
default uses the standard Emdebian 'busybox' package with 'dpkg' and
'apt'. Replacement scripts need to be full debootstrap suite shell
scripts that specify how to complete the first and second stage
installations.
</para>
<para>Customised scripts packages with <emphasis>emdebian-tools</emphasis>
include scripts for a root filesystem including libgtk2.0-0 and a complete
GPE root filesystem.</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>--machine-path</option>
<replaceable> PATH</replaceable>
</term>
<listitem>
<para>Override the default path to machine and variant configuration. By
default, emsandbox uses <filename>${WORK}/machine</filename> where
<userinput>$WORK</userinput> is the working directory specified
to <emphasis>emdebian-tools</emphasis> in the debconf configuration.
The specified path must already exist and contain the relevant
<filename>packages.conf</filename> configuration as well as the
<filename>setup.sh</filename> and <filename>config.sh</filename> shell
scripts (which may be empty).
</para>
<para>Examples of <filename>packages.conf</filename>,
<filename>setup.sh</filename> and <filename>config.sh</filename> are
in <filename>/usr/share/doc/emdebian-rootfs/examples/</filename>
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-m</option>|<option>--machine</option><replaceable> MACHINE</replaceable></term>
<listitem>
<para>Load machine specific configuration data from your Emdebian
working directory. If no variant is specified, config is read from
<filename>$WORK/machine/$MACHINE/default/</filename> where $WORK
is the work directory specified in debconf for emdebian-tools.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-v</option>|<option>--variant</option><replaceable> VARIANT</replaceable></term>
<listitem>
<para>Load variant specific configuration data from your Emdebian
working directory. Requires <option>--machine</option>. Configuration
data is read from <filename>$WORK/machine/$MACHINE/$VARIANT/</filename> where $WORK
is the work directory specified in debconf for emdebian-tools.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term><option>-S</option>|<option>--suite</option><replaceable> NAME</replaceable></term>
<listitem>
<para>Override the default suite [unstable] and specify another
supported suite. Note that if the Emdebian repository is used,
the suite chosen <emphasis>must</emphasis> be a normal
Emdebian/Debian suite name from 'unstable, testing or sid', or
a Debian release codename for a release including or later
than lenny. No other suite name is supported in Emdebian.
</para>
<para>The selected suite is set in the root filesystem as the
default suite for apt to use when looking for updates.
</para>
</listitem>
</varlistentry>
</variablelist>
</refsect1>
<refsect1 id="machinevariants">
<title>Machine variants</title>
<para><command>emsandbox</command> supports a set of customisation routines
for each combination of machine and variant, allowing the rootfs to be customised
to specific variants of a specific machine. Configuration data is stored in the
<filename>machine</filename> subdirectory of your Emdebian work directory.
Using the <option>-m</option> option to <command>emsandbox</command> loads
<filename>packages.conf</filename> from the <filename>$WORK/machine/$MACHINE/default</filename>
subdirectory prior to starting debootstrap. Once the first stage install is complete,
<command>emsandbox</command> calls <filename>setup.sh</filename> from the same
directory, passing the location and architecture of the tarball, so that other
fine tuning can take place prior to creating the tarball. At this stage, any
operations inside the rootfs must not try to execute any binaries within the
rootfs. Immediately before creating the tarball, <filename>config.sh</filename>
is copied into the <filename>/machine/$MACHINE/default/</filename> directory
of the rootfs, ready to be called when <command>emsecondstage</command> has
completed the second stage of the debootstrap process.
</para>
<para>Skeleton versions of <filename>packages.conf</filename>,
<filename>setup.sh</filename> and <filename>config.sh</filename> are available
in <filename>/usr/share/emdebian-tools/machine/</filename>.
</para>
<para><filename>packages.conf</filename> is intended to be the principal place
for adjusting the emsandbox tarball to suit the needs of specific machine variants.
<filename>setup.sh</filename> and <filename>config.sh</filename> can fine tune
the results but in order to avoid reinventing the wheel, if more than a few
machines need similar adjustments to the same files, future versions of
<filename>packages.conf</filename> will collate those into a single
configuration parameter available to all.
</para>
<para><filename>packages.conf</filename> supports:</para>
<variablelist>
<varlistentry>
<term>
<option>INCLUDE</option>
</term>
<listitem>
<para>Add a comma separated list of package names to the list of packages
added to the tarball and installed in the second stage. Currently, debootstrap
has problems with multiple repositories so either upload this package to the
same repository as your other packages or create an apt-proxy that can serve
as a local repository, set it in <option>PROXY</option> and specify a usable
mirror for the device in <option>MIRROR</option>.</para>
<para>DEFAULT: empty</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>SCRIPT</option>
</term>
<listitem>
<para>Overrides the default emsandbox suite-script that debootstrap uses to
determine the base and required packages and the all important sequence in which
the packages can be installed. SCRIPT can be overridden on the emsandbox command line.
</para>
<para>DEFAULT: <filename>/usr/share/emdebian-tools/emdebian.crossd</filename></para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>MIRROR</option>
</term>
<listitem>
<para>Overrides the default emsandbox mirror. This repository will be set in
<filename>/etc/apt/sources.list</filename> and will also be used by debootstrap to obtain
all packages for the tarball unless <option>PROXY</option> is also set.
</para>
<para>DEFAULT: http://www.emdebian.org/crush/</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>PROXY</option>
</term>
<listitem>
<para>Specifies a separate repository to pass to debootstrap that may be local or
otherwise not intended for use once the tarball is installed. Use <option>MIRROR</option>
to set the same value in debootstrap and <filename>/etc/apt/sources.list</filename>.
If <option>PROXY</option> is specified without <option>MIRROR</option>, the default
emsandbox MIRROR (http://buildd.emdebian.org/emdebian/) will be written into
<filename>/etc/apt/sources.list</filename>.</para>
<para>DEFAULT: empty</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>TARBALL_NAME</option>
</term>
<listitem>
<para>Overrides the default name (emdebian-$ARCH) of the tarball. Do not specify a path here,
just a filename with the .tgz suffix.</para>
<para>DEFAULT: emdebian-$ARCH.tgz where $ARCH is specified to emsandbox or as the dpkg-cross
default architecture.
</para>
</listitem>
</varlistentry>
<varlistentry>
<term>
<option>SUITE</option>
</term>
<listitem>
<para>Override the default suite [unstable] and specify another
supported suite. Note that if the Emdebian repository is used,
the suite chosen <emphasis>must</emphasis> be a normal
Emdebian/Debian suite name from 'unstable, testing or sid', or
a Debian release codename for a release including or later
than lenny. No other suite name is supported in Emdebian.
</para>
<para>The selected suite is set in the root filesystem as the
default suite for apt to use when looking for updates.
</para>
<para>Not recommended to be changed.
</para>
<para>DEFAULT: unstable
</para>
</listitem>
</varlistentry>
</variablelist>
<para>Due to limitations in the current debootstrap support, the only way
of adding packages to the first stage is by providing a customised suite
script. Even if emsandbox migrates to using a tool from Stag to overcome
shortcomings in debootstrap, support for packages.conf, setup.sh and config.sh
will remain.</para>
</refsect1>
<refsect1 id="automation">
<title>Automating rootfs builds</title>
<para>Providing you are trying to build a root filesystem for an
architecture supported within Debian, <emphasis>emdebian-tools</emphasis>
can help you automate the package builds.
See <filename>em_autobuild</filename> (1)</para>
</refsect1>
<refsect1 id="shell">
<title>SHELL variables</title>
<para>Note that the Debian chroot program from coreutils expects you
to want the same shell outside the chroot as you want to use inside
the chroot. The typical Debian default shell in <filename>/etc/passwd</filename>
is bash which is not present in the Emdebian rootfs so <command>chroot</command>
needs the <option>/bin/sh</option> option.</para>
</refsect1>
<refsect1 id="files">
<title>FILES</title>
<para>Most <emphasis>emdebian-tools</emphasis> use configuration data from
<filename>apt-cross</filename> and <filename>dpkg-cross</filename>.
<command>emsource</command> and <command>emsandbox </command> also support
configuration using <filename>debconf</filename> to set a subversion username
and default working directory (which must be writable) for unpacking source
downloads. Default debconf values can be overridden with user-specific
values using <filename>~/.apt-cross/emsource</filename> or
<filename>~/.apt-cross/emsandbox</filename> respectively.
</para>
<refsect2>
<title>/etc/emsandbox.conf</title>
<para>System-wide configuration file handled by <command>debconf</command>
controlling unpacking source archives to a default working
directory. Can also include a subversion username setting, intended for
single-user installations. <filename>/etc/emsandbox.conf</filename>
settings can be overridden on a per-user basis by copying the current
file to <filename>~/.apt-cross/emsandbox</filename> and editing the
values.</para>
<para>Two variables can be set (see also <filename>/etc/emsandbox.conf</filename>):
</para>
<itemizedlist>
<listitem>
<para><emphasis>workingdir</emphasis>: A simple default
location for <command>emsandbox</command> to create a source tree to
download and unpack prebuilt binary packages. If left blank, a
new top level directory tree is used but this is intended for chroot
support only.
</para>
</listitem>
<listitem>
<para><emphasis>targetsuite</emphasis>: Emdebian follows Debian by
defaulting to building against unstable. This setting determines the
versions of libraries and packages linked against the cross-built emdebian
packages.
</para>
</listitem>
</itemizedlist>
</refsect2>
<refsect2>
<title>~/.apt-cross/emsandbox</title>
<para>User-specific version of <filename>/etc/emsandbox.conf</filename>,
supporting the same variables to provide user-specific overrides.
</para>
</refsect2>
</refsect1>
<refsect1>
<title>Author</title>
<para><command>emsandbox</command> was written
by Neil Williams <email>codehelp@debian.org</email>.
</para>
<para>This manual page was written by Neil Williams
<email>codehelp@debian.org</email>
</para>
</refsect1>
<refsect1 id="seealso">
<title>SEE ALSO</title>
<para>See also <filename>apt-cross</filename> (1), <filename>em_make</filename> (1),
<filename>dpkg-cross</filename> (1), <emphasis>emdebian-tools</emphasis> (1).
</para>
</refsect1>
</refentry>

File diff suppressed because it is too large Load diff

View file

@ -1,389 +0,0 @@
#!/bin/bash
set -e
# embootstrap -- create a bootstrap for emdebian builds
#
# Note that this script controls tarballs for empdebuild and emsandbox
# pass --cross to set an emsandbox tarball.
#
# Copyright (C) 2007-2010 Neil Williams <codehelp@debian.org>
#
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
CWD=`pwd`
# test for sudo
# make sure sudo is in use.
# bash cannot seem to do this when set -e is enabled
# because grep returns non-zero on a non-match
# so I use perl. :-)
ISROOT=`perl -e '$e=\`printenv\`; ($e =~ /\nUSER=root\n/) ? print "yes" : print "no";'`
if [ $ISROOT == "no" ] ; then
echo "embootstrap needs to be run under sudo or as root."
exit 2
fi
. /usr/lib/pbuilder/pbuilder-modules
. /usr/lib/pbuilder/pbuilder-buildpackage-funcs
. /usr/share/emdebian-tools/empbuilderlib
# move to our own function file later.
# Need support for create (this script), update (unpack base.tgz) and login
# (sudo chroot /bin/sh) as well as the final empdebuild (emsource,emdebuild)
# in a separate script.
# Currently, this script needs user intervention to build the chroot:
# emsetup asks for confirmation and apt-get install wants GnuPG verification.
# This script will concentrate only on creating and updating the chroot.
# Parameters.
# WORK=location of this script.
# MIRROR=the Debian primary mirror that will replace the default debootstrap mirror
# (ftp.debian.org is not a primary and only supports 2 architectures).
# TODO: needs command line options to set the rest of these parameters.
# Note --oknodo will cause failures, see #426877
WORK=$CWD
get_work_dir
BUILDPLACE=$WORKDIR
WORKDIR=`echo ${WORKDIR}/ | tr -s \/`
echo "Using '$WORKDIR' as the Emdebian working directory."
BASETGZ="$BUILDPLACE/emdebian.tgz"
BASETGZ=`echo $BASETGZ | tr -s \/`
BUILDPLACE="$BUILDPLACE/pbuilder"
# tidy up // to /
BUILDPLACE=`echo $BUILDPLACE | tr -s \/`
MIRROR=
# don't die if the user has set 'None' for the dpkg-cross default.
get_default_arch
BUILDPLACE="${WORKDIR}pbuilder/build"
if [ -d $BUILDPLACE ]; then
rm -rf $BUILDPLACE/*
fi
if [ ! -d $BUILDPLACE ]; then
mkdir -p $BUILDPLACE
fi
BASETGZ="${WORKDIR}emdebian.tgz"
SUITE=unstable
CROSS=x
MACHINE=x
VARIANT=x
MACHINEPATH="${WORKDIR}machine/"
USEDEVPTS="yes"
USEPROC="yes"
while [ -n "$1" ]; do
case "$1" in
-a|--arch)
shift
ARCH=$1
# chomp the argument to --arch
shift
;;
--testing|testing)
shift;
BASETGZ="${WORKDIR}emdebian-testing.tgz"
SUITE=testing
echo "Creating an embootstrap testing chroot"
;;
# only for emsandbox support, empdebuild does not pass -S
-S|--suite)
shift
SUITE=$1
shift
;;
--cross|cross)
shift;
BASETGZ="${WORKDIR}emdebian-$ARCH.tgz"
CROSS=$ARCH
echo "Creating an embootstrap $ARCH chroot"
;;
--script)
shift
CMD_SCRIPT=$1
if [ ! -f $CMD_SCRIPT ]; then
echo "Cannot find suite script '$CMD_SCRIPT'."
exit;
fi
echo "Using $CMD_SCRIPT"
shift
;;
--machine-path)
shift
MACHINEPATH="$1/"
MACHINEPATH=`echo $MACHINEPATH | tr -s \/`
shift
;;
--machine)
shift
MACHINE=$1
VARIANT=default
if [ ! -d "${MACHINEPATH}$MACHINE" ]; then
echo "Cannot find machine directory: '${MACHINEPATH}$MACHINE'."
exit 4
fi
shift
;;
--variant)
shift
VARIANT=$1
if [ ! $MACHINE ]; then
echo "Variant specified without a machine."
exit 3
fi
if [ ! -d "${MACHINEPATH}$MACHINE/$VARIANT" ]; then
echo "Cannot find variant directory: '${MACHINEPATH}$MACHINE/$VARIANT'."
exit 3
fi
shift
;;
*)
echo "Unrecognised option: $1"
exit;
;;
esac
done
if [ "$ARCH" = "None.\n" ]; then
echo $ARCH
echo Use the --arch option or dpkg-reconfigure dpkg-cross
exit 2
fi
# include packages.conf if --machine used.
if [ "$MACHINE" != "x" -a "$VARIANT" != "x" -a $CROSS -a $CROSS = $ARCH ]; then
# sets INCLUDE, SCRIPT, MIRROR etc.
FILE="${MACHINEPATH}$MACHINE/$VARIANT/packages.conf"
if [ -f $FILE ]; then
. $FILE
else
echo "ERROR: Cannot find machine support: $FILE"
exit 1
fi
echo "Using $MACHINE:$VARIANT"
if [ $TARBALL_NAME ]; then
echo " -> creating ${WORKDIR}/${TARBALL_NAME}"
BASETGZ="${WORKDIR}/${TARBALL_NAME}"
fi
fi
checkarch
HOST_ARCH=`dpkg-architecture -qDEB_HOST_ARCH`
# let the command line override the packages.conf
if [ ! $SCRIPT ]; then
SCRIPT=$CMD_SCRIPT
fi
# if neither command line nor packages.conf have a script set, use default.
if [ ! $SCRIPT ]; then
SCRIPT="/usr/share/emdebian-tools/emdebian.crossd"
fi
if [ $CROSS -a $CROSS = $ARCH ]; then
echo "Building $ARCH chroot on $HOST_ARCH to install $ARCH packages."
else
echo "Building $HOST_ARCH chroot on $HOST_ARCH to cross-build $ARCH packages."
fi
if [ -f ${BASETGZ} ]; then
echo "${BASETGZ} already exists! Aborting . . ."
exit 1;
fi
echo "Checking for a user writeable tree in $BUILDPLACE"
check_dirs
echo " -> running debootstrap"
export LANG=C
export LC_ALL=C
# debootstrap 1.0.7 has moved
WORK="/usr/share/debootstrap/"
# handle old versions of debootstrap so that we can migrate into testing.
if [ -f "/usr/lib/debootstrap/functions" ]; then
WORK="/usr/lib/debootstrap/";
fi
FOREIGN=
INC=
if [ $CROSS -a $CROSS = $ARCH ]; then
echo " -> cross detected, using foreign."
FOREIGN="--foreign"
if [ ! $MIRROR ]; then
MIRROR="http://www.emdebian.org/crush/"
fi
if [ ! $PROXY ]; then
PROXY="http://www.emdebian.org/crush/"
fi
if [ $INCLUDE ]; then
INC="--include=$INCLUDE"
fi
# if SUITE is empty in packages.conf, reset the default
if [ ! $SUITE ]; then
SUITE=unstable
fi
BUILDD=$SCRIPT
if [ ! -f ${WORKDIR}/stamp-debootstrap ]; then
echo "DEBOOTSTRAP_DIR=$WORK debootstrap $INC --verbose $FOREIGN --arch ${ARCH} $SUITE $BUILDPLACE $PROXY $BUILDD"
DEBOOTSTRAP_DIR=$WORK debootstrap ${INC} --verbose $FOREIGN --arch ${ARCH} $SUITE $BUILDPLACE $PROXY $BUILDD
echo " -> debootstrap stage complete"
echo " -> Checking for machine:variant hooks"
# hooks
if [ $INC ]; then
echo "${INC}" >> $BUILDPLACE/debootstrap/machineincludes
fi
if [ -f ${MACHINEPATH}/$MACHINE/$VARIANT/setup.sh ]; then
if [ ! -z "$EXTRA" ]; then
if [ -e $EXTRA ]; then
cp $EXTRA $BUILDPLACE/
fi
fi
echo " -> Running $MACHINE/$VARIANT/setup.sh $BUILDPLACE $ARCH"
sh ${MACHINEPATH}/$MACHINE/$VARIANT/setup.sh $BUILDPLACE $ARCH
fi
if [ -f ${MACHINEPATH}/$MACHINE/$VARIANT/config.sh ]; then
echo " -> Copying config.sh for $MACHINE:$VARIANT into tarball"
mkdir -p $BUILDPLACE/machine/
cp ${MACHINEPATH}/$MACHINE/$VARIANT/config.sh $BUILDPLACE/machine/
fi
touch ${WORKDIR}/stamp-debootstrap
fi # end of $CROSS
else # else if not $CROSS
# TODO this should be configurable - emdebian-tools will add a primary later.
# copy or use the ~/.apt-cross/sources.foo. files.
if [ ! $MIRROR ]; then
get_primary
if [ ! -z "$PRIMARY" ]; then
MIRROR="http://${PRIMARY}/debian"
fi
fi
if [ ! $MIRROR ]; then
MIRROR="http://ftp.fr.debian.org/debian/"
fi
BUILDD=/usr/share/emdebian-tools/emdebian.buildd
if [ ! -f ${WORKDIR}/stamp-debootstrap ]; then
echo "DEBOOTSTRAP_DIR=$WORK debootstrap --verbose $SUITE $BUILDPLACE $MIRROR $BUILDD"
DEBOOTSTRAP_DIR=$WORK debootstrap --verbose $SUITE $BUILDPLACE $MIRROR $BUILDD
touch ${WORKDIR}/stamp-debootstrap
fi
fi
mkdir -p "$BUILDPLACE/tmp/buildd"
copy_host_configuration
# emdebian-tools will be reconfigured later.
# ensure src is available if not emsandbox
echo " -> Installing apt-lines for $MIRROR"
mkdir -p "$BUILDPLACE/etc/apt/sources.list.d/"
rm -f "$BUILDPLACE"/etc/apt/sources.list
if [ $CROSS -a $CROSS = $ARCH ]; then
cat >> "$BUILDPLACE"/etc/apt/sources.list.d/emdebian.sources.list << EOF
#emdebian target repository : default source list
# created by emsandbox
deb $MIRROR $SUITE main
#deb-src $MIRROR $SUITE main
EOF
else
cat >> "$BUILDPLACE"/etc/apt/sources.list << EOF
deb $MIRROR $SUITE main
deb-src $MIRROR $SUITE main
EOF
fi
if [ $CROSS -a $CROSS = $ARCH ]; then
# copy our secure apt key into the chroot for apt-key
cp /usr/share/emdebian-tools/emdebian-archive-keyring.gpg $BUILDPLACE/
# copy in our install helper
cp /usr/share/emdebian-tools/emsecondstage $BUILDPLACE/
# only executable by root to allow debootstrap to work properly.
chmod 744 $BUILDPLACE/emsecondstage
rm -f $BUILDPLACE/debootstrap/debootstrap.log
# empty if using unpack but should still exist.
save_aptcache
else
echo "Refreshing the base.tgz "
echo " -> upgrading packages"
mountproc
chroot $BUILDPLACE /usr/bin/apt-get update
recover_aptcache
chroot $BUILDPLACE /usr/bin/apt-get -y --force-yes dist-upgrade
echo " -> adding the Emdebian repository key"
chroot $BUILDPLACE mkdir -p /home/$SUDO_USER/.gnupg
chroot $BUILDPLACE mkdir -p /home/$SUDO_USER/.dpkg-cross
if [ -f /home/$SUDO_USER/.devscripts ]; then
cp /home/$SUDO_USER/.devscripts $BUILDPLACE/home/$SUDO_USER/.devscripts
fi
cp /usr/share/emdebian-tools/emdebian-archive-keyring.gpg $BUILDPLACE/
chroot $BUILDPLACE apt-key add emdebian-archive-keyring.gpg
if [ -f emdebian-archive-keyring.gpg ]; then
rm emdebian-archive-keyring.gpg
fi
echo " -> updating /etc/hosts"
cp /etc/hosts $BUILDPLACE/etc/hosts
# emdebian.buildd installs emdebian-tools which sets up apt for the emdebian repository
echo " -> updating the apt cache"
chroot "$BUILDPLACE" /usr/bin/apt-get update
# upgrade emdebian-tools and apt-cross before running emsetup
echo " -> upgrading emdebian-tools and apt-cross"
chroot "$BUILDPLACE" /usr/bin/apt-get -y --force-yes dist-upgrade
echo " -> updating apt-cross cache"
DPKG_CROSS="/home/$SUDO_USER/.dpkg-cross"
if [ ! -f $DPKG_CROSS/apt.conf-${SUITE} ]; then
chroot $BUILDPLACE /usr/bin/apt-cross -a $ARCH -S $SUITE -u
else
echo " -> copying existing apt-cross cache"
cp $DPKG_CROSS/apt.conf-$SUITE $BUILDPLACE/$DPKG_CROSS/
cp $DPKG_CROSS/sources.$SUITE $BUILDPLACE/$DPKG_CROSS/
cp $DPKG_CROSS/status-$SUITE $BUILDPLACE/$DPKG_CROSS/
cp -r $DPKG_CROSS/$SUITE $BUILDPLACE/$DPKG_CROSS/
fi
echo " -> running emsetup"
if chroot "$BUILDPLACE" /usr/bin/emsetup -v -a $ARCH --yes; then
:
else
echo " -> emsetup failed"
if [ "${LOGIN_AFTER_FAIL}" = "yes" ]; then
echo " -> Logging into the chroot"
echo " -> Build directory: /trunk/$SVN"
echobacktime
chroot $BUILDPLACE /bin/sh
save_aptcache
echo " -> emsetup failed"
chroot $BUILDPLACE /usr/bin/apt-get clean
umountproc
create_emdebiantgz
cleanbuildplace
rm ${WORKDIR}/stamp-debootstrap
exit 1;
fi
save_aptcache
umountproc
chroot $BUILDPLACE /usr/bin/apt-get clean
create_emdebiantgz
cleanbuildplace
rm ${WORKDIR}/stamp-debootstrap
echobacktime
echo " -> emsetup failed: exiting with an error!"
echo " Try --login-after-fail"
exit 1;
fi
umountproc
save_aptcache
chroot $BUILDPLACE /usr/bin/apt-get clean
fi
create_emdebiantgz
cleanbuildplace
rm ${WORKDIR}/stamp-debootstrap

View file

@ -1,93 +0,0 @@
# bash completion support
#
# Copyright (C) 2008 Neil Williams <codehelp@debian.org>
#
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
_get_dpkg_cross_list()
{
grep Choices: /var/lib/dpkg/info/dpkg-cross.templates \
| cut -d':' -f2 | sed -e 's/None, //' | sed -e 's/,//g'
}
_get_machine_name()
{
WORK=`cat /etc/emsandbox.conf | grep workingdir | sed -e 's/workingdir: \(.*\)/\1\/machine/'`
ls $WORK
}
_get_variant_name()
{
WORK=`cat /etc/emsandbox.conf | grep workingdir | sed -e 's/workingdir: \(.*\)/\1\/machine/'`
ls -1 $WORK/*
}
# rootfs cannot not support stable until Lenny is released.
_supported_suites()
{
echo unstable testing sid lenny
}
_emsandbox()
{
local cur prev opts cmds help machine arch quiet
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
help="-h -? --help --version "
cmds="create --create "
arch="-a --arch "
opts="-s --script -S --suite"
machine="-m --machine -v --variant --machine-path "
case "$prev" in
-@(a|-arch))
COMPREPLY=( $( _get_dpkg_cross_list $cur ) )
;;
-@(m|-machine))
COMPREPLY=( $( _get_machine_name $cur ) )
;;
-@(V|-variant))
COMPREPLY=( $( _get_variant_name $cur ) )
;;
-@(S|-suite))
COMPREPLY=( $( _supported_suites $cur ) )
;;
*)
COMPREPLY=( $(compgen -W "${arch}${help}${opts}${machine}${cmds}" -- ${cur}) )
;;
esac
}
complete -F _emsandbox -o default emsandbox
_em_multistrap()
{
local cur prev opts cmds help machine arch quiet
COMPREPLY=()
cur="${COMP_WORDS[COMP_CWORD]}"
prev="${COMP_WORDS[COMP_CWORD-1]}"
help="-h -? --help --version "
arch="-a --arch "
opts="-f --file"
machine=""
case "$prev" in
-@(a|-arch))
COMPREPLY=( $( _get_dpkg_cross_list $cur ) )
;;
*)
COMPREPLY=( $(compgen -W "${arch}${help}${opts}${machine}${cmds}" -- ${cur}) )
;;
esac
}
complete -F _em_multistrap -o default em_multistrap

View file

@ -1,87 +0,0 @@
# emdebian secondstage support (example only).
# busybox is not currently built with internal dpkg
# support so this package set might not work.
#
# Copyright (C) 2007-2008 Neil Williams <codehelp@debian.org>
#
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
mirror_style release
download_style apt
work_out_debs () {
required="busybox dpkg libstdc++6 libgcc1 libc6 cdebconf
debconf-shell libdebian-installer4 zlib1g
base-passwd tzdata"
base="apt gpgv
debianutils makedev gnupg udev base-files
debian-archive-keyring udhcpc udhcpd
util-linux module-init-tools initscripts"
}
first_stage_install () {
PRESERVE_BUILDPLACE="yes"
. /usr/share/emdebian-tools/emrootfslib
extract $required
make_dpkg_dirs
prepare_proc
prepare_var
info INSTCORE " -> Preparing basic defaults for $BUILDPLACE/etc"
basic_etc_fstab
basic_group_setup
basic_passwd_setup
basic_shadow_setup
basic_etc_profile
shell_update_rcd
set_approx_time
set_cdebconf_default
provide_empty_install_info
provide_var_lib_x11
info INSTCORE " -> Setting up dpkg in $BUILDPLACE"
x_feign_install dpkg
info INSTCORE " -> Unpacking packages in $BUILDPLACE"
unpack_debootstrap
info INSTCORE " -> Adapting configuration for Emdebian"
busybox_symlinks
disable_updatercd
disable_invokercd
disable_apt_recommends
busybox_inittab
busybox_rcS
setup_devices
info INSTCORE " -> First stage install complete in $BUILDPLACE"
}
second_stage_install () {
if [ -f /datestring ]; then
TIME=`cat /datestring`
echo "Setting approximate time of $TIME"
date -s $TIME
fi
info INSTCORE "Running ldconfig..."
in_target /sbin/ldconfig
in_target depmod
info INSTCORE "Setting cdebconf environment"
export DEBCONF_USE_CDEBCONF=true
DEBIAN_FRONTEND=noninteractive
DEBCONF_NONINTERACTIVE_SEEN=true
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
# bug: See #451130
in_target /usr/lib/cdebconf/debconf-loadtemplate /usr/share/debconf/demo /usr/share/debconf/demo.templates
info INSTCORE "Configuring in $BUILDPLACE"
in_target dpkg --configure -a
info BASESUCCESS "Emdebian base system installed successfully."
}

View file

@ -1,80 +0,0 @@
# emdebian secondstage support (Default busybox, dpkg and apt version)
#
# Copyright (C) 2007-2008 Neil Williams <codehelp@debian.org>
#
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
mirror_style release
download_style apt
work_out_debs () {
required="coreutils dpkg libstdc++6 libgcc1 libc6 cdebconf
debconf-shell libdebian-installer4 zlib1g libnewt0.52
libslang2 base-passwd"
base="apt gpgv libncurses5 libreadline5 readline-common
debianutils makedev whiptail gnupg udev base-files
debian-archive-keyring dhcp3-client
util-linux module-init-tools initscripts"
}
first_stage_install () {
PRESERVE_BUILDPLACE="yes"
. /usr/share/emdebian-tools/emrootfslib
extract $required
make_dpkg_dirs
prepare_proc
prepare_var
info INSTCORE " -> Preparing basic defaults for $BUILDPLACE/etc"
basic_etc_fstab
basic_group_setup
basic_passwd_setup
basic_shadow_setup
basic_etc_profile
shell_update_rcd
set_approx_time
set_cdebconf_default
provide_empty_install_info
provide_var_lib_x11
info INSTCORE " -> Setting up dpkg in $BUILDPLACE"
x_feign_install dpkg
info INSTCORE " -> Unpacking packages in $BUILDPLACE"
unpack_debootstrap
info INSTCORE " -> Adapting configuration for Emdebian"
disable_apt_recommends
setup_devices
info INSTCORE " -> First stage install complete in $BUILDPLACE"
}
second_stage_install () {
if [ -f /datestring ]; then
TIME=`cat /datestring`
echo "Setting approximate time of $TIME"
date -s $TIME
fi
info INSTCORE "Running ldconfig..."
in_target /sbin/ldconfig
in_target depmod
info INSTCORE "Setting cdebconf environment"
export DEBCONF_USE_CDEBCONF=true
DEBIAN_FRONTEND=noninteractive
DEBCONF_NONINTERACTIVE_SEEN=true
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
# bug: See #451130
in_target /usr/lib/cdebconf/debconf-loadtemplate /usr/share/debconf/demo /usr/share/debconf/demo.templates
info INSTCORE "Configuring in $BUILDPLACE"
in_target dpkg --configure -a
info BASESUCCESS "Emdebian base system installed successfully."
}

View file

@ -1,85 +0,0 @@
# emdebian secondstage support (Default busybox, dpkg and apt version)
#
# Copyright (C) 2007-2008 Neil Williams <codehelp@debian.org>
#
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
mirror_style release
download_style apt
work_out_debs () {
required="busybox dpkg libstdc++6 libgcc1 libc6 cdebconf
debconf-shell libdebian-installer4 zlib1g libnewt0.52
libslang2 base-passwd"
base="apt gpgv libncurses5 libreadline5 readline-common
debianutils makedev whiptail gnupg udev base-files
debian-archive-keyring dhcp3-client
util-linux module-init-tools initscripts"
}
first_stage_install () {
PRESERVE_BUILDPLACE="yes"
. /usr/share/emdebian-tools/emrootfslib
extract $required
make_dpkg_dirs
prepare_proc
prepare_var
info INSTCORE " -> Preparing basic defaults for $BUILDPLACE/etc"
basic_etc_fstab
basic_group_setup
basic_passwd_setup
basic_shadow_setup
basic_etc_profile
shell_update_rcd
set_approx_time
set_cdebconf_default
provide_empty_install_info
provide_var_lib_x11
info INSTCORE " -> Setting up dpkg in $BUILDPLACE"
x_feign_install dpkg
info INSTCORE " -> Unpacking packages in $BUILDPLACE"
unpack_debootstrap
info INSTCORE " -> Adapting configuration for Emdebian"
busybox_symlinks
disable_updatercd
disable_invokercd
disable_apt_recommends
busybox_inittab
busybox_rcS
setup_devices
info INSTCORE " -> First stage install complete in $BUILDPLACE"
}
second_stage_install () {
if [ -f /datestring ]; then
TIME=`cat /datestring`
echo "Setting approximate time of $TIME"
date -s $TIME
fi
info INSTCORE "Running ldconfig..."
in_target /sbin/ldconfig
in_target depmod
info INSTCORE "Setting cdebconf environment"
export DEBCONF_USE_CDEBCONF=true
DEBIAN_FRONTEND=noninteractive
DEBCONF_NONINTERACTIVE_SEEN=true
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
# bug: See #451130
in_target /usr/lib/cdebconf/debconf-loadtemplate /usr/share/debconf/demo /usr/share/debconf/demo.templates
info INSTCORE "Configuring in $BUILDPLACE"
in_target dpkg --configure -a
info BASESUCCESS "Emdebian base system installed successfully."
}

View file

@ -1,90 +0,0 @@
# emdebian secondstage support (busybox, dpkg, apt + gtk version)
#
# Copyright (C) 2007-2008 Neil Williams <codehelp@debian.org>
#
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
mirror_style release
download_style apt
work_out_debs () {
required="busybox dpkg libstdc++6 libgcc1 libc6 cdebconf
debconf-shell libdebian-installer4 zlib1g libnewt0.52
libslang2 base-passwd"
base="apt gpgv libncurses5 libreadline5 readline-common
debianutils makedev whiptail iptables initscripts
gnupg udev base-files debian-archive-keyring libgtk2.0-0
libxfixes3 fontconfig-config ttf-bitstream-vera gpe
libsoup2.2-8 dbus xinit libice6 langupdate
libsm6 galculator dhcp3-client util-linux
module-init-tools sysvinit-utils xauth xserver-xorg-video-fbdev
xserver-xorg-input-tslib xfonts-base hicolor-icon-theme"
}
first_stage_install () {
PRESERVE_BUILDPLACE="yes"
. /usr/share/emdebian-tools/emrootfslib
extract $required
make_dpkg_dirs
prepare_proc
prepare_var
info INSTCORE " -> Preparing basic defaults for $BUILDPLACE/etc"
basic_etc_fstab
basic_group_setup
basic_passwd_setup
basic_shadow_setup
basic_etc_profile
shell_update_rcd
set_approx_time
set_cdebconf_default
provide_empty_install_info
provide_var_lib_x11
info INSTCORE " -> Setting up dpkg in $BUILDPLACE"
x_feign_install dpkg
info INSTCORE " -> Unpacking packages in $BUILDPLACE"
unpack_debootstrap
info INSTCORE " -> Adapting configuration for Emdebian"
busybox_symlinks
disable_updatercd
disable_invokercd
disable_apt_recommends
busybox_inittab
busybox_rcS
sample_xorg_conf
setup_devices
info INSTCORE " -> First stage install complete in $BUILDPLACE"
}
second_stage_install () {
if [ -f /datestring ]; then
TIME=`cat /datestring`
echo "Setting approximate time of $TIME"
date -s $TIME
fi
info INSTCORE "Running ldconfig..."
in_target /sbin/ldconfig
in_target depmod
info INSTCORE "Setting cdebconf environment"
export DEBCONF_USE_CDEBCONF=true
DEBIAN_FRONTEND=noninteractive
DEBCONF_NONINTERACTIVE_SEEN=true
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
# bug: See #451130
in_target /usr/lib/cdebconf/debconf-loadtemplate /usr/share/debconf/demo /usr/share/debconf/demo.templates
info INSTCORE "Configuring in $BUILDPLACE"
in_target dpkg --configure -a
info BASESUCCESS "Emdebian base system installed successfully."
}

View file

@ -1,101 +0,0 @@
# emdebian secondstage support (Grip version)
#
# Copyright (C) 2007-2009 Neil Williams <codehelp@debian.org>
#
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
mirror_style release
download_style apt
finddebs_style from-indices
variants - buildd fakechroot minbase
if doing_variant fakechroot; then
test "$FAKECHROOT" = "true" || error 1 FAKECHROOTREQ "This variant requires fakechroot environment to be started"
fi
LIBC=libc6
if [ "$ARCH" = "alpha" ] || [ "$ARCH" = "ia64" ]; then
LIBC="libc6.1"
elif [ "$ARCH" = "hurd-i386" ]; then
LIBC="libc0.3"
fi
work_out_debs () {
required="$(get_debs Priority: required)"
if doing_variant - || doing_variant fakechroot; then
#required="$required $(get_debs Priority: important)"
# ^^ should be getting debconf here somehow maybe
base="$(get_debs Priority: important)"
elif doing_variant buildd; then
base="$(get_debs Build-Essential: yes)"
elif doing_variant minbase; then
base="apt"
fi
if doing_variant fakechroot; then
# ldd.fake needs binutils
required="$required binutils"
fi
}
first_stage_install () {
extract $required
PRESERVE_BUILDPLACE="yes"
. /usr/share/emdebian-tools/emrootfslib
make_dpkg_dirs
basic_etc_fstab
basic_etc_profile
if [ -x "$TARGET/usr/bin/md5sum.textutils" ] && [ \! -e "$TARGET/usr/bin/md5sum" ]; then
cp "$TARGET/usr/bin/md5sum.textutils" "$TARGET/usr/bin/md5sum"
fi
if doing_variant fakechroot; then
setup_devices_fakechroot
else
setup_devices
fi
x_feign_install dpkg
info INSTCORE " -> Unpacking packages in $BUILDPLACE"
unpack_debootstrap
disable_apt_recommends
info INSTCORE " -> First stage install complete in $BUILDPLACE"
}
second_stage_install () {
if [ -f /datestring ]; then
TIME=`cat /datestring`
echo "Setting approximate time of $TIME"
date -s $TIME
fi
info INSTCORE "Running ldconfig..."
in_target /sbin/ldconfig
in_target depmod
info INSTCORE "Setting debconf environment"
DEBIAN_FRONTEND=noninteractive
DEBCONF_NONINTERACTIVE_SEEN=true
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
if doing_variant fakechroot; then
install_fakechroot_tools
fi
setup_dselect_method apt
info CONFBASE "Configuring packages..."
./emsecondstage
}

View file

@ -1,84 +0,0 @@
# emdebian secondstage support (busybox, dpkg, apt + gtk version)
#
# Copyright (C) 2007-2008 Neil Williams <codehelp@debian.org>
#
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
mirror_style release
download_style apt
work_out_debs () {
required="busybox dpkg libstdc++6 libgcc1 libc6 cdebconf
libdebian-installer4 zlib1g libnewt0.52 libslang2"
base="apt gpgv libncurses5 libreadline5 readline-common
debconf-shell debianutils makedev base-passwd whiptail
gnupg udev base-files debian-archive-keyring libgtk2.0-0
fontconfig-config ttf-bitstream-vera xfonts-base"
}
first_stage_install () {
PRESERVE_BUILDPLACE="yes"
. /usr/share/emdebian-tools/emrootfslib
extract $required
make_dpkg_dirs
prepare_proc
prepare_var
info INSTCORE " -> Preparing basic defaults for $BUILDPLACE/etc"
basic_etc_fstab
basic_group_setup
basic_passwd_setup
basic_etc_profile
shell_update_rcd
set_approx_time
set_cdebconf_default
provide_empty_install_info
provide_var_lib_x11
info INSTCORE " -> Setting up dpkg in $BUILDPLACE"
x_feign_install dpkg
info INSTCORE " -> Unpacking packages in $BUILDPLACE"
unpack_debootstrap
info INSTCORE " -> Adapting configuration for Emdebian"
busybox_symlinks
disable_updatercd
disable_invokercd
disable_apt_recommends
busybox_inittab
busybox_rcS
sample_xorg_conf
setup_devices
info INSTCORE " -> First stage install complete in $BUILDPLACE"
}
second_stage_install () {
if [ -f /datestring ]; then
TIME=`cat /datestring`
echo "Setting approximate time of $TIME"
date -s $TIME
fi
info INSTCORE "Running ldconfig..."
in_target /sbin/ldconfig
in_target depmod
info INSTCORE "Setting cdebconf environment"
export DEBCONF_USE_CDEBCONF=true
DEBIAN_FRONTEND=noninteractive
DEBCONF_NONINTERACTIVE_SEEN=true
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
# bug: See #451130
in_target /usr/lib/cdebconf/debconf-loadtemplate /usr/share/debconf/demo /usr/share/debconf/demo.templates
info INSTCORE "Configuring in $BUILDPLACE"
in_target dpkg --configure -a
info BASESUCCESS "Emdebian base system installed successfully."
}

View file

@ -1,223 +0,0 @@
# empbuilderlib : shell library to support building chroots for Emdebian.
#
# Copyright (C) 2006-2010 Neil Williams <codehelp@debian.org>
# Copyright (C) 2001-2007 Junichi Uekawa
#
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This shell library requires perl and pbuilder (which means bash!) !
# Draws in POSIX shell functions from emrootfslib to be able to call
# in functions from first_stage_install within debootstrap. The only
# reasons to continue putting new functions in here are if:
# 1. the functions are only useful to create cross-building chroots OR
# 2. the functions need to call pbuilder code directly.
# There should be no need to call pbuilder code within scripts that
# generate a root filesystem.
# Intended solely for use on the build machine. Do not use these functions
# in second_stage_install !
. /usr/share/emdebian-tools/emrootfslib
. /usr/lib/pbuilder/pbuilder-modules
WORKPLACE="${WORKDIR}/pbuilder"
BASETGZ="${WORKDIR}/emdebian.tgz"
#pbuilder base values
DEBIAN_BUILDARCH=$ARCH
# cross-building chroot is same arch as host.
BUILDRESULT="$WORKPLACE/result/"
# tidy up // to /
BUILDRESULT=`echo $BUILDRESULT | tr -s \/`
APTCACHE="$WORKPLACE/aptcache/"
# tidy up // to /
APTCACHE=`echo $APTCACHE | tr -s \/`
AUTO_DEBSIGN=yes
APTCACHEHARDLINK="no"
BUILDPLACE="$WORKPLACE/build"
# the default is to add a PID in the buildplace.
BASEBUILDPLACE="$BUILDPLACE"
if [ "${PRESERVE_BUILDPLACE}" != "yes" ]; then
BUILDPLACE="$BUILDPLACE/$$"
fi
function extractembuildplace () {
# after calling this function, umountproc, and cleanbuildplace
# needs to be called. Please trap it.
if [ ! \( "${PRESERVE_BUILDPLACE}" = "yes" -a -d "$BUILDPLACE" \) ]; then
cleanbuildplace
echo "Building the Emdebian build Environment"
if ! mkdir -p "$BUILDPLACE"; then
echo "E: failed to build the directory to chroot"
exit 1
fi
echo " -> extracting base tarball [${BASETGZ}]"
if [ ! -f "$BASETGZ" ]; then
echo "E: failed to find $BASETGZ, have you created your base tarball yet?"
exit 1
fi
if ! (cd "$BUILDPLACE" && tar xfzp "$BASETGZ"); then
echo "E: failed to extract $BASETGZ to $BUILDPLACE"
exit 1
fi
echo " -> creating local configuration"
if [ $CROSS -a $CROSS != $ARCH ]; then
hostname -f > "$BUILDPLACE/etc/mailname"
else
echo "emdebian-$ARCH" > "$BUILDPLACE/etc/mailname"
fi
if [ ! -f "$BUILDPLACE/etc/apt/apt.conf.d/10disablerecommends" ]; then
disable_apt_recommends
fi
fi
copy_local_configuration
mountproc
mkdir -p "$BUILDPLACE/tmp/buildd"
chmod 1777 "$BUILDPLACE/tmp"
if [ "$OVERRIDE_APTLINES" = "yes" ]; then
installaptlines
fi
}
function autoclean_aptcache() {
if [ -n "$APTCACHE" ]; then
echo " -> Cleaning the cached apt archive"
chroot $BUILDPLACE /usr/bin/apt-get autoclean || true
find "$APTCACHE/" -maxdepth 1 -name \*.deb | \
while read A; do
if [ ! -f "$BUILDPLACE/var/cache/apt/archives/"$(basename "$A") -a \
-f "$A" ]; then
echo " -> obsolete cache content "$(basename "$A")" removed"
rm -f "$A" || true
fi
done
fi
}
# intended only for chroots
function copy_host_configuration () {
echo " -> copying local configuration"
if [ $CROSS -a $CROSS != $ARCH ]; then
for a in hosts hostname resolv.conf; do
sudo rm -f "$BUILDPLACE/etc/$a"
if [ ! -f "/etc/$a" ]; then
echo "E: /etc/$a does not exist, your setup is insane. fix it" >&2
sudo cp $( readlink -f "/etc/$a" ) "$BUILDPLACE/etc/$a";
fi
done
else
# sandboxes need a different hostname
mkdir -p "$BUILDPLACE"/etc/
cat > "$BUILDPLACE"/etc/hostname << EOF
emdebian-$ARCH
EOF
fi
}
function createemchroot()
{
if [ $SUITE == testing ]; then
BASETGZ="${WORKDIR}/emdebian-testing.tgz"
SUITE=testing
. /usr/share/emdebian-tools/embootstrap --arch $ARCH testing
echo "Creating an embootstrap testing chroot"
else
BASETGZ="$WORKDIR/emdebian.tgz"
. /usr/share/emdebian-tools/embootstrap --arch $ARCH
fi
}
function checkembuilddep () {
# call satisfydepends
local BUILDOPT="--binary-all"
case "${BINARY_ARCH}" in
yes) BUILDOPT="--binary-arch";;
*) ;;
esac
PBUILDERSATISFYDEPENDSCMD=/usr/lib/pbuilder/pbuilder-satisfydepends
CONTROL=$BUILDPLACE/trunk/$SVN/debian/control
# this version parses debian/control, NOT the .dsc
# so that when Emdebian removes dependencies, the chroot does too.
echo "Running: $PBUILDERSATISFYDEPENDSCMD --control $CONTROL --chroot $BUILDPLACE ${BUILDOPT}"
if "$PBUILDERSATISFYDEPENDSCMD" --control "$CONTROL" --chroot "${BUILDPLACE}" "${BUILDOPT}" ; then
echo " -> installed ${HOST_ARCH} dependencies."
else
echo "E: pbuilder-satisfydepends failed." >&2
exit 2
fi
# install extra packages to the chroot
if [ -n "$EXTRAPACKAGES" ]; then
if echo "DEBIAN_FRONTEND=noninteractive usr/bin/apt-get -y --force-yes install ${EXTRAPACKAGES}" | chroot $BUILDPLACE /bin/sh; then
:
else
# if apt failed (maybe update needs to be run), save so far and exit cleanly
save_aptcache
umountproc
cleanbuildplace
exit 1;
fi
fi
}
# get $ARCH .deb and put into /var/cache/apt/archives to
# allow these to be saved between builds.
function save_aptcrosscache() {
# save the current aptcache archive
# it is safe to call this function several times.
local doit
if [ -n "$APTCACHE" ]; then
echo "Copying back the cached apt-cross archive contents"
mkdir -p "$APTCACHE" ;
if [ "$APTCACHEHARDLINK" = "yes" ]; then
doit=ln
else
doit=cp
fi
# apt-cross puts the archives in the chroot /
find "$BUILDPLACE/" -maxdepth 1 -name \*.deb | \
while read A ;do
if [ ! -f "$APTCACHE/"$(basename "$A") -a -f "$A" ]; then
echo " -> new cache content "$(basename "$A")" added"
$doit "$A" "$APTCACHE/" || true
fi
done
fi
}
function get_aptcross_dir ()
{
if [ -z "$HOME" -o ! -d $HOME ]; then
HOME="/tmp";
fi
path="$HOME/.apt-cross";
if [ ! -d $path ]; then
mkdir $path;
fi
}
function get_primary ()
{
get_aptcross_dir
if [ -f "$path/emsource.conf" ]; then
PRIMARY=`grep primary $path/emsource.conf|cut -d: -f2|tr -d ' '`
else
if [ -f "/etc/emsource.conf" ]; then
PRIMARY=`grep primary /etc/emsource.conf|cut -d: -f2|tr -d ' '`
else
PRIMARY="ftp.uk.debian.org"
fi
fi
}

View file

@ -1,721 +0,0 @@
# emrootfslib : shell library to support root filesystems for Emdebian.
#
# This file is POSIX shell, compatible with debootstrap.
# Do not include or reference pbuilder functions or bash code here.
#
# Copyright (C) 2006-2010 Neil Williams <codehelp@debian.org>
#
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# This shell library requires perl !
# Intended solely for use on the build machine. Do not use these functions
# in second_stage_install !
OURVERSION=`dpkg-query -W -f='${Version}' emdebian-rootfs`
get_aptcross_dir ()
{
if [ -z "$HOME" -o ! -d "$HOME" ]; then
HOME="/tmp";
fi
path="$HOME/.apt-cross";
if [ ! -d "$path" ]; then
mkdir $path;
fi
}
get_default_arch ()
{
if [ -f "/etc/dpkg-cross/cross-compile" ]; then
ARCH=`grep default_arch /etc/dpkg-cross/cross-compile|grep -v '^#'|cut -d'=' -f2`
fi
if [ -z "$ARCH" ]; then
ARCH="None"
fi
}
get_work_dir ()
{
get_aptcross_dir
if [ -f "$path/emsource.conf" ]; then
WORKDIR=`grep workingdir $path/emsource.conf|cut -d: -f2|tr -d ' '`
else
if [ -f "/etc/emsource.conf" ]; then
WORKDIR=`grep workingdir /etc/emsource.conf|cut -d: -f2|tr -d ' '`
else
WORKDIR="/tmp"
fi
fi
}
get_work_dir
get_default_arch
WORKPLACE="${WORKDIR}/pbuilder"
BASETGZ="${WORKDIR}/emdebian.tgz"
#pbuilder base values
DEBIAN_BUILDARCH=$ARCH
# cross-building chroot is same arch as host.
BUILDRESULT="$WORKPLACE/result/"
# tidy up // to /
BUILDRESULT=`echo $BUILDRESULT | tr -s \/`
APTCACHE="$WORKPLACE/aptcache/"
# tidy up // to /
APTCACHE=`echo $APTCACHE | tr -s \/`
AUTO_DEBSIGN=yes
APTCACHEHARDLINK="no"
BUILDPLACE="$WORKPLACE/build"
# the default is to add a PID in the buildplace.
BASEBUILDPLACE="$BUILDPLACE"
if [ "${PRESERVE_BUILDPLACE}" != "yes" ]; then
BUILDPLACE="$BUILDPLACE/$$"
fi
checkarch ()
{
ARCH=$ARCH perl -e 'use Debian::DpkgCross; $arch = $ENV{ARCH}; $arch=~s/ //g; \
die "Unsupported architecture: $arch Use --arch\n" if (not defined (&check_arch($arch)));'
}
create_emdebiantgz() {
(
if ! cd "$BUILDPLACE"; then
echo "Error: unexpected error in chdir to $BUILDPLACE" >&2
exit 1;
fi
while test -f "${BASETGZ}.tmp"; do
echo " -> Someone else has lock over ${BASETGZ}.tmp, waiting"
sleep 10s
done
echo " -> creating base tarball [${BASETGZ}]"
if ! sudo tar cfz "${BASETGZ}.tmp" * ; then
echo " -> failed building base tarball"
rm -f "${BASETGZ}.tmp"
exit 1;
fi
mv "${BASETGZ}.tmp" "${BASETGZ}"
)
}
check_dirs()
{
if [ ! -d $BUILDPLACE ] ; then
mkdir -p $BUILDPLACE
fi
if [ ! -d $BUILDRESULT ] ; then
mkdir -p $BUILDRESULT
fi
if [ ! -d $APTCACHE ] ; then
mkdir -p $APTCACHE
fi
}
disable_apt_recommends () {
if [ -d "$BUILDPLACE/etc/apt/apt.conf.d/" ]; then
if [ ! -f "$BUILDPLACE/etc/apt/apt.conf.d/10disablerecommends" ]; then
echo " -> disabling Apt::Install-Recommends"
cat > $BUILDPLACE/etc/apt/apt.conf.d/10disablerecommends << 'EOF'
APT
{
Install-Recommends "false"
};
EOF
fi
fi
}
disable_apt_pdiffs () {
if [ -d "$BUILDPLACE/etc/apt/apt.conf.d/" ]; then
if [ ! -f "$BUILDPLACE/etc/apt/apt.conf.d/12disablepdiffs" ]; then
echo " -> disabling Apt::Acquire::PDiffs"
cat > $BUILDPLACE/etc/apt/apt.conf.d/12disablepdiffs << 'EOF'
APT
{
Acquire::PDiffs "false";
};
EOF
fi
fi
}
apt_autoremove_always () {
if [ -d "$BUILDPLACE/etc/apt/apt.conf.d/" ]; then
if [ ! -f "$BUILDPLACE/etc/apt/apt.conf.d/11always_autoremove" ]; then
echo " -> enabling Apt::AutomaticRemove"
cat > $BUILDPLACE/etc/apt/apt.conf.d/11always_autoremove << 'EOF'
APT
{
AutomaticRemove "true"
};
EOF
fi
fi
}
unpack_debootstrap () {
info INSTCORE "Starting unpacking in $BUILDPLACE"
for deb in `ls $BUILDPLACE/var/cache/apt/archives/*.deb`; do
ver=`dpkg -f $deb Version`
pkg=`dpkg -f $deb Package`
info INSTCORE "Unpacking $pkg ($ver) ...."
dpkg -x $deb $BUILDPLACE/
# get the package listing with reduced parsing complexity
mkdir $BUILDPLACE/listing
ar -p $deb data.tar.gz > $BUILDPLACE/listing/data.tar.gz
tar -tzf $BUILDPLACE/listing/data.tar.gz | sed -e 's/^\.//' | sed -e 's/^\/$/\/\./' | sed -e 's/\/$//' > $BUILDPLACE/var/lib/dpkg/info/${pkg}.list
rm -rf $BUILDPLACE/listing
rm -rf $BUILDPLACE/tmp/*
dpkg -e $deb $BUILDPLACE/tmp/
for maint in `ls $BUILDPLACE/tmp/`; do
mv $BUILDPLACE/tmp/$maint $BUILDPLACE/var/lib/dpkg/info/$pkg.$maint
if [ $maint = "control" ]; then
grep -v "^$" $BUILDPLACE/var/lib/dpkg/info/$pkg.$maint >> $BUILDPLACE/var/lib/dpkg/available
grep -v "^$" $BUILDPLACE/var/lib/dpkg/info/$pkg.$maint >> $BUILDPLACE/var/lib/dpkg/status
echo "" >> $BUILDPLACE/var/lib/dpkg/available
echo "Status: install ok unpacked" >> $BUILDPLACE/var/lib/dpkg/status
rm $BUILDPLACE/var/lib/dpkg/info/$pkg.$maint
fi
# need a dpkg filter to make this stick
if [ $maint = "symbols" ]; then
rm $BUILDPLACE/var/lib/dpkg/info/$pkg.symbols
fi
done
if [ -f $BUILDPLACE/var/lib/dpkg/info/$pkg.conffiles ]; then
echo "Conffiles:" >> $BUILDPLACE/var/lib/dpkg/status
info INSTCORE "Processing $pkg.conffiles"
for line in `cat $BUILDPLACE/var/lib/dpkg/info/$pkg.conffiles`; do
md5=`md5sum $BUILDPLACE/$line | cut -d" " -f1`
echo " $line $md5" >> $BUILDPLACE/var/lib/dpkg/status
done
fi
echo "" >> $BUILDPLACE/var/lib/dpkg/status
done
if [ ! -e "$BUILDPLACE/etc/localtime" ]; then
ln -sf /usr/share/zoneinfo/UTC "$BUILDPLACE/etc/localtime"
fi
info INSTCORE "Removing archives..."
rm -f $BUILDPLACE/var/cache/apt/archives/*.deb
# (skip stages in emsecondstage)
touch $BUILDPLACE/debootstrap/unpacked
}
busybox_symlinks ()
{
# busybox symlinks are best managed in postinst so that dpkg
# does not complain when they are replaced by Debian packages.
# this allows more applets to be supported by default.
if [ -f $BUILDPLACE/usr/share/busybox/busybox.links ]; then
cd $BUILDPLACE
# setup busybox
cp usr/share/busybox/busybox.links .
cp usr/share/busybox/install.sh .
# link in the rest of its applets from OUTSIDE the chroot
info INSTCORE "Symlinking the busybox applets..."
sh ./install.sh $BUILDPLACE/ --symlinks
rm $BUILDPLACE/install.sh
rm $BUILDPLACE/busybox.links
else
info INSTCORE "busybox configuration not required"
fi
}
disable_invokercd ()
{
# invoke-rc.d is usually shell but is being looked at in Debian.
if [ ! -f $BUILDPLACE/usr/sbin/invoke-rc.d ]; then
echo '#!/bin/sh' > $BUILDPLACE/usr/sbin/invoke-rc.d
echo 'exec /etc/init.d/$1 $2' > $BUILDPLACE/usr/sbin/invoke-rc.d
echo '' >> $BUILDPLACE/usr/sbin/invoke-rc.d
chmod 755 $BUILDPLACE/usr/sbin/invoke-rc.d
fi
}
disable_updatercd ()
{
# a better fix for /usr/sbin/update-rc.d is available via sysv-rc
if [ ! -f $BUILDPLACE/usr/sbin/update-rc.d ]; then
echo "#!/bin/sh" > $BUILDPLACE/usr/sbin/update-rc.d
echo "" >> $BUILDPLACE/usr/sbin/update-rc.d
chmod 755 $BUILDPLACE/usr/sbin/update-rc.d
fi
RC=`head $BUILDPLACE/usr/sbin/update-rc.d | grep /usr/bin/perl || true`
if [ "$RC" != "" ]; then
info INSTCORE "Replacing perl update-rc.d"
echo "#!/bin/sh" > $BUILDPLACE/usr/sbin/update-rc.d
echo "" >> $BUILDPLACE/usr/sbin/update-rc.d
chmod 755 $BUILDPLACE/usr/sbin/update-rc.d
fi
}
extra_etc_rcd ()
{
if [ ! -d $BUILDPLACE/etc/rcS.d ]; then
mkdir $BUILDPLACE/etc/rcS.d
fi
if [ ! -d $BUILDPLACE/etc/rc0.d ]; then
mkdir $BUILDPLACE/etc/rc0.d
fi
if [ ! -d $BUILDPLACE/etc/rc1.d ]; then
mkdir $BUILDPLACE/etc/rc1.d
fi
if [ ! -d $BUILDPLACE/etc/rc6.d ]; then
mkdir $BUILDPLACE/etc/rc6.d
fi
}
provide_var_lib_x11 ()
{
if [ ! -d $BUILDPLACE/var/lib/x11 ]; then
mkdir -p $BUILDPLACE/var/lib/x11
fi
}
basic_group_setup () {
if [ ! -f $BUILDPLACE/etc/group ]; then
echo \
"root:x:0:
daemon:x:1:
bin:x:2:
sys:x:3:
adm:x:4:
tty:x:5:
disk:x:6:
lp:x:7:
mail:x:8:
news:x:9:
uucp:x:10:
man:x:12:
proxy:x:13:
kmem:x:15:
audio:x:29:
utmp:x:43:
video:x:44:
" > $BUILDPLACE/etc/group
fi
}
basic_passwd_setup () {
if [ ! -f $BUILDPLACE/etc/passwd ]; then
echo \
"root:x:0:0:root:/root:/bin/sh
daemon:x:1:1:daemon:/usr/sbin:/bin/sh
bin:x:2:2:bin:/bin:/bin/sh
sys:x:3:3:sys:/dev:/bin/sh
sync:x:4:65534:sync:/bin:/bin/sync
games:x:5:60:games:/usr/games:/bin/sh
man:x:6:12:man:/var/cache/man:/bin/sh
lp:x:7:7:lp:/var/spool/lpd:/bin/sh
mail:x:8:8:mail:/var/mail:/bin/sh
news:x:9:9:news:/var/spool/news:/bin/sh
uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh
proxy:x:13:13:proxy:/bin:/bin/sh
www-data:x:33:33:www-data:/var/www:/bin/sh
backup:x:34:34:backup:/var/backups:/bin/sh
list:x:38:38:Mailing List Manager:/var/list:/bin/sh
irc:x:39:39:ircd:/var/run/ircd:/bin/sh
gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh
nobody:x:65534:65534:nobody:/nonexistent:/bin/sh
" > $BUILDPLACE/etc/passwd
fi
}
# need /etc/shadow too
basic_shadow_setup () {
if [ ! -f $BUILDPLACE/etc/shadow ]; then
echo \
"root:$1$Vu4M34LT$0L2BfH9nXbSG1zQWxUH8M1:0::::::
daemon:*:13896:0:99999:7:::
bin:*:0:0:99999:7:::
sys:*:0:0:99999:7:::
sync:*:0:0:99999:7:::
games:*:0:0:99999:7:::
man:*:0:0:99999:7:::
lp:*:0:0:99999:7:::
mail:*:0:0:99999:7:::
news:*:0:0:99999:7:::
uucp:*:0:0:99999:7:::
proxy:*:0:0:99999:7:::
www-data:*:0:0:99999:7:::
backup:*:0:0:99999:7:::
list:*:0:0:99999:7:::
irc:*:0:0:99999:7:::
gnats:*:0:0:99999:7:::
nobody:*:0:0:99999:7:::" > $BUILDPLACE/etc/shadow
fi
}
provide_empty_adduser ()
{
if [ ! -f $BUILDPLACE/usr/sbin/adduser ]; then
echo \
'#!/bin/sh
' > $BUILDPLACE/usr/sbin/adduser
chmod 755 $BUILDPLACE/usr/sbin/adduser
fi
if [ ! -f $BUILDPLACE/usr/sbin/deluser ]; then
echo \
'#!/bin/sh
' > $BUILDPLACE/usr/sbin/deluser
chmod 755 $BUILDPLACE/usr/sbin/deluser
fi
}
provide_empty_addgroup ()
{
if [ ! -f $BUILDPLACE/usr/sbin/addgroup ]; then
echo \
'#!/bin/sh
' > $BUILDPLACE/usr/sbin/addgroup
chmod 755 $BUILDPLACE/usr/sbin/addgroup
fi
if [ ! -f $BUILDPLACE/usr/sbin/delgroup ]; then
echo \
'#!/bin/sh
' > $BUILDPLACE/usr/sbin/delgroup
chmod 755 $BUILDPLACE/usr/sbin/delgroup
fi
}
provide_empty_dpkg_divert ()
{
if [ ! -f $BUILDPLACE/usr/bin/dpkg-divert ]; then
echo \
'#!/bin/sh
' > $BUILDPLACE/usr/bin/dpkg-divert
chmod 755 $BUILDPLACE/usr/bin/dpkg-divert
fi
}
provide_empty_install_info () {
if [ ! -f $BUILDPLACE/usr/sbin/install-info ]; then
echo \
'#!/bin/sh
exec /etc/init.d/$1 $2
' > $BUILDPLACE/usr/sbin/install-info
chmod 755 $BUILDPLACE/usr/sbin/install-info
fi
}
set_approx_time () {
if [ -d $BUILDPLACE/bin ]; then
DATE=`date`
ZERO=`date -d@0`
# if we have a usable date, store it.
if [ "$DATE" != "$ZERO" ]; then
APPROX=`stat -c%Y $BUILDPLACE/bin/`
STR=`date -d@$APPROX +%m%d%H%M%Y`
info INSTCORE "Storing approximate time '$STR' in './datestring'"
echo "$STR" > $BUILDPLACE/datestring
fi
fi
}
basic_etc_fstab () {
if [ ! -f "$BUILDPLACE/etc/fstab" ]; then
cat > $BUILDPLACE/etc/fstab << 'EOF'
# /etc/fstab: static file system information.
#
# <file system> <mount point> <type> <options> <dump> <pass>
proc /proc proc defaults 0 0
sysfs /sys sysfs defaults 0 0
devpts /dev/pts devpts mode=0620,gid=5 0 0
usbdevfs /proc/bus/usb usbdevfs noauto 0 0
EOF
chown 0.0 "$BUILDPLACE/etc/fstab";
chmod 0644 "$BUILDPLACE/etc/fstab"
fi
}
make_dpkg_dirs () {
mkdir -p "$BUILDPLACE/var/lib/dpkg"
: >"$BUILDPLACE/var/lib/dpkg/status"
echo >"$BUILDPLACE/var/lib/dpkg/available"
echo -n >"$BUILDPLACE/var/lib/dpkg/diversions"
}
x_feign_install () {
local pkg="$1"
local deb="$(debfor $pkg)"
local ver="$(
ar -p "$BUILDPLACE/$deb" control.tar.gz | zcat |
tar -O -xf - control ./control 2>/dev/null |
sed -ne 's/^Version: *//Ip' | head -n 1
)"
mkdir -p "$BUILDPLACE/var/lib/dpkg/info"
echo \
"Package: $pkg
Version: $ver
Status: install ok installed
" >> "$BUILDPLACE/var/lib/dpkg/status"
touch "$BUILDPLACE/var/lib/dpkg/info/${pkg}.list"
}
prepare_proc () {
if [ ! -d $BUILDPLACE/proc ]; then
mkdir -p $BUILDPLACE/proc
fi
if [ ! -d $BUILDPLACE/sys ]; then
mkdir -p $BUILDPLACE/sys
fi
}
prepare_var () {
if [ ! -d $BUILDPLACE/var/log ]; then
mkdir -p $BUILDPLACE/var/log
fi
if [ ! -d $BUILDPLACE/var/spool ]; then
mkdir -p $BUILDPLACE/var/spool
fi
}
busybox_inittab () {
if [ ! -e "$BUILDPLACE/etc/inittab" ]; then
info INSTCORE "Adding default busybox inittab"
cat > $BUILDPLACE/etc/inittab << 'EOF'
# /etc/inittab
#
# Copyright (C) 2001 Erik Andersen <andersen@codepoet.org>
#
# Note: BusyBox init doesn't support runlevels.
# Startup the system
null::sysinit:/bin/mount -o remount,rw /
null::sysinit:/bin/mount -t proc proc /proc
null::sysinit:/bin/mount -t sysfs sysfs /sys
null::sysinit:/bin/mount -t devpts devpts /dev/pts
null::sysinit:/bin/mount -a
null::sysinit:/bin/hostname -F /etc/hostname
null::sysinit:/sbin/ifconfig lo 127.0.0.1 up
null::sysinit:/sbin/route add -net 127.0.0.0 netmask 255.0.0.0 lo
# now run any rc scripts and then login
::sysinit:/etc/init.d/rcS
# Set up a couple of getty's
tty1::respawn:/sbin/getty 38400 tty1
tty2::respawn:/sbin/getty 38400 tty2
# Put a getty on the serial port
#ttyS0::respawn:/sbin/getty -L ttyS0 115200 vt100
ttyS2::respawn:/sbin/getty -L ttyS2 115200 vt100
# Logging junk
null::sysinit:/bin/touch /var/log/messages
null::respawn:/sbin/syslogd -n -m 0
null::respawn:/sbin/klogd -n
tty3::respawn:/usr/bin/tail -f /var/log/messages
# Stuff to do for the 3-finger salute
::ctrlaltdel:/sbin/reboot
# Stuff to do before rebooting
null::shutdown:/usr/bin/killall klogd
null::shutdown:/usr/bin/killall syslogd
null::shutdown:/bin/umount -a -r
null::shutdown:/sbin/swapoff -a
EOF
fi
}
busybox_rcS () {
if [ ! -d "$BUILDPLACE/etc/default" ]; then
mkdir -p $BUILDPLACE/etc/default
fi
if [ ! -d "$BUILDPLACE/etc/rc.d" ]; then
mkdir -p $BUILDPLACE/etc/rc.d
fi
if [ ! -f "$BUILDPLACE/etc/default/rcS" ]; then
echo "#!/bin/sh" > $BUILDPLACE/etc/default/rcS
echo >> $BUILDPLACE/etc/default/rcS
chown 0.0 "$BUILDPLACE/etc/default/rcS"
chmod 644 "$BUILDPLACE/etc/default/rcS"
fi
# derived from the buildroot version.
if [ ! -e "$BUILDPLACE/etc/init.d/rcS" ]; then
info INSTCORE "Adding default busybox rcS"
cat > $BUILDPLACE/etc/init.d/rcS << 'EOF'
#!/bin/sh
set -e
# Start all init scripts in /etc/rc.d/
#
if [ ! -z "$SPAWNED" ]; then
/bin/login
fi
SPAWNED="$SPAWNED ."
export SPAWNED=\$SPAWNED
for i in /etc/rc.d/S??* ;do
# Ignore dangling symlinks (if any).
[ ! -f "$i" ] && continue
case "$i" in
*.sh)
# Source shell script for speed.
(
trap - INT QUIT TSTP
set start
. $i
)
;;
*)
# No sh extension, so fork subprocess.
$i start
;;
esac
done
EOF
chown 0.0 "$BUILDPLACE/etc/init.d/rcS"
chmod 0755 "$BUILDPLACE/etc/init.d/rcS"
fi
}
# call repeatedly to create init symlinks.
# arg1 is the file in $BUILDPLACE/etc/init.d/
# arg2 is the number for the link in the init sequence
# where 'foo 20' runs after 'bar 10' etc.
symlink_rcS () {
local file="$1"
local num="$2"
linkname="S$num$file"
if [ ! -d "$BUILDPLACE/etc/rc.d/" ]; then
mkdir $BUILDPLACE/etc/rc.d
fi
if [ -f $BUILDPLACE/etc/init.d/$file ]; then
ln -sf ../init.d/$file $BUILDPLACE/etc/rc.d/$linkname
fi
}
symlink_rcK () {
local file="$1"
local num="$2"
linkname="K$num$file"
if [ ! -d "$BUILDPLACE/etc/rc.d/" ]; then
mkdir $BUILDPLACE/etc/rc.d
fi
if [ -f $BUILDPLACE/etc/init.d/$file ]; then
ln -sf ../init.d/$file $BUILDPLACE/etc/rc.d/$linkname
fi
}
basic_etc_profile () {
if [ ! -e "$BUILDPLACE/etc/profile" ]; then
info INSTCORE "Adding a basic /etc/profile file"
cat > $BUILDPLACE/etc/profile << 'EOF'
if [ "`id -u`" -eq 0 ]; then
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games/"
else
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
fi
if [ "$PS1" ]; then
if [ "`id -u`" -eq 0 ]; then
PS1='# '
else
PS1='$ '
fi
fi
export PATH
export DISPLAY=:0
umask 022
EOF
fi
}
set_cdebconf_default () {
info INSTCORE "Setting cdebconf as default."
echo "export DEBCONF_USE_CDEBCONF=true" >> $BUILDPLACE/etc/profile
}
set_tslib_pointercal () {
info INSTCORE "Setting location of tslib calibration file."
echo "export TSLIB_CALIBFILE=/etc/pointercal" >> $BUILDPLACE/etc/profile
}
# this function is coded to match the sample_xorg_conf
# some devices might use /dev/input/event1 or event2
set_tslib_tsdevice () {
info INSTCORE "Setting location of tslib touchscreen device."
echo "export TSLIB_TSDEVICE=/dev/input/event0" >> $BUILDPLACE/etc/profile
}
sample_xorg_conf () {
if [ ! -e "$BUILDPLACE/etc/X11/xorg.conf" ]; then
info INSTCORE "Adding sample xorg.conf"
cat > $BUILDPLACE/etc/X11/xorg.conf << 'EOF'
# You probably want to change at least some of these
# lines and provide it via machine:variant customisations.
# This one comes from balloon3-config.
Section "Files"
FontPath "/usr/share/fonts/truetype/ttf-bitstream-vera/"
EndSection
Section "InputDevice"
Identifier "Generic Keyboard"
Driver "kbd"
EndSection
# /dev/input/event0 is kernel-module specific.
# You may need to change this.
Section "InputDevice"
Identifier "Touchscreen"
Driver "tslib"
Option "ScreenNumber" "0"
Option "Width" "0"
Option "Height" "0"
Option "Rotate" "NONE"
Option "TslibDevice" "/dev/input/event0"
EndSection
Section "Device"
Identifier "Generic Video Card"
Driver "fbdev"
Option "UseFBDev" "true"
EndSection
Section "Monitor"
Identifier "Configured Monitor"
EndSection
Section "ServerLayout"
Identifier "Default Layout"
Screen "Default Screen"
InputDevice "Touchscreen"
EndSection
Section "Screen"
Identifier "Default Screen"
Monitor "Configured Monitor"
EndSection
EOF
fi
}
shell_update_rcd () {
if [ ! -e "$BUILDPLACE/usr/sbin/update-rc.d" ]; then
info INSTCORE "Adding a /usr/sbin/update-rc.d shell script"
cp /usr/share/emdebian-tools/update-rc.d $BUILDPLACE/usr/sbin/
chmod 0755 $BUILDPLACE/usr/sbin/update-rc.d
fi
}

172
emsandbox
View file

@ -1,172 +0,0 @@
#!/bin/bash
set -e
# emsandbox : emdebian roots creation.
#
# Copyright (C) 2006-2008 Neil Williams <codehelp@debian.org>
#
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
#
# the name is not finalised
PROG=emsandbox
function usagehelp () {
# print out help message
cat <<EOF
$PROG - cross-built chroot Emdebian rootfs builder
version $OURVERSION
Syntax: sudo $PROG [OPTIONS] [COMMAND]
Commands:
-?|-h|--help|--version: print this help message and exit
--create|create: create a cross-built base tarball for ARCH
Options:
-a|--arch: Override the default cross-build architecture (from dpkg-cross).
-s|--script FILENAME: Override the default package set and second-stage install.
-S|--suite NAME: Override the default suite [unstable]
-m|--machine NAME: Specify a machine name for customisation hooks
-v|--variant NAME: Specify a machine variant name for customisation hooks
--machine-path PATH: Specify a path to replace the $WORK/machine default
Although based on debootstrap, $PROG cannot support the full range of
debootstrap commands or options.
Some customised $PROG scripts are provided with emdebian-tools. The
default uses the standard Emdebian 'busybox' package with 'dpkg' and 'apt'.
Replacement scripts need to be full debootstrap suite shell scripts that specify
how to complete the first and second stage installations. If the script uses
'busybox', the second-stage install function must be compatible with the
shell applet in busybox - avoid bashisms!
Overriding the default suite also configures the root filesystem to look
for updates within the specified suite.
EOF
}
. /usr/share/emdebian-tools/empbuilderlib
SUITE=unstable
PACKAGE=
EXTRA_BASE=""
EXTRA_REQ=""
MACHINE=
VARIANT=
FILENAME=
get_work_dir
get_default_arch
check_sudo()
{
# test for sudo - normally empdebuild is installed in /usr/sbin so this
# test is really only for SVN users.
# make sure sudo is in use.
# bash cannot seem to do this when set -e is enabled
# because grep returns non-zero on a non-match
# so I use perl. :-)
ISROOT=`perl -e '$e=\`printenv\`; ($e =~ /\nUSER=root\n/) ? print "yes" : print "no";'`
if [ $ISROOT == "no" ] ; then
echo "$PROG needs to be run under sudo or as root."
exit 2
fi
}
while [ -n "$1" ]; do
case "$1" in
--help|-h|-\?|--version)
usagehelp
exit;
;;
-a|--arch)
shift
ARCH=$1
# chomp the argument to --arch
shift
;;
--create|create)
shift;
;;
-s|--script)
shift
FILENAME=$1
shift
;;
-S|--suite)
shift
SUITE=$1
shift
;;
-m|--machine)
shift
MACHINE=$1
shift
;;
-v|--variant)
shift
VARIANT=$1
shift
;;
--machine-path)
shift
MACHINEPATH=$1
shift
;;
*)
echo "Unrecognised option: $1"
echo
usagehelp
exit;
;;
esac
done
if [ $INCLUDE ]; then
INCLUDE="--include=$1"
fi
if [ $MACHINEPATH ]; then
CUSTOM="--machine-path $MACHINEPATH"
fi
if [ $MACHINE ]; then
CUSTOM+=" --machine $MACHINE"
fi
if [ $VARIANT ]; then
CUSTOM+=" --variant $VARIANT"
fi
if [ "$ARCH" = "None." ]; then
echo Error: No default architecture has been set.
echo Use the --arch option or \'sudo dpkg-reconfigure dpkg-cross\'
exit
fi
checkarch
check_sudo
CROSS=$ARCH
if [ "x$SUITE" != "xunstable" ]; then
CUSTOM+=" --suite $SUITE"
fi
BASETGZ="${WORKDIR}/emdebian-$ARCH.tgz"
if [ $FILENAME ]; then
BASETGZ="${WORKDIR}/$FILENAME"
/usr/share/emdebian-tools/embootstrap --arch $ARCH --cross --script $FILENAME $CUSTOM $INCLUDE
echo " -> embootstrap complete"
else
/usr/share/emdebian-tools/embootstrap --arch $ARCH --cross $CUSTOM
fi

View file

@ -1,133 +0,0 @@
#!/bin/sh
set -e
# emsandbox : emdebian rootfs installer
#
# Copyright (C) 2007-2008 Neil Williams <codehelp@debian.org>
#
# This package is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program. If not, see <http://www.gnu.org/licenses/>.
# simple wrapper to aid installation of the rootfs
# Provides a space for pre-installation custom commands as well as simplifying
# the command line.
TARGET=`pwd`
PROG=emsecondstage
usagehelp () {
# print out help message
cat <<EOF
$PROG - emdebian roots installer
Syntax: sudo $PROG
sudo $PROG [COMMAND]
Commands:
-?|-h|--help|-version: print this help message and exit
Although based on debootstrap, $PROG cannot support the full range of
debootstrap commands or options.
The standard Emdebian rootfs uses the 'busybox' package with 'dpkg' and
'apt'. Replacement scripts need to be full debootstrap suite shell
scripts that specify how to complete the first and second stage
installations. If the script uses 'busybox', the second-stage install
function must be compatible with the shell applet in busybox - avoid
bashisms!
Machine specific customisation hooks need to be shell scripts
(not bash) located in /debootstrap/machine/config.sh in the top level
directory of the rootfs. If you used 'emsandbox --machine ...' to
create the rootfs, the config.sh script for your machine and variant
has already been installed and will be executed by $PROG.
If the root filesystem used the 'unpack' method, $PROG only has to
apply the machine specific customisation hooks.
EOF
}
while [ -n "$1" ]; do
case "$1" in
--help|-h|-?|--version)
usagehelp
exit;
;;
*)
echo "Unrecognised command: $1"
exit;
;;
esac
done
# debootstrap directory removed if successful so avoid running twice.
if [ -d "$TARGET/debootstrap/" ]; then
chmod 0755 $TARGET
chroot $TARGET mount proc -t proc /proc || true
if [ -f datestring ]; then
TIME=`cat datestring`
echo "Setting approximate time of $TIME"
chroot $TARGET date -s $TIME || true
fi
echo "Running ldconfig in $TARGET ..."
chroot $TARGET /sbin/ldconfig
# in_target depmod # can only be run under the installed kernel, not the unpacking one.
DEBIAN_FRONTEND=noninteractive
DEBCONF_NONINTERACTIVE_SEEN=true
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN
# bug: See #451130
if [ -f "$TARGET/usr/lib/cdebconf/debconf-loadtemplate" ]; then
export DEBCONF_USE_CDEBCONF=true
echo "Configuring cdebconf"
chroot $TARGET /usr/lib/cdebconf/debconf-loadtemplate /usr/share/debconf/demo /usr/share/debconf/demo.templates
fi
echo "Configuring ..."
chroot $TARGET dpkg --configure -a
echo "Emdebian base system installed successfully in $TARGET."
fi
if [ -f $TARGET/machine/config.sh ]; then
echo " -> Running second stage config.sh script for this machine variant"
sh $TARGET/machine/config.sh
rm -r $TARGET/machine/
fi
if [ -d $TARGET/debootstrap ]; then
rm -rf $TARGET/debootstrap
fi
if [ -d $TARGET/machine ]; then
rm -rf $TARGET/machine
fi
if [ -f $TARGET/0x97BB3B58.txt ]; then
rm $TARGET/0x97BB3B58.txt
fi
# If there is no time or date, this will need to remain.
#if [ -f $TARGET/emdebian-archive-keyring.gpg ]; then
# rm $TARGET/emdebian-archive-keyring.gpg
#fi
if [ -d $TARGET/tmp/buildd ]; then
rm -rf $TARGET/tmp/buildd
fi
# finally, remove self
if [ -f $TARGET/emsecondstage ]; then
rm $TARGET/emsecondstage
fi
echo "Emdebian base system installed successfully."

1100
multistrap

File diff suppressed because it is too large Load diff

View file

@ -1 +1 @@
em_multistrap multistrap

View file

@ -5,25 +5,25 @@ CONFIG="doc/po4a.config"
# PODIR po directory for manpages/docs # PODIR po directory for manpages/docs
PODIR="doc/po" PODIR="doc/po"
# POTFILE path # POTFILE path
POTFILE="doc/po/emdebian-rootfs.pot" POTFILE="doc/po/multistrap.pot"
# base directory for generated files, e.g. doc # base directory for generated files, e.g. doc
BASEDIR="doc" BASEDIR="doc"
# the binary packages that will contain generated manpages # the binary packages that will contain generated manpages
BINARIES="emdebian-rootfs multistrap" BINARIES="multistrap"
# the Docbook XML manpages for Section 3. # the Docbook XML manpages for Section 3.
XMLMAN3="empbuilderlib.3.xml emrootfslib.3.xml" XMLMAN3=""
# the binary packages using DocBook XML & xsltproc # the binary packages using DocBook XML & xsltproc
XMLPACKAGES="emdebian-rootfs" XMLPACKAGES=""
# the DocBook XML files for Section 1. # the DocBook XML files for Section 1.
XMLMAN1="emsandbox.1.xml" XMLMAN1=""
# the pattern to find the XML files # the pattern to find the XML files
XMLDIR="doc/xml/" XMLDIR=""
# the pattern to find the .docbook files # the pattern to find the .docbook files
DOCBOOKDIR="" DOCBOOKDIR=""
# the XSL file to use for Docbook XSL # the XSL file to use for Docbook XSL
XSLFILE="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl" XSLFILE="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl"
# the POD files for man1 # the POD files for man1
PODFILE="em_multistrap" PODFILE="multistrap"
# the POD files for man3/ - module names regenerated from the path. # the POD files for man3/ - module names regenerated from the path.
PODMODULES="" PODMODULES=""
# POD files for section 7 # POD files for section 7