preparing the new emdebian-rootfs source package
git-svn-id: http://emdebian.org/svn/current@5745 563faec7-e20c-0410-992a-a66f704d0ccd
This commit is contained in:
parent
d11580a25f
commit
805d62ee59
37 changed files with 4772 additions and 2 deletions
14
Makefile
Normal file
14
Makefile
Normal file
|
@ -0,0 +1,14 @@
|
|||
|
||||
all:
|
||||
|
||||
install:
|
||||
|
||||
clean:
|
||||
$(RM) *tar.gz.cdbs-config_list
|
||||
$(RM) *.1 *.3
|
||||
$(RM) doc/po4a.config
|
||||
|
||||
check:
|
||||
|
||||
test:
|
||||
|
115
README
Normal file
115
README
Normal file
|
@ -0,0 +1,115 @@
|
|||
Emdebian Bootstrapping
|
||||
======================
|
||||
|
||||
Cross-building can get very confusing at times. The confusion only increases
|
||||
when dealing with a chroot. This document tries to cover some of the reasons,
|
||||
some of the problems and tries to provide some clarity, at least as far as how
|
||||
chroots can be used in Emdebian.
|
||||
|
||||
There are multiple ways that Emdebian can relate to bootstrapping and chroots.
|
||||
The most common method of using a chroot within Debian is pbuilder and the
|
||||
pdebuild wrapper and this is the primary inspiration for using chroots in
|
||||
Emdebian. Other methods revolve around QEMU or scratchbox and whilst this code
|
||||
may be able to support such uses later, there are key differences in how and
|
||||
why this method is separate.
|
||||
|
||||
EMDEBIAN PBUILDER CHROOT MODEL
|
||||
==============================
|
||||
|
||||
The Debian pbuilder package exists to ensure package dependencies are complete
|
||||
and to provide an environment to automate package building on all supported
|
||||
Debian architectures without cluttering the build machine with every library
|
||||
and dev package in the entire archive. This is particularly useful when
|
||||
building GUI packages that can have two dozen dependencies or more. In
|
||||
Emdebian, this separation between the build system packages and the chroot
|
||||
packages becomes even more useful because cross-building often involves not
|
||||
only installing the library and -dev package for the build architecture (e.g.
|
||||
i386/amd64) but also building and installing the same library and -dev package
|
||||
(with dependencies) in the TARGET architecture, e.g. arm, with apt-cross and
|
||||
dpkg-cross. The chaos that could result from trying to upgrade the packages on
|
||||
an Emdebian buildd system with a duplicate set of cross dependencies is truly
|
||||
scary.
|
||||
|
||||
In the pbuilder model, an Emdebian chroot is the SAME architecture as the
|
||||
buildd - i386 on i386 etc. This mimics how emdebian-tools normally work.
|
||||
Packages are then downloaded, patched and cross-built for the target
|
||||
architecture, just as outside the chroot. This model, the pbuilder model of an
|
||||
emdebian chroot, concentrates on dependencies rather than the actual
|
||||
cross-building process. Inside such a chroot, cache files are used as normal to
|
||||
avoid having to run the cross-compiled code during the build.
|
||||
|
||||
The Emdebian chroot is similar in size to a normal Debian pbuilder chroot,
|
||||
mainly because it is a full build environment, not an installation environment.
|
||||
|
||||
This directory contains my experiments with debootstrap, using this pbuilder
|
||||
model, trying to make a complete Emdebian cross-building environment that can
|
||||
be compressed to a base.tgz. Changes to the chroot can be discarded, just as
|
||||
with pbuilder, allowing dependencies to be tested. The main benefit is that
|
||||
packages can be built without having to install long chains of cross
|
||||
dependencies via apt-cross or dpkg-cross on the main system. To me, it's the
|
||||
only way to cross-build GUI suites like GPE against a background of changing
|
||||
dependencies.
|
||||
|
||||
In the pbuilder model, Emdebian builds a chroot for the build architecture
|
||||
(amd64/i386 etc.) - except that it will run emdebian-tools instead of pbuilder
|
||||
to create the arm binaries (or whichever architecture is the dpkg-cross
|
||||
default). I expect the same code to work for arm chroots on amd64 etc, but
|
||||
mechanisms already exist for those so it's not the priority.
|
||||
|
||||
In order to make best use of the existing pbuilder code, these are shell scripts
|
||||
whereas the rest of emdebian-tools uses perl.
|
||||
|
||||
DEPENDENCIES
|
||||
------------
|
||||
|
||||
To emdebianise and cross-build packages, the chroot needs to install
|
||||
emdebian-tools. This brings in the majority of dependencies to support building
|
||||
Debian and Emdebian packages. This (current sample) code uses part of the
|
||||
pbuilder source so that the eventual chroots behave as similarly as possible to
|
||||
pbuilder and pdebuild in Debian. Therefore, the emdebian pbuilder chroot is NOT
|
||||
designed or intended to be installed on any embedded device - it is intended for
|
||||
cross-building packages for Emdebian only. See the SLIND installer for more
|
||||
information or the emsandbox script in emdebian-tools.
|
||||
|
||||
empdebuild depends on pbuilder and installing emdebian-tools within a chroot
|
||||
causes pbuilder to be installed inside the chroot. Whilst empdebuild and emsandbox
|
||||
could be split out into a separate package to prevent pbuilder being needed inside
|
||||
the chroot, there are corner cases where this can be useful providing sufficient
|
||||
care is taken.
|
||||
|
||||
DIFFERENCES TO PBUILDER
|
||||
-----------------------
|
||||
|
||||
1. emdebian-tools handles the 'installaptlines' subroutine.
|
||||
2. emdebian-tools dependencies handle the installation of build-essential dpkg-dev
|
||||
and apt that pbuilder normally does separately.
|
||||
3. emdebian-tools handles the BUILDPLACE via debconf.
|
||||
4. Other embootstrap options are hardcoded - BUILDRESULT is placed in BUILDPLACE,
|
||||
APTCACHE also and APTCACHEHARDLINK is set to yes.
|
||||
5. emdebian-tools provides the emdebianised source package and patches.
|
||||
|
||||
EMDEBIAN NATIVE CHROOT MODEL
|
||||
============================
|
||||
|
||||
The same code should also be able to create a native chroot so that the
|
||||
cross-built packages can be installed alongside each other for more testing.
|
||||
These chroots have already been tested and instructions exist in the Wiki:
|
||||
http://wiki.debian.org/EmDebian/CrossDebootstrap
|
||||
|
||||
Trying to cross-build inside scratchbox limits you to where scratchbox will
|
||||
install which is only certain architectures. emdebian-tools is about
|
||||
cross-building Debian packages using normal Debian tools on a normal Debian
|
||||
system. Emdebian and emdebian-tools are designed to make building inside
|
||||
scratchbox redundant because it simply isn't sufficiently flexible. A
|
||||
scratchbox2 has been mooted but nothing has happened yet.
|
||||
|
||||
Cross-build using normal tools (maybe using the chroot as above) and then test
|
||||
either on a native device or via scratchbox if you really have to.
|
||||
|
||||
An Emdebian native chroot would be an arm chroot running on an amd64 system -
|
||||
indeed it would need to support creation of a chroot *for* any supported Debian
|
||||
architecture and be able to create and run that chroot *on* any supported
|
||||
Debian architecture.
|
||||
|
||||
This is only the first draft - if there are areas that need further clarification
|
||||
or updating, please email the debian-embedded mailing list.
|
146
TODO
Normal file
146
TODO
Normal file
|
@ -0,0 +1,146 @@
|
|||
TODO for bootstrap / pbuilder config.
|
||||
|
||||
(no particular order)
|
||||
|
||||
note: pbuilder bug - default mirror does not include deb-src version.
|
||||
also: gnupg needs the user directory and to be run once for
|
||||
dpkg-source! :-(
|
||||
also need apt-get build-dep if using emchain
|
||||
|
||||
copy build log and built files out of jail/ before compressing
|
||||
define parameters - inherit from pbuilderrc
|
||||
|
||||
These chroots have already been tested and instructions
|
||||
exist in the Wiki. http://wiki.debian.org/EmDebian/CrossDebootstrap
|
||||
|
||||
dpkg filter to remove unneeded files:
|
||||
1. /var/lib/dpkg/info/*.symbols
|
||||
2. /var/lib/dpkg/available-old
|
||||
3. /var/lib/dpkg/status-old
|
||||
modify dpkg to drop /var/log/dpkg.log
|
||||
or simply mount /var/log, /var/cache in RAM.
|
||||
|
||||
modify apt to remove unwanted files:
|
||||
/var/cache/apt/(src)?pkgcache.bin
|
||||
always run apt-get clean
|
||||
always drop files in /var/lib/apt/lists/
|
||||
|
||||
Split out /usr/share/X11/locale/ (1.3Mb)
|
||||
|
||||
Drop /usr/lib/xorg/modules/libscanpci.so (2Mb)
|
||||
|
||||
X fails to start without:
|
||||
/usr/lib/xorg/modules/libpcidata.so
|
||||
(can the file size be reduced?)
|
||||
|
||||
Other candidates may be amongst:
|
||||
100527
|
||||
47296 /usr
|
||||
30674 /usr/lib
|
||||
29150 /var
|
||||
25092 /var/cache
|
||||
25049 /var/cache/apt
|
||||
24576 /var/cache/apt/pkgcache.bin
|
||||
18138 /lib
|
||||
12007 /lib/modules
|
||||
12005 /lib/modules/2.6.25.2-pxa270
|
||||
11345 /lib/modules/2.6.25.2-pxa270/kernel
|
||||
8224 /usr/share
|
||||
7378 /usr/bin
|
||||
6897 /lib/modules/2.6.25.2-pxa270/kernel/drivers
|
||||
5822 /usr/lib/gconv
|
||||
3747 /usr/lib/xorg
|
||||
3745 /usr/lib/xorg/modules
|
||||
3572 /var/lib
|
||||
3358 /usr/lib/libgtk-x11-2.0.so.0.1200.3
|
||||
2780 /var/lib/dpkg
|
||||
2744 /sbin
|
||||
2709 /lib/modules/2.6.25.2-pxa270/kernel/fs
|
||||
2414 /usr/share/zoneinfo
|
||||
2153 /var/lib/dpkg/info
|
||||
2046 /lib/modules/2.6.25.2-pxa270/kernel/drivers/usb
|
||||
1799 /lib/modules/2.6.25.2-pxa270/kernel/drivers/media
|
||||
1733 /usr/share/fonts
|
||||
1656 /usr/bin/Xorg
|
||||
1490 /tmp
|
||||
1430 /usr/share/X11
|
||||
1381 /usr/share/X11/locale
|
||||
1288 /lib/modules/2.6.25.2-pxa270/kernel/drivers/net
|
||||
1179 /usr/lib/libcrypto.so.0.9.8
|
||||
1160 /usr/share/fonts/X11
|
||||
1150 /lib/libc-2.7.so
|
||||
1122 /usr/lib/libxml2.so.2.6.32
|
||||
1080 /bin
|
||||
955 /lib/modules/2.6.25.2-pxa270/kernel/drivers/usb/serial
|
||||
940 /lib/modules/2.6.25.2-pxa270/kernel/drivers/media/dvb
|
||||
932 /usr/lib/xorg/modules/libpcidata.so
|
||||
926 /usr/lib/libstdc++.so.6.0.10
|
||||
913 /lib/modules/2.6.25.2-pxa270/kernel/net
|
||||
904 /usr/lib/libX11.so.6.2.0
|
||||
869 /usr/share/zoneinfo/right
|
||||
846 /lib/modules/2.6.25.2-pxa270/kernel/drivers/media/video
|
||||
842 /usr/bin/gpg
|
||||
833 /usr/sbin
|
||||
821 /usr/lib/libapt-pkg-libc6.6-6.so.4.6.0
|
||||
755 /var/lib/apt
|
||||
751 /var/lib/apt/lists
|
||||
744 /bin/busybox
|
||||
742 /tmp/bb-1.11
|
||||
740 /tmp/busybox
|
||||
740 /tmp/bb-1.11/busybox
|
||||
731 /var/lib/apt/lists/buildd.emdebian.org_emdebian_dists_unstable_main_binary-arm_Packages
|
||||
711 /usr/lib/libglib-2.0.so.0.1600.5
|
||||
685 /lib/modules/2.6.25.2-pxa270/kernel/fs/nls
|
||||
666 /lib/modules/2.6.25.2-pxa270/kernel/sound
|
||||
662 /usr/share/zoneinfo/posix
|
||||
662 /lib/libslang.so.2.1.3
|
||||
|
||||
|
||||
|
||||
==============================
|
||||
|
||||
Balloon todo list
|
||||
-------------------
|
||||
|
||||
Add CONFIG_DISPLAY_TOPPOLY in kernel build.
|
||||
|
||||
$ grep perl usr/sbin/*
|
||||
Binary file usr/sbin/chroot matches
|
||||
usr/sbin/cleanup-info:#!/usr/bin/perl --
|
||||
usr/sbin/dpkg-divert:#!/usr/bin/perl --
|
||||
usr/sbin/dpkg-statoverride:#! /usr/bin/perl
|
||||
Binary file usr/sbin/fbset matches
|
||||
usr/sbin/install-info:#!/usr/bin/perl --
|
||||
usr/sbin/mkboot: bootpart=$(perl -ne 'print $1 if /^\s*boot\s*=\s*(\S*)/' /etc/lilo.conf)
|
||||
usr/sbin/pam_getenv:#!/usr/bin/perl -w
|
||||
Binary file usr/sbin/rdate matches
|
||||
Binary file usr/sbin/udhcpd matches
|
||||
usr/sbin/update-alternatives:#!/usr/bin/perl --
|
||||
(debianutils: /usr/sbin/mkboot)
|
||||
|
||||
$ grep perl usr/bin/* | grep -v Binary
|
||||
usr/bin/chkdupexe:#!/usr/bin/perl -w
|
||||
usr/bin/chkdupexe:# Distribute under gnu copyleft (included in perl package)
|
||||
usr/bin/chkdupexe:# - Made it possible to run with perl -w
|
||||
usr/bin/chkdupexe: die "NUTS! Personaly I think your perl or filesystem is broken.\n".
|
||||
(util-linux)
|
||||
|
||||
Kernel command line: noinitrd root=/dev/mtdblock1 init=/linuxrc console=ttyS2,115200 rootfstype=yaffs2 cpufreq=59000-206400 machine_id=00000
|
||||
|
||||
balloon3_init_irq: chained handler installed - irq 126 automatically enabled
|
||||
|
||||
|
||||
# grep oknodo /etc/init.d/S*
|
||||
/etc/init.d/S10udev: if start-stop-daemon --stop --name udevd --quiet --oknodo --retry 5; then
|
||||
/etc/init.d/S10udev: if start-stop-daemon --stop --name udevd --quiet --oknodo --retry 5; then
|
||||
/etc/init.d/S10udev: if start-stop-daemon --stop --name udevd --quiet --oknodo --retry 5; then
|
||||
|
||||
--retry is also not supported.
|
||||
|
||||
mkdir /mnt/sda1
|
||||
mkdir /mnt/sda2
|
||||
|
||||
Add initscripts to get mountpoint for udev.
|
||||
|
||||
drop install-info from dpkg
|
||||
|
5
debian/changelog
vendored
Normal file
5
debian/changelog
vendored
Normal file
|
@ -0,0 +1,5 @@
|
|||
emdebian-rootfs (1.8.0) unstable; urgency=low
|
||||
|
||||
* Initial split from emdebian-tools source package.
|
||||
|
||||
-- Neil Williams <codehelp@debian.org> Thu, 26 Mar 2009 21:59:13 +0000
|
1
debian/compat
vendored
Normal file
1
debian/compat
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
5
|
49
debian/control
vendored
Normal file
49
debian/control
vendored
Normal file
|
@ -0,0 +1,49 @@
|
|||
Source: emdebian-rootfs
|
||||
Section: utils
|
||||
Priority: extra
|
||||
Maintainer: Neil Williams <codehelp@debian.org>
|
||||
Uploaders: Wookey <wookey@debian.org>
|
||||
Build-Depends: cdbs, debhelper (>= 5), po-debconf
|
||||
Build-Depends-Indep: devscripts, docbook-xsl,
|
||||
gnupg, libxml2-utils, po4a, xml-core, xsltproc
|
||||
Standards-Version: 3.8.1
|
||||
Homepage: http://www.emdebian.org/
|
||||
Vcs-Browser: http://buildd.emdebian.org/svn/browser/current/
|
||||
Vcs-Svn: http://buildd.emdebian.org/repos/current/
|
||||
|
||||
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, libemdebian-tools-perl
|
||||
Replaces: emdebian-tools (<= 1.4.3)
|
||||
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
|
||||
Section: admin
|
||||
Architecture: all
|
||||
Depends: ${perl:Depends}, ${misc:Depends}, apt,
|
||||
libconfig-auto-perl, libparse-debian-packages-perl
|
||||
Replaces: emdebian-rootfs (<= 1.6.0)
|
||||
Description: multiple repository bootstrap based on apt
|
||||
debootstrap replacement with multiple repository support
|
||||
using apt to handle all dependency issues and conflicts.
|
||||
.
|
||||
Includes support for foreign architecture multistraps that need
|
||||
only minimal configuration on the final device. Supports cleaning
|
||||
up the generated bootstrap filesystem to remove downloaded packages
|
||||
and hooks to modify the files in the bootstrap filesystem after
|
||||
the packages have been unpacked but before being configured.
|
||||
.
|
||||
Unlike debootstrap, multistrap relies on working versions of
|
||||
dpkg and apt outside the final filesystem.
|
35
debian/copyright
vendored
Normal file
35
debian/copyright
vendored
Normal file
|
@ -0,0 +1,35 @@
|
|||
This package was downloaded from
|
||||
http://buildd.emdebian.org/svn/browser/current/host/trunk/emdebian-tools/trunk/
|
||||
|
||||
Files: debian/*
|
||||
Licence: GPL-3+
|
||||
Copyright: 2006-2007 Neil Williams <codehelp@debian.org>
|
||||
|
||||
Files: *
|
||||
Licence: GPL-3+
|
||||
Copyright: Copyright 2006-2008 Neil Williams <codehelp@debian.org>
|
||||
Copyright 2008 Hands.com Ltd <phil@hands.com>
|
||||
Copyright 2006-2007 Wookey <wookey@debian.org>
|
||||
Copyright 1998-2006 Craig Small <csmall@debian.org>
|
||||
Copyright 1999-2003 Julian Gilbey <jdg@debian.org>
|
||||
Copyright 2002,2003 Colin Walters <walters@debian.org>
|
||||
Copyright 2001-2006 Junichi Uekawa <dancer@netfort.gr.jp>
|
||||
Copyright 2001-2005 Anthony Towns <ajt@debian.org>
|
||||
|
||||
License:
|
||||
|
||||
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/>.
|
||||
|
||||
On Debian systems, the complete text of the GNU General
|
||||
Public License can be found in `/usr/share/common-licenses/GPL-3'.
|
18
debian/emdebian-rootfs.install
vendored
Normal file
18
debian/emdebian-rootfs.install
vendored
Normal file
|
@ -0,0 +1,18 @@
|
|||
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/man/man1/emsandbox.1 ./usr/share/man/man1/
|
||||
doc/man/man3/* ./usr/share/man/man3/
|
||||
examples/packages.conf ./usr/share/emdebian-tools/examples/machine/default/
|
||||
examples/setup.sh ./usr/share/emdebian-tools/examples/machine/default/
|
||||
examples/config.sh ./usr/share/emdebian-tools/examples/machine/default/
|
||||
examples/README ./usr/share/emdebian-tools/examples/
|
||||
emdebian-rootfs ./etc/bash_completion.d/
|
35
debian/emdebian-rootfs.postinst
vendored
Executable file
35
debian/emdebian-rootfs.postinst
vendored
Executable file
|
@ -0,0 +1,35 @@
|
|||
#! /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
|
4
debian/multistrap.install
vendored
Normal file
4
debian/multistrap.install
vendored
Normal file
|
@ -0,0 +1,4 @@
|
|||
em_multistrap ./usr/sbin/
|
||||
multistrap ./usr/sbin/
|
||||
doc/man/man1/em_multistrap.1 ./usr/share/man/man1/
|
||||
bash/multistrap ./etc/bash_completion.d/
|
1
debian/multistrap.links
vendored
Normal file
1
debian/multistrap.links
vendored
Normal file
|
@ -0,0 +1 @@
|
|||
/usr/share/man/man1/em_multistrap.1 /usr/share/man/man1/multistrap.1
|
16
debian/rules
vendored
Executable file
16
debian/rules
vendored
Executable file
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/make -f
|
||||
# Sample debian/rules that uses cdbs. Originally written by Robert Millan.
|
||||
# This file is public domain.
|
||||
|
||||
include /usr/share/cdbs/1/class/makefile.mk
|
||||
include /usr/share/cdbs/1/rules/debhelper.mk
|
||||
include /usr/share/cdbs/1/rules/simple-patchsys.mk
|
||||
|
||||
install/emdebian-rootfs::
|
||||
./doc/genmanpages
|
||||
po4a --rm-backups doc/po4a.config
|
||||
|
||||
clean::
|
||||
# debconf-updatepo
|
||||
rm -rf doc/man/man1 doc/man/man3
|
||||
rm -rf pod2htmd.tmp pod2htmi.tmp
|
112
doc/genmanpages
Executable file
112
doc/genmanpages
Executable file
|
@ -0,0 +1,112 @@
|
|||
#!/bin/sh
|
||||
set -e
|
||||
|
||||
# Copyright (C) 2006-2009 Neil Williams <codehelp@debian.org>
|
||||
#
|
||||
# This program 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/>.
|
||||
|
||||
wrap_langs () {
|
||||
if [ -z "$LANGS" ]; then
|
||||
echo "$1 $2" >> $CONFIG
|
||||
else
|
||||
echo "$1 $2 $3" >> $CONFIG
|
||||
fi
|
||||
}
|
||||
|
||||
if [ -f po4a.config ]; then
|
||||
cd ../
|
||||
fi
|
||||
if [ -f ../po4a.config ]; then
|
||||
cd ../../
|
||||
fi
|
||||
CONFIG="doc/po4a.config"
|
||||
# calculate the langs, automatically.
|
||||
LANGS=`ls po/*.po 2>/dev/null || true`
|
||||
if [ ! -z "$LANGS" ]; then
|
||||
LANGS=`ls po/*.po | sed -e 's/.*\/\(.*\)\.po/\1 /' || true`
|
||||
fi
|
||||
if [ ! -z "$LANGS" ]; then
|
||||
# LANGS should not include the specification, just the root.
|
||||
LANGS=`echo $LANGS | sed -e 's/_.*//'`
|
||||
LANGS=`echo $LANGS | sed -e 's/@.*//'`
|
||||
LANGS=`echo $LANGS | sed -e 's/\+.*//'`
|
||||
echo "[po4a_langs] $LANGS" > $CONFIG
|
||||
else
|
||||
echo > $CONFIG
|
||||
fi
|
||||
wrap_langs "[po4a_paths]" "po/emdebian-rootfs.pot" "\$lang:po/\$lang.po"
|
||||
# need to determine directory for the target package.
|
||||
# rootfs only has empbuilderlib.3, emrootfslib.3 and emsandbox.1
|
||||
|
||||
for l in $LANGS; do
|
||||
mkdir -p doc/html/$l/
|
||||
mkdir -p doc/man/$l/man1/
|
||||
mkdir -p doc/man/$l/man3/
|
||||
done
|
||||
|
||||
mkdir -p doc/html/
|
||||
mkdir -p doc/man/man3/
|
||||
mkdir -p doc/man/man1/
|
||||
|
||||
echo "Checking emrootfslib for POSIX compatibility"
|
||||
# doesn't expect a shell library, hence nuisance message
|
||||
# about interpreter that just needs to be ignored.
|
||||
checkbashisms emrootfslib
|
||||
echo "Processing Docbook XML . . . "
|
||||
for file in `ls doc/xml/*.xml`; do
|
||||
xmllint --format "$file" --output "$file"
|
||||
LOCAL=`basename $file`
|
||||
wrap_langs "[type:xml]" "$file" "\$lang:doc/xml/\$lang/$LOCAL"
|
||||
done
|
||||
echo "Processing POD . . ."
|
||||
|
||||
# rootfs
|
||||
for file in em_multistrap; do
|
||||
pod2html -outfile doc/html/$file.html -title $file < $file
|
||||
pod2man $file > doc/man/man1/$file.1
|
||||
wrap_langs "[type: pod]" "$file" "\$lang:doc/pod/\$lang/$file"
|
||||
done
|
||||
|
||||
echo "Refreshing POT file for translators"
|
||||
# use -k to create all XML even if untranslated or the XSL breaks the build.
|
||||
po4a -k 0 $CONFIG
|
||||
|
||||
# just make sure the XML catalog is available for XSL.
|
||||
# never go to the internet for build config, use -nonet.
|
||||
XML_CATALOG_FILES="/etc/xml/catalog" \
|
||||
xsltproc -o doc/man/ -''-nonet http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl doc/xml/emdebian-rootfs.1.xml
|
||||
mv doc/man/empbuilderlib.3 doc/man/man3/empbuilderlib.3
|
||||
mv doc/man/emrootfslib.3 doc/man/man3/emrootfslib.3
|
||||
mv doc/man/emsandbox.1 doc/man/man1/emsandbox.1
|
||||
mv doc/man/*.1 doc/man/man1/
|
||||
#mv doc/man/*.3 doc/man/man3/
|
||||
|
||||
for l in $LANGS; do
|
||||
mkdir -p doc/man/$l/man3/
|
||||
mkdir -p doc/man/$l/man1/
|
||||
mv doc/man/$l/empbuilderlib.3 doc/man/$l/man3/empbuilderlib.3
|
||||
mv doc/man/$l/emsandbox.1 doc/man/$l/man1/emsandbox.1
|
||||
mv doc/man/$l/*.1 doc/man/$l/man1/
|
||||
done
|
||||
|
||||
# never go to the internet for build config, use -nonet.
|
||||
xsltproc -o doc/html/ -nonet http://docbook.sourceforge.net/release/xsl/current/html/chunk.xsl doc/xml/emdebian-rootfs.1.xml
|
||||
for i in `ls doc/html/*.html`; do
|
||||
iconv -t utf-8 -f iso8859-1 $i > doc/html/tmp
|
||||
sed < doc/html/tmp > $i -e 's:charset=ISO-8859-1:charset=UTF-8:'
|
||||
done
|
||||
rm -f doc/html/tmp
|
||||
rm -f pod2htmd.tmp
|
||||
rm -f pod2htmi.tmp
|
||||
rm -rf doc/pod/
|
145
doc/xml/emdebian-rootfs.1.xml
Normal file
145
doc/xml/emdebian-rootfs.1.xml
Normal file
|
@ -0,0 +1,145 @@
|
|||
<?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 empdebuild SYSTEM "empdebuild.1.xml">
|
||||
<!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>
|
||||
</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>
|
||||
&empdebuild;
|
||||
&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>
|
77
doc/xml/empbuilderlib.3.xml
Normal file
77
doc/xml/empbuilderlib.3.xml
Normal file
|
@ -0,0 +1,77 @@
|
|||
<?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>
|
347
doc/xml/empdebuild.1.xml
Normal file
347
doc/xml/empdebuild.1.xml
Normal file
|
@ -0,0 +1,347 @@
|
|||
<?xml version="1.0" encoding="UTF-8"?>
|
||||
<refentry id="empdebuild">
|
||||
<refentryinfo>
|
||||
<productname>empdebuild</productname>
|
||||
<productnumber/>
|
||||
</refentryinfo>
|
||||
<refmeta>
|
||||
<refentrytitle>empdebuild</refentrytitle>
|
||||
<manvolnum>1</manvolnum>
|
||||
<refmiscinfo class="source">EMDEBIAN-TOOLS</refmiscinfo>
|
||||
<refmiscinfo class="manual">EMDEBIAN-TOOLS</refmiscinfo>
|
||||
</refmeta>
|
||||
<refnamediv id="name">
|
||||
<refname>empdebuild</refname>
|
||||
<refpurpose>chroot tool for Emdebian cross compiling</refpurpose>
|
||||
</refnamediv>
|
||||
<refsynopsisdiv>
|
||||
<cmdsynopsis>
|
||||
<command>empdebuild</command>
|
||||
<group>
|
||||
<arg>-a</arg>
|
||||
<arg>--arch </arg>
|
||||
<replaceable> ARCHITECTURE</replaceable>
|
||||
</group>
|
||||
<group>
|
||||
<arg>--testing</arg>
|
||||
</group>
|
||||
<group>
|
||||
<arg>--login-after-fail</arg>
|
||||
</group>
|
||||
<group>
|
||||
<arg>--build</arg>
|
||||
<arg>build</arg>
|
||||
</group>
|
||||
</cmdsynopsis>
|
||||
<cmdsynopsis>
|
||||
<command>empdebuild</command>
|
||||
<group>
|
||||
<arg>-a</arg>
|
||||
<arg>--arch </arg>
|
||||
<replaceable> ARCHITECTURE</replaceable>
|
||||
</group>
|
||||
<group>
|
||||
<arg>--testing</arg>
|
||||
</group>
|
||||
<group>
|
||||
<arg>--create</arg>
|
||||
<arg>create</arg>
|
||||
</group>
|
||||
</cmdsynopsis>
|
||||
<cmdsynopsis>
|
||||
<command>empdebuild</command>
|
||||
<group>
|
||||
<arg>-a</arg>
|
||||
<arg>--arch </arg>
|
||||
<replaceable> ARCHITECTURE</replaceable>
|
||||
</group>
|
||||
<group>
|
||||
<arg>--testing</arg>
|
||||
</group>
|
||||
<group>
|
||||
<arg>--save-after-login</arg>
|
||||
</group>
|
||||
<group>
|
||||
<arg>--login</arg>
|
||||
<arg>login </arg>
|
||||
</group>
|
||||
</cmdsynopsis>
|
||||
<cmdsynopsis>
|
||||
<command>empdebuild</command>
|
||||
<group>
|
||||
<arg>-a</arg>
|
||||
<arg>--arch </arg>
|
||||
<replaceable> ARCHITECTURE</replaceable>
|
||||
</group>
|
||||
<group>
|
||||
<arg>--testing</arg>
|
||||
</group>
|
||||
<group>
|
||||
<arg>--update</arg>
|
||||
<arg>update</arg>
|
||||
</group>
|
||||
</cmdsynopsis>
|
||||
<cmdsynopsis>
|
||||
<command>empdebuild</command>
|
||||
<group>
|
||||
<arg>-a</arg>
|
||||
<arg>--arch </arg>
|
||||
<replaceable> ARCHITECTURE</replaceable>
|
||||
</group>
|
||||
<group>
|
||||
<arg>--login-after-fail</arg>
|
||||
</group>
|
||||
<group>
|
||||
<arg>--autobuild</arg>
|
||||
<arg>autobuild</arg>
|
||||
</group>
|
||||
</cmdsynopsis>
|
||||
<cmdsynopsis>
|
||||
<command>empdebuild</command>
|
||||
<group>
|
||||
<arg>-a</arg>
|
||||
<arg>--arch </arg>
|
||||
<replaceable> ARCHITECTURE</replaceable>
|
||||
</group>
|
||||
<group>
|
||||
<arg>--clean</arg>
|
||||
<arg>clean</arg>
|
||||
</group>
|
||||
</cmdsynopsis>
|
||||
</refsynopsisdiv>
|
||||
<refsect1 id="description">
|
||||
<title>DESCRIPTION</title>
|
||||
<para>Note that <command>empdebuild</command> does not support all the
|
||||
options available to <command>pbuilder</command>.
|
||||
</para>
|
||||
<para><command>empdebuild</command> is an Emdebian version of pdebuild, building
|
||||
Emdebian packages in a chroot using code from pbuilder. The Emdebian chroot includes the
|
||||
cross-building toolchain from Emdebian for the requested architecture and includes
|
||||
support for installing cross versions of package dependencies via
|
||||
<command>apt-cross</command> with all the advantages of a chroot - identification of
|
||||
missing dependencies and the ability to build packages without installing the dependencies
|
||||
on the main system, e.g. to support a buildd.
|
||||
</para>
|
||||
<note>
|
||||
<title>empdebuild is a build chroot</title>
|
||||
<para><command>empdebuild</command> creates a chroot for the same architecture as
|
||||
the system running <command>empdebuild</command> and then installs a cross-building
|
||||
toolchain from Emdebian using the <command>dpkg-cross</command> default
|
||||
architecture or the specified architecture. This has some important results:
|
||||
</para>
|
||||
<orderedlist>
|
||||
<listitem>
|
||||
<para>The chroot is a Debian system running <filename>emdebian-tools</filename>
|
||||
and is equivalent to a typical installation of emdebian-tools
|
||||
<emphasis>after</emphasis> <command>emsetup</command> has been completed
|
||||
successfully. This includes installing perl and debconf inside the chroot.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>A suitable Emdebian toolchain will be installed in the chroot.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>The same cache files are needed inside the chroot as would be needed on the
|
||||
main system - cross-built binaries <emphasis role="bold">cannot</emphasis> be run
|
||||
within the the chroot. All the normal emdebian patch files will be needed.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>This is a full build system with native and cross compilers, development
|
||||
packages, autotools and subversion. It is <emphasis role="bold">NOT</emphasis>
|
||||
suitable for installation on any device. Use <command>emsandbox</command>
|
||||
instead.
|
||||
</para>
|
||||
</listitem>
|
||||
<listitem>
|
||||
<para>The chroot disables the installation of recommended packages by
|
||||
apt using the Install-Recommends "false" option.
|
||||
</para>
|
||||
</listitem>
|
||||
</orderedlist>
|
||||
</note>
|
||||
<para>Use <command>emsandbox</command> to create cross chroots (where the
|
||||
chroot is built for a different architecture to the system running the chroot),
|
||||
e.g. to prepare a rootfs for installation on an arm device using emdebian-tools
|
||||
installed on i386, amd64 etc. See <command>emsandbox</command> (1).
|
||||
</para>
|
||||
</refsect1>
|
||||
<refsect1 id="commands">
|
||||
<title>COMMANDS</title>
|
||||
<para>Options for <command>dpkg-buildpackage</command> can be given
|
||||
after the <option>--</option> option. The default options are
|
||||
<option>-uc -us</option> which cannot be overridden. Also certain
|
||||
commands do not make sense in this context,
|
||||
e.g. <option>-a</option> for architecture will be silently dropped.
|
||||
</para>
|
||||
<variablelist remap="TP">
|
||||
<varlistentry>
|
||||
<term><option>--build</option>|<option>build</option></term>
|
||||
<listitem>
|
||||
<para>(to provide) similar functionality to pdebuild for Emdebian -
|
||||
copies the source into the chroot and runs a build using
|
||||
<command>emdebuild</command>.
|
||||
</para>
|
||||
<para>Use <option>--login-after-fail</option> to debug a failed build.
|
||||
If <command>emdebuild</command> fails inside the chroot,
|
||||
<command>empdebuild</command> will then open a shell at the point
|
||||
of failure, allowing you to debug the build session with the active data.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--create</option>|<option>create</option></term>
|
||||
<listitem>
|
||||
<para>Runs <command>debootstrap</command> with a modified suite rule
|
||||
set to create a basic Emdebian environment, including emdebian-tools and
|
||||
an Emdebian toolchain for the default or specified architecture.
|
||||
</para>
|
||||
<para>Checks for an existing chroot and exits if one is found - either use
|
||||
<option>--update</option> or move the old chroot out of the way.
|
||||
</para>
|
||||
<para>If <option>--create</option> fails after debootstrap has
|
||||
completed, <option>--update</option> should be able to recover
|
||||
and create the necessary tarball.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--login</option>|<option>login</option></term>
|
||||
<listitem>
|
||||
<para>Login to the chroot. Unless <option>--save-after-login</option> is used,
|
||||
changes made within the chroot will be lost.
|
||||
</para>
|
||||
<para>When setting up any chroot, debconf is set to use the default values
|
||||
and this leads to <command>dpkg-cross</command> being set to
|
||||
<userinput>None</userinput> as the default cross building architecture.
|
||||
When logged into the chroot, always specify the <option>--arch</option>
|
||||
option to <command>apt-cross</command> and all
|
||||
<emphasis>emdebian-tools</emphasis> scripts.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--update</option>|<option>update</option></term>
|
||||
<listitem>
|
||||
<para>Updates the Emdebian environment, including emdebian-tools and
|
||||
an Emdebian toolchain for the default or specified architecture. Depending on
|
||||
the status of gcc-?.? in Debian, there can be problems updating the cross
|
||||
building toolchain at this stage. If you get reports of broken packages
|
||||
or toolchain packages that fail to install, allow the update to continue as
|
||||
normal, then login to the chroot with the <option>--save-after-login</option>
|
||||
option. If the problem relates to a package named <filename>$PACKAGE-$ARCH-cross</filename>
|
||||
not <filename>$PACKAGE-$ARCHTYPE</filename> ($ARCHTYPE for arm = arm-linux-gnu), this
|
||||
package is handled by <command>dpkg-cross</command> and <command>apt-cross</command>.
|
||||
Use <command>apt-cross -a $ARCH -v -i $PACKAGE</command> (omit the -$ARCH-cross suffix)
|
||||
to update such packages ahead of the Emdebian repository. Use
|
||||
<command>apt-get dist-upgrade</command> and <command>emsetup -a $ARCH --yes</command>
|
||||
to complete the upgrade. Type 'exit' or use 'Ctrl-D' to exit from the chroot and
|
||||
the updated packages will be saved alongside the updated chroot.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term><option>--clean</option>|<option>clean</option></term>
|
||||
<listitem>
|
||||
<para>Uses pbuilder functions to clean the chroot build place,
|
||||
removing any previous build environments. In some situations, a stale
|
||||
build environment may still contain active mounts for
|
||||
<computeroutput>proc</computeroutput> or <computeroutput>dev/pts</computeroutput>
|
||||
and these will result in <emphasis>Device or resource busy</emphasis> errors.
|
||||
To umount the relevant points, look for your Emdebian working directory being
|
||||
listed in the output of <computeroutput>mount</computeroutput> and pass that
|
||||
directory name to:
|
||||
<programlisting>
|
||||
$ sudo umount PATH
|
||||
</programlisting>
|
||||
Once umounted, either remove the files manually or run <command>sudo empdebuild</command>
|
||||
<option>--clean</option> again.
|
||||
</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. The Emdebian toolchain in the chroot
|
||||
will be upgraded (or installed if the chroot contains a toolchain for a
|
||||
different architecture).
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--testing</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Create, update, login or build a package within a chroot based on
|
||||
Debian testing, not Debian unstable. This is a fallback option for the times
|
||||
when Debian unstable transitions make it impossible to install a cross-building
|
||||
toolchain or update the existing toolchain.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--save-after-login</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Login to the chroot and allow changes made within the chroot to persist
|
||||
into subsequent sessions. Only supported in conjunction with
|
||||
<option>login</option>|<option>--login</option>.
|
||||
</para>
|
||||
</listitem>
|
||||
</varlistentry>
|
||||
<varlistentry>
|
||||
<term>
|
||||
<option>--login-after-fail</option>
|
||||
</term>
|
||||
<listitem>
|
||||
<para>Login to the chroot if <command>emdebuild</command> fails
|
||||
within the chroot, at the point where the build failed. Chroot cross builds
|
||||
can involve a protracted setup phase which can be hard to replicate
|
||||
outside the chroot. Use this option to find out why a chroot build failed
|
||||
when a normal build succeeded. Only supported in conjunction with
|
||||
<option>build</option>|<option>--build</option>.
|
||||
</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>
|
||||
<title>Author</title>
|
||||
<para><command>empdebuild</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),
|
||||
<filename>emsandbox</filename> (1).
|
||||
</para>
|
||||
</refsect1>
|
||||
</refentry>
|
214
doc/xml/emrootfslib.3.xml
Normal file
214
doc/xml/emrootfslib.3.xml
Normal file
|
@ -0,0 +1,214 @@
|
|||
<?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>
|
448
doc/xml/emsandbox.1.xml
Normal file
448
doc/xml/emsandbox.1.xml
Normal file
|
@ -0,0 +1,448 @@
|
|||
<?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>
|
||||
</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://buildd.emdebian.org/emdebian/</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>
|
382
embootstrap
Executable file
382
embootstrap
Executable file
|
@ -0,0 +1,382 @@
|
|||
#!/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-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/>.
|
||||
#
|
||||
|
||||
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
|
||||
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
|
||||
shift
|
||||
;;
|
||||
--machine)
|
||||
shift
|
||||
MACHINE=$1
|
||||
VARIANT=default
|
||||
if [ ! -d "${MACHINEPATH}/$MACHINE" ]; then
|
||||
echo "Cannot find '${MACHINEPATH}/$MACHINE'."
|
||||
exit
|
||||
fi
|
||||
shift
|
||||
;;
|
||||
--variant)
|
||||
shift
|
||||
VARIANT=$1
|
||||
if [ ! $MACHINE ]; then
|
||||
echo "Variant specified without a machine."
|
||||
exit
|
||||
fi
|
||||
if [ ! -d "${MACHINEPATH}/$MACHINE/$VARIANT" ]; then
|
||||
echo "Cannot find '${MACHINEPATH}/$MACHINE/$VARIANT'."
|
||||
exit
|
||||
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
|
||||
fi
|
||||
|
||||
# include packages.conf if --machine used.
|
||||
if [ "$MACHINE" != "x" -a "$VARIANT" != "x" -a $CROSS -a $CROSS = $ARCH ]; then
|
||||
# sets INCLUDE, SCRIPT, MIRROR etc.
|
||||
if [ -f ${MACHINEPATH}/$MACHINE/$VARIANT/packages.conf ]; then
|
||||
. ${MACHINEPATH}/$MACHINE/$VARIANT/packages.conf
|
||||
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
|
||||
URL=`perl -e "use Emdebian::Tools; use Config::Auto; print &get_primary;"`
|
||||
if [ ! -z "$URL" ]; then
|
||||
MIRROR="http://${URL}/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
|
93
emdebian-rootfs
Normal file
93
emdebian-rootfs
Normal file
|
@ -0,0 +1,93 @@
|
|||
# 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
|
87
emdebian.busybox
Normal file
87
emdebian.busybox
Normal file
|
@ -0,0 +1,87 @@
|
|||
# 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."
|
||||
}
|
80
emdebian.coreutils
Normal file
80
emdebian.coreutils
Normal file
|
@ -0,0 +1,80 @@
|
|||
# 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."
|
||||
}
|
85
emdebian.crossd
Normal file
85
emdebian.crossd
Normal file
|
@ -0,0 +1,85 @@
|
|||
# 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."
|
||||
}
|
90
emdebian.gpe
Normal file
90
emdebian.gpe
Normal file
|
@ -0,0 +1,90 @@
|
|||
# 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."
|
||||
}
|
101
emdebian.grip
Normal file
101
emdebian.grip
Normal file
|
@ -0,0 +1,101 @@
|
|||
# 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
|
||||
}
|
84
emdebian.gtk
Normal file
84
emdebian.gtk
Normal file
|
@ -0,0 +1,84 @@
|
|||
# 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."
|
||||
}
|
198
empbuilderlib
Normal file
198
empbuilderlib
Normal file
|
@ -0,0 +1,198 @@
|
|||
# empbuilderlib : shell library to support building chroots for Emdebian.
|
||||
#
|
||||
# Copyright (C) 2006-2008 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
|
||||
}
|
619
empdebuild
Executable file
619
empdebuild
Executable file
|
@ -0,0 +1,619 @@
|
|||
#!/bin/bash
|
||||
set -e
|
||||
# empdebuild : emdebian version of pdebuild.
|
||||
#
|
||||
# Emdebian chroot builder - initially supporting the creation of a
|
||||
# chroot capable of running emdebian-tools to reduce the number of
|
||||
# cross dependencies that need to be installed on the build system.
|
||||
#
|
||||
# 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/>.
|
||||
#
|
||||
# Note 1: Most configuration values are calculated, not taken from the command line
|
||||
# or an rc file.
|
||||
# Note 2: emdebuild creates a build log for us - just the output of dpkg-buildpackage,
|
||||
# not the rest of the chroot operations.
|
||||
|
||||
. /usr/share/emdebian-tools/empbuilderlib
|
||||
|
||||
SUITE=unstable
|
||||
|
||||
function usagehelp () {
|
||||
# print out help message
|
||||
cat <<EOF
|
||||
empdebuild - cross-building chroot Emdebian package builder
|
||||
version $OURVERSION
|
||||
|
||||
Syntax: sudo empdebuild [OPTIONS] [COMMAND]
|
||||
Only one command can be actioned at any one time.
|
||||
Options must precede the command to take effect.
|
||||
|
||||
Commands:
|
||||
-?|-h|--help|-version: print this help message and exit
|
||||
--create|create: create a cross-building base .tgz for unstable
|
||||
--update|update: update the base .tgz and save changes
|
||||
--build|build: build the current package in the chroot
|
||||
(needs to be run in the top source directory)
|
||||
--autobuild|autobuild PACKAGE: build the specified package in the chroot
|
||||
(used by the autobuilder)
|
||||
--login|login: Login to the chroot to run tests or fix problems.
|
||||
--clean|clean: Clean up all build sub directories.
|
||||
|
||||
Options:
|
||||
--arch: Override the default cross-build architecture (from dpkg-cross).
|
||||
--testing: Override the default suite (unstable) to use testing
|
||||
instead. This is a fallback option for use during
|
||||
toolchain transitions in unstable.
|
||||
--save-after-login: Allow changes made within the chroot login to persist.
|
||||
--login-after-fail: In case of error, try to log in to the new chroot.
|
||||
-- OPTIONS dpkg-buildpackage options
|
||||
(except: -uc -us [default] -a [ignored])
|
||||
|
||||
Although based on pbuilder, empdebuild cannot support the full range of
|
||||
pbuilder commands or options. In addition, creating a cross-building chroot for
|
||||
testing involves a variety of changes to the creation of a similar chroot for
|
||||
unstable so testing is only supported as an override, rather than using the
|
||||
pbuilder method of a --distribution option.
|
||||
|
||||
When testing local changes made with emdebuild, use 'empdebuild --build' which
|
||||
will use the .diff.gz from the current working directory.
|
||||
|
||||
Once the local changes are complete and are committed to Emdebian SVN, you
|
||||
can use 'empdebuild --autobuild PACKAGE' to ensure that the patches are
|
||||
usable for the autobuilder.
|
||||
|
||||
Options to dpkg-buildpackage can be specified after the -- option.
|
||||
Note that '-uc' and '-us' are set by default and '-a' will be ignored
|
||||
(because arch is controlled separately). Options are passed down to
|
||||
emdebuild unchanged.
|
||||
|
||||
EOF
|
||||
}
|
||||
|
||||
function get_cross_depends ()
|
||||
{
|
||||
# derived from checkbuilddep_internal
|
||||
# Use this function to fulfill the cross-dependencies
|
||||
DEBIAN_XCONTROL=debian/xcontrol
|
||||
BD_REGEXP="build-depends"
|
||||
|
||||
local INSTALLPKG
|
||||
local INSTALLPKGLIST
|
||||
local INSTALLPKGMULTI
|
||||
local CURRENTREALPKGNAME
|
||||
if [ ! -f ${DEBIAN_XCONTROL} ]; then
|
||||
return
|
||||
fi
|
||||
echo " -> updating apt-cross cache"
|
||||
chroot $BUILDPLACE /usr/bin/apt-cross -a $ARCH -S $SUITE -u
|
||||
echo " -> Attempting to parse the cross-build dependencies"
|
||||
# read debian/xcontrol
|
||||
for INSTALLPKGMULTI in $(cat ${DEBIAN_XCONTROL} | \
|
||||
awk '
|
||||
BEGIN{source=1}
|
||||
/^$/ {source=0}
|
||||
/^Source:/ {source=1}
|
||||
/^[^ ]*:/ {p=0}
|
||||
tolower($0) ~ /^'"${BD_REGEXP}"':/ {p=1}
|
||||
{if(p && source) {print $0}}' | \
|
||||
sed 's/^[^: ]*://' | \
|
||||
tr " " "/" | \
|
||||
awk 'BEGIN{RS=","} {print}'); do
|
||||
echo " -> Considering cross-build-dep$(echo "$INSTALLPKGMULTI" | tr "/" " " )"
|
||||
# parse the list - removing commas etc.
|
||||
for INSTALLPKG in $(echo "$INSTALLPKGMULTI" | \
|
||||
awk 'BEGIN{RS="|"} {print}'); do
|
||||
CURRENTREALPKGNAME=$(echo "$INSTALLPKG" | sed -e 's/^[/]*//' -e 's/[[/(].*//') #)# syntax hack
|
||||
INSTALLPKGLIST="${INSTALLPKGLIST} ${CURRENTREALPKGNAME}"
|
||||
done; # end parse list
|
||||
done; # end parse debian/xcontrol
|
||||
if [ -n "${INSTALLPKGLIST}" ]; then
|
||||
echo " -> Installing ${INSTALLPKGLIST}"
|
||||
chroot $BUILDPLACE /usr/bin/apt-cross -q -k -a $ARCH --install ${INSTALLPKGLIST}
|
||||
save_aptcrosscache
|
||||
fi
|
||||
echo " -> Finished parsing the cross build-deps"
|
||||
}
|
||||
|
||||
function update_emchroot ()
|
||||
{
|
||||
if [ $SUITE == testing ]; then
|
||||
BASETGZ="${WORKDIR}/emdebian-testing.tgz"
|
||||
SUITE=testing
|
||||
echo "Updating the embootstrap testing chroot"
|
||||
else
|
||||
BASETGZ="$WORKDIR/emdebian.tgz"
|
||||
fi
|
||||
extractembuildplace
|
||||
echo "File extracted to: $BUILDPLACE"
|
||||
echo ""
|
||||
echo " -> upgrading packages"
|
||||
disable_apt_recommends
|
||||
# force the sources list - a bit of a hack really.
|
||||
# TODO this should be configurable - emdebian-tools will add a primary later.
|
||||
cp /usr/share/emdebian-tools/emsources.$SUITE $BUILDPLACE/etc/apt/sources.list
|
||||
if echo "/usr/bin/apt-get update" | chroot $BUILDPLACE /bin/sh; then
|
||||
:
|
||||
else
|
||||
# if apt failed (maybe update needs to be run), save so far and exit cleanly
|
||||
save_aptcache
|
||||
# copy out the failed build here first.
|
||||
umountproc
|
||||
cleanbuildplace
|
||||
exit 1;
|
||||
fi
|
||||
echo " -> updating apt-cross cache for $SUITE"
|
||||
if echo "/usr/bin/apt-cross -a $ARCH -S $SUITE -u" | 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
|
||||
recover_aptcache
|
||||
# TODO persistent problems with the toolchains mean this needs to be optional.
|
||||
if echo "DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get $OPTIONS -y --force-yes upgrade" | 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
|
||||
if echo "DEBIAN_FRONTEND=noninteractive /usr/bin/apt-get $OPTIONS -y --force-yes dist-upgrade" | 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
|
||||
chroot $BUILDPLACE /usr/bin/apt-get $OPTIONS -y --force-yes install emdebian-tools || true
|
||||
chroot $BUILDPLACE /usr/bin/apt-get $OPTIONS --purge -y --force-yes autoremove || true
|
||||
autoclean_aptcache
|
||||
save_aptcache
|
||||
echo " -> updating devscripts configuration"
|
||||
if [ -f /home/$SUDO_USER/.devscripts ]; then
|
||||
cp /home/$SUDO_USER/.devscripts $BUILDPLACE/home/$SUDO_USER/.devscripts
|
||||
fi
|
||||
VAL=`chroot $BUILDPLACE hostname -f 2>&1`
|
||||
if [ "$VAL" != "" ]; then
|
||||
echo " -> updating /etc/hosts"
|
||||
cp /etc/hosts $BUILDPLACE/etc/hosts
|
||||
fi
|
||||
# sometimes this returns non-zero
|
||||
if echo "$COLOUR ARCH=$ARCH /usr/bin/emsetup --arch $ARCH --yes" | chroot $BUILDPLACE /bin/sh; then
|
||||
:
|
||||
fi
|
||||
umountproc || true
|
||||
chroot $BUILDPLACE /usr/bin/apt-get clean || true
|
||||
create_emdebiantgz
|
||||
}
|
||||
|
||||
# very similar to emchrootbuild but calls emsource inside the
|
||||
# chroot instead of copying the source in from outside.
|
||||
# i.e. autobuilder mode (so it tries to be quiet).
|
||||
function empautobuild()
|
||||
{
|
||||
if [ $SUITE == testing ]; then
|
||||
BASETGZ="${WORKDIR}/emdebian-testing.tgz"
|
||||
SUITE=testing
|
||||
echo "Building in the embootstrap testing chroot"
|
||||
else
|
||||
BASETGZ="$WORKDIR/emdebian.tgz"
|
||||
fi
|
||||
. /usr/lib/pbuilder/pbuilder-buildpackage-funcs
|
||||
PACKAGE=$1
|
||||
BUILDRESULTUID="${BUILDRESULTUID:-${SUDO_UID:-0}}"
|
||||
BUILDRESULTGID="${BUILDRESULTGID:-${SUDO_GID:-0}}"
|
||||
INITIAL=`echo $PACKAGE | cut -b1`
|
||||
TRUNK="$INITIAL/${PACKAGE}/trunk"
|
||||
|
||||
echobacktime
|
||||
extractembuildplace
|
||||
echo "File extracted to: $BUILDPLACE"
|
||||
echo ""
|
||||
recover_aptcache
|
||||
createbuilduser
|
||||
if [ -f "/etc/devscripts.conf" ]; then
|
||||
cp /etc/devscripts.conf $BUILDPLACE/etc/devscripts.conf
|
||||
fi
|
||||
if [ -f "/home/$SUDO_USER/.devscripts" ]; then
|
||||
mkdir -p $BUILDPLACE/home/$SUDO_USER/
|
||||
cp /home/$SUDO_USER/.devscripts $BUILDPLACE/home/$SUDO_USER/.devscripts
|
||||
fi
|
||||
|
||||
COLOUR=
|
||||
if [ $ANSI_COLORS_DISABLED ]; then
|
||||
COLOUR=ANSI_COLORS_DISABLED=1
|
||||
fi
|
||||
echo "Checking the Emdebian toolchain"
|
||||
# fails with non-zero if no toolchain is found
|
||||
if echo "$COLOUR /usr/bin/emsetup -q --arch $ARCH --report" | chroot $BUILDPLACE /bin/sh; then
|
||||
:
|
||||
else
|
||||
umountproc
|
||||
cleanbuildplace
|
||||
exit 1;
|
||||
fi
|
||||
if echo "$COLOUR ARCH=$ARCH emsource -q -a $ARCH -b --build-dep $PACKAGE $EM_DPKG_OPTS" | chroot $BUILDPLACE /bin/sh; then
|
||||
:
|
||||
else
|
||||
echo " -> emsource -b failed"
|
||||
if [ "${LOGIN_AFTER_FAIL}" = "yes" ]; then
|
||||
echo " -> Logging into the chroot"
|
||||
echobacktime
|
||||
chroot $BUILDPLACE /bin/sh
|
||||
save_aptcache
|
||||
umountproc
|
||||
cleanbuildplace
|
||||
exit 1;
|
||||
fi
|
||||
save_aptcache
|
||||
umountproc
|
||||
cleanbuildplace
|
||||
exit 1;
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
echo " -> emsource -b failed"
|
||||
if [ "${LOGIN_AFTER_FAIL}" = "yes" ]; then
|
||||
echo " -> Logging into the chroot"
|
||||
echobacktime
|
||||
chroot $BUILDPLACE /bin/sh
|
||||
save_aptcache
|
||||
umountproc
|
||||
cleanbuildplace
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
FULLPATH="$BUILDPLACE/trunk/$TRUNK/"
|
||||
FULLPATH=`echo $FULLPATH | tr -s \/`
|
||||
PKGRESULT="${BUILDRESULT}${INITIAL}/${PACKAGE}/trunk"
|
||||
echo "Copying build results to ${PKGRESULT}"
|
||||
mkdir -p "$PKGRESULT"
|
||||
if [ -d "${PKGRESULT}" ]; then
|
||||
chown -R "${BUILDRESULTUID}:${BUILDRESULTGID}" "${BUILDRESULT}/"*
|
||||
cp -p "${FULLPATH}"/* "${PKGRESULT}" 2>/dev/null || true
|
||||
chown -R "${BUILDRESULTUID}:${BUILDRESULTGID}" "${BUILDRESULT}/"*
|
||||
else
|
||||
echo "E: BUILDRESULT=[$BUILDRESULT] is not a directory." >&2
|
||||
fi
|
||||
save_aptcache
|
||||
umountproc
|
||||
cleanbuildplace
|
||||
echobacktime
|
||||
}
|
||||
|
||||
function emchrootbuild()
|
||||
{
|
||||
if [ $SUITE == testing ]; then
|
||||
BASETGZ="${WORKDIR}/emdebian-testing.tgz"
|
||||
SUITE=testing
|
||||
echo "Building in the embootstrap testing chroot"
|
||||
else
|
||||
BASETGZ="$WORKDIR/emdebian.tgz"
|
||||
fi
|
||||
. /usr/lib/pbuilder/pbuilder-buildpackage-funcs
|
||||
|
||||
BUILDRESULTUID="${BUILDRESULTUID:-${SUDO_UID:-0}}"
|
||||
BUILDRESULTGID="${BUILDRESULTGID:-${SUDO_GID:-0}}"
|
||||
|
||||
while ! test -d ./debian -o "$(pwd)" = "$WORKDIR" ; do
|
||||
cd ..;
|
||||
done
|
||||
if test ! -d ./debian; then
|
||||
echo "Cannot find ./debian dir"
|
||||
cleanbuildplace
|
||||
exit 1
|
||||
fi;
|
||||
|
||||
PKG_SOURCENAME=`dpkg-parsechangelog|sed -n 's/^Source: //p'`
|
||||
PKG_VERSION=`dpkg-parsechangelog|sed -n 's/^Version: \(.*:\|\)//p'`
|
||||
HOST_ARCH=`dpkg-architecture -qDEB_HOST_ARCH`
|
||||
|
||||
echo "Building ${PKG_SOURCENAME} ${PKG_VERSION} on ${HOST_ARCH} for $ARCH"
|
||||
INITIAL=`echo $PKG_SOURCENAME | cut -b1`
|
||||
PKG=`basename \$PWD`;
|
||||
TRUNK="$INITIAL/${PKG_SOURCENAME}/trunk"
|
||||
SVN="$TRUNK/${PKG}"
|
||||
if [ "$LOGIN_AFTER_FAIL" == "yes" ]; then
|
||||
echo " -> will attempt to login after build failure"
|
||||
fi
|
||||
echo " -> source location: trunk/$SVN"
|
||||
# get the Debian .dsc
|
||||
DEB_VER=`echo $PKG_VERSION | sed -n 's/em[0-9]*$//p'`
|
||||
if [ "$DEB_VER" == "" ]; then
|
||||
echo "$PKG_VERSION is not an Emdebian version string."
|
||||
cleanbuildplace
|
||||
exit 1;
|
||||
fi
|
||||
DSC="${PKG_SOURCENAME}_${DEB_VER}.dsc"
|
||||
if [ ! -f "../$DSC" ]; then
|
||||
echo "Cannot find ../$DSC"
|
||||
cleanbuildplace
|
||||
exit 1;
|
||||
fi
|
||||
echo " -> using $DSC"
|
||||
|
||||
# don't duplicate the downloads made by emsource
|
||||
DIFFS=`find ../ -name emdebian-*\.patch`
|
||||
DEBDIFFS=`find ../ -maxdepth 1 -name debian-patch*`
|
||||
OLDSRC="$PKG_SOURCENAME.old"
|
||||
echobacktime
|
||||
extractembuildplace
|
||||
echo "File extracted to: $BUILDPLACE"
|
||||
echo ""
|
||||
recover_aptcache
|
||||
createbuilduser
|
||||
|
||||
if [ -f "/etc/devscripts.conf" ]; then
|
||||
cp /etc/devscripts.conf $BUILDPLACE/etc/devscripts.conf
|
||||
fi
|
||||
if [ -f "/home/$SUDO_USER/.devscripts" ]; then
|
||||
mkdir -p $BUILDPLACE/home/$SUDO_USER/
|
||||
cp /home/$SUDO_USER/.devscripts $BUILDPLACE/home/$SUDO_USER/.devscripts
|
||||
fi
|
||||
|
||||
COLOUR=
|
||||
if [ $ANSI_COLORS_DISABLED ]; then
|
||||
COLOUR=ANSI_COLORS_DISABLED=1
|
||||
fi
|
||||
echo "Checking the Emdebian toolchain"
|
||||
# fails with non-zero if no toolchain is found
|
||||
if echo "$COLOUR /usr/bin/emsetup --arch $ARCH --report" | chroot $BUILDPLACE /bin/sh; then
|
||||
:
|
||||
else
|
||||
umountproc
|
||||
cleanbuildplace
|
||||
exit 1;
|
||||
fi
|
||||
echo "Copying Debian source"
|
||||
chroot $BUILDPLACE mkdir -p trunk/$TRUNK
|
||||
copydsc "../$DSC" "$BUILDPLACE/trunk/${TRUNK}/"
|
||||
chroot $BUILDPLACE /usr/bin/dpkg-source -x trunk/${TRUNK}/$DSC trunk/$SVN
|
||||
|
||||
echo "Applying Emdebian changes"
|
||||
for PATCH in $DEBDIFFS
|
||||
do
|
||||
if [ ! -d /trunk/$SVN/debian/patches/ ]; then
|
||||
echo "Creating debian/patches directory"
|
||||
mkdir -p $BUILDPLACE/trunk/$SVN/debian/patches/
|
||||
fi
|
||||
NAME=`echo $PATCH | sed -e 's/..\/debian-patch-//'`
|
||||
echo "Copying $PATCH to /trunk/$SVN/debian/patches/$NAME"
|
||||
cp "$PATCH" "$BUILDPLACE/trunk/$SVN/debian/patches/$NAME"
|
||||
done
|
||||
for PATCH in $DIFFS
|
||||
do
|
||||
cp "$PATCH" "$BUILDPLACE/trunk/$TRUNK"
|
||||
if echo "cd /trunk/$SVN; patch -p1 < $PATCH" | chroot $BUILDPLACE /bin/sh; then
|
||||
:
|
||||
else
|
||||
umountproc
|
||||
cleanbuildplace
|
||||
exit 1;
|
||||
fi
|
||||
done
|
||||
|
||||
# only check for dependencies AFTER debian/control has been patched for Emdebian.
|
||||
echo " -> installing build dependencies for $PKG_SOURCENAME"
|
||||
checkembuilddep
|
||||
# new function to parse and install cross-depends.
|
||||
# read debian/xcontrol, pass Build-Cross-Depends to apt-cross -i
|
||||
get_cross_depends
|
||||
save_aptcache
|
||||
echo " -> copying ../$OLDSRC"
|
||||
cp -r "../$OLDSRC" "$BUILDPLACE/trunk/$TRUNK"
|
||||
echo "Running emdebuild -a $ARCH $EM_DPKG_OPTS "
|
||||
COLOUR=
|
||||
if [ $ANSI_COLORS_DISABLED ]; then
|
||||
COLOUR=ANSI_COLORS_DISABLED=1
|
||||
fi
|
||||
if echo "cd /trunk/$SVN; $COLOUR ARCH=$ARCH emdebuild -a $ARCH $EM_DPKG_OPTS" | chroot $BUILDPLACE /bin/sh; then
|
||||
:
|
||||
else
|
||||
echo " -> emdebuild failed"
|
||||
if [ "${LOGIN_AFTER_FAIL}" = "yes" ]; then
|
||||
echo " -> Logging into the chroot"
|
||||
echo " -> Build directory: /trunk/$SVN"
|
||||
echobacktime
|
||||
chroot $BUILDPLACE /bin/sh
|
||||
save_aptcache
|
||||
umountproc
|
||||
cleanbuildplace
|
||||
exit 1;
|
||||
fi
|
||||
save_aptcache
|
||||
umountproc
|
||||
cleanbuildplace
|
||||
exit 1;
|
||||
fi
|
||||
if [ $? -ne 0 ]; then
|
||||
echo " -> emdebuild failed"
|
||||
if [ "${LOGIN_AFTER_FAIL}" = "yes" ]; then
|
||||
echo " -> Logging into the chroot"
|
||||
echo " -> Build directory: /trunk/$SVN"
|
||||
echobacktime
|
||||
chroot $BUILDPLACE /bin/sh
|
||||
save_aptcache
|
||||
umountproc
|
||||
cleanbuildplace
|
||||
exit 1;
|
||||
fi
|
||||
fi
|
||||
FULLPATH="$BUILDPLACE/trunk/$TRUNK/"
|
||||
FULLPATH=`echo $FULLPATH | tr -s \/`
|
||||
PKGRESULT="${BUILDRESULT}${INITIAL}/${PKG_SOURCENAME}/trunk"
|
||||
echo "Copying build results to ${PKGRESULT}"
|
||||
mkdir -p "$PKGRESULT"
|
||||
if [ -d "${PKGRESULT}" ]; then
|
||||
chown -R "${BUILDRESULTUID}:${BUILDRESULTGID}" "${BUILDRESULT}/"*
|
||||
cp -p "${FULLPATH}"/* "${PKGRESULT}" 2>/dev/null || true
|
||||
chown -R "${BUILDRESULTUID}:${BUILDRESULTGID}" "${BUILDRESULT}/"*
|
||||
else
|
||||
echo "E: BUILDRESULT=[$BUILDRESULT] is not a directory." >&2
|
||||
fi
|
||||
CHANGES=`find $PKGRESULT -name \*${PKG_VERSION}_${ARCH}.changes`
|
||||
echo " -> .changes file : ${CHANGES}"
|
||||
EMDSC=`find $PKGRESULT -name \*${PKG_VERSION}.dsc`
|
||||
echo " -> .dsc file : ${EMDSC}"
|
||||
EMDEBS=`find $PKGRESULT -name \*${PKG_VERSION}*deb | grep -c deb`
|
||||
echo " -> ${EMDEBS} packages built."
|
||||
save_aptcache
|
||||
umountproc
|
||||
cleanbuildplace
|
||||
echobacktime
|
||||
}
|
||||
|
||||
function emlogin()
|
||||
{
|
||||
if [ $SUITE == testing ]; then
|
||||
BASETGZ="${WORKDIR}/emdebian-testing.tgz"
|
||||
echo "Logging into the embootstrap testing chroot"
|
||||
else
|
||||
BASETGZ="$WORKDIR/emdebian.tgz"
|
||||
fi
|
||||
extractembuildplace
|
||||
recover_aptcache
|
||||
echo " -> entering the shell"
|
||||
echo "File extracted to: $BUILDPLACE"
|
||||
# login should be as close to failsafe as possible so do v.little else.
|
||||
chroot $BUILDPLACE /bin/sh || true
|
||||
save_aptcache
|
||||
umountproc
|
||||
# saving the buildplace afterwards
|
||||
if [ "${SAVE_AFTER_LOGIN}" = "yes" ]; then
|
||||
echo " -> Saving the results, modifications to this session will persist"
|
||||
chroot $BUILDPLACE /usr/bin/apt-get clean || true
|
||||
create_emdebiantgz
|
||||
fi
|
||||
cleanbuildplace
|
||||
}
|
||||
|
||||
# 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. :-)
|
||||
ISSUDOSET=`perl -e '$e=\`printenv\`; ($e =~ /SUDO_USER/) ? print "yes" : print "no";'`
|
||||
if [ $ISSUDOSET == "no" ] ; then
|
||||
AREWEROOT=`perl -e '$e=\`printenv\`; ($e =~ /LOGNAME=root/) ? print "yes" : print "no";'`
|
||||
if [ $AREWEROOT == "no" ]; then
|
||||
echo "empdebuild needs to be run under sudo or as root."
|
||||
exit 2
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ ! $1 ];then
|
||||
usagehelp
|
||||
exit;
|
||||
fi
|
||||
|
||||
USEDEVPTS="yes"
|
||||
USEPROC="yes"
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
--help|-h|-?|--version)
|
||||
usagehelp
|
||||
exit;
|
||||
;;
|
||||
-a|--arch)
|
||||
shift
|
||||
ARCH=$1
|
||||
# chomp the argument to --arch
|
||||
shift
|
||||
;;
|
||||
--testing)
|
||||
shift
|
||||
SUITE=testing
|
||||
;;
|
||||
--create|create)
|
||||
shift;
|
||||
checkarch
|
||||
createemchroot
|
||||
exit;
|
||||
;;
|
||||
--update|update)
|
||||
shift;
|
||||
checkarch
|
||||
update_emchroot
|
||||
exit;
|
||||
;;
|
||||
--build|build)
|
||||
shift;
|
||||
checkarch
|
||||
emchrootbuild
|
||||
exit;
|
||||
;;
|
||||
--autobuild|autobuild)
|
||||
shift;
|
||||
PACKAGE=$1
|
||||
shift;
|
||||
checkarch
|
||||
empautobuild $PACKAGE
|
||||
exit;
|
||||
;;
|
||||
--save-after-login)
|
||||
shift
|
||||
SAVE_AFTER_LOGIN="yes"
|
||||
;;
|
||||
--login-after-fail)
|
||||
shift
|
||||
LOGIN_AFTER_FAIL="yes"
|
||||
;;
|
||||
--login|login)
|
||||
shift
|
||||
checkarch
|
||||
emlogin
|
||||
exit;
|
||||
;;
|
||||
--clean|clean)
|
||||
shift
|
||||
echo "Trying to ensure crashed chroots are unmounted"
|
||||
CRASH=`mount | grep "$WORKDIR" | cut -d' ' -f3`
|
||||
if [ "$CRASH" ]; then
|
||||
echo "Trying to ensure crashed chroots are unmounted"
|
||||
mount | grep "$WORKDIR" | cut -d' ' -f3 | xargs umount || true
|
||||
fi
|
||||
echo "Cleaning $BASEBUILDPLACE"
|
||||
clean_subdirectories $BASEBUILDPLACE
|
||||
# if debootstrap fails, we start again so remove the stamp.
|
||||
if [ -f $WORKDIR/stamp-debootstrap ]; then
|
||||
rm $WORKDIR/stamp-debootstrap
|
||||
fi
|
||||
exit;
|
||||
;;
|
||||
--)
|
||||
while [ -n "$1" ]
|
||||
do
|
||||
EM_DPKG_OPTS+="$1 "
|
||||
shift
|
||||
done
|
||||
break
|
||||
;;
|
||||
*)
|
||||
echo "Unrecognised option: $1"
|
||||
echo
|
||||
usagehelp
|
||||
exit;
|
||||
;;
|
||||
esac
|
||||
done
|
658
emrootfslib
Normal file
658
emrootfslib
Normal file
|
@ -0,0 +1,658 @@
|
|||
# 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-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/>.
|
||||
#
|
||||
|
||||
# This shell library requires perl !
|
||||
|
||||
# Intended solely for use on the build machine. Do not use these functions
|
||||
# in second_stage_install !
|
||||
|
||||
OURVERSION=`perl -e 'use Emdebian::Tools; print &tools_version();'`
|
||||
|
||||
get_default_arch ()
|
||||
{
|
||||
ARCH=`perl -e 'use Debian::DpkgCross; \
|
||||
&read_config(); \
|
||||
my $arch = &get_architecture(); \
|
||||
print (qq/None.\n/) if (!$arch); \
|
||||
print $arch;';`
|
||||
}
|
||||
|
||||
get_work_dir ()
|
||||
{
|
||||
WORKDIR=`perl -e 'use Cwd; use Emdebian::Tools; use Config::Auto; use Debian::DpkgCross; \
|
||||
&read_config; \
|
||||
my $w = &get_workdir; \
|
||||
$w = cwd if (! -d $w); \
|
||||
$w =~ s/\/$//; \
|
||||
print $w;';`
|
||||
}
|
||||
|
||||
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_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
Executable file
172
emsandbox
Executable file
|
@ -0,0 +1,172 @@
|
|||
#!/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
|
133
emsecondstage
Executable file
133
emsecondstage
Executable file
|
@ -0,0 +1,133 @@
|
|||
#!/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."
|
12
examples/README
Normal file
12
examples/README
Normal file
|
@ -0,0 +1,12 @@
|
|||
MACHINE:VARIANT README
|
||||
======================
|
||||
|
||||
|
||||
The example files live machine/default so that you can copy
|
||||
the files into the right place in your machine:variant hierarchy.
|
||||
|
||||
$WORK/machine/$machine_name/default/packages.conf
|
||||
$WORK/machine/$machine_name/default/config.sh
|
||||
$WORK/machine/$machine_name/default/setup.sh
|
||||
|
||||
http://www.emdebian.org/emdebian/customisation.html
|
20
examples/config.sh
Executable file
20
examples/config.sh
Executable file
|
@ -0,0 +1,20 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
# This config script provides a method of adjusting the tarball
|
||||
# contents immediately after the second stage install has completed.
|
||||
# The script is copied into the tarball and unpacked to:
|
||||
# $TARGET/machine/config.sh
|
||||
|
||||
# NOTE: At this stage, the ./debootstrap/ directory has already been
|
||||
# removed. Do not rely on the tarball itself being available either.
|
||||
# If any other files or scripts are needed by your additions to this
|
||||
# script, you must ensure that setup.sh includes them into the tarball.
|
||||
|
||||
# It may be easier to create a normal Debian package that can do the
|
||||
# job for you.
|
||||
|
||||
# This example file can act as a skeleton for your own scripts.
|
||||
# Copy into $WORK/machine/$MACHINE/$VARIANT/ and edit.
|
||||
# ($WORK is your emdebian working directory, as set in debconf.)
|
||||
# Use 'default' as the variant directory if no other variants exist.
|
||||
# config.sh does not have to be executable.
|
77
examples/packages.conf
Normal file
77
examples/packages.conf
Normal file
|
@ -0,0 +1,77 @@
|
|||
# This is a standard shell conf file, included directly into embootstrap
|
||||
|
||||
# This example file can act as a skeleton for your own scripts.
|
||||
# Copy into $WORK/machine/$MACHINE/$VARIANT/ and edit.
|
||||
# ($WORK is your emdebian working directory, as set in debconf.)
|
||||
# Use 'default' as the variant directory if no other variants exist.
|
||||
|
||||
# packages.conf is intended to be the principal place for adjusting
|
||||
# the emsandbox tarball to suit the needs of specific machine variants.
|
||||
# setup.sh and config.sh 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 packages.conf will
|
||||
# collate those into a single configuration parameter available to all.
|
||||
# More options and parameters will be added in due course, including
|
||||
# support for additional sources for /etc/apt/sources.list and single
|
||||
# parameter changes to certain files like /etc/inittab.
|
||||
|
||||
# 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.
|
||||
|
||||
# INCLUDE adds 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 PROXY and specify a usable mirror for the device in MIRROR.
|
||||
# DEFAULT: empty
|
||||
INCLUDE=
|
||||
|
||||
# SCRIPT 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.
|
||||
# DEFAULT: /usr/share/emdebian-tools/emdebian.crossd
|
||||
SCRIPT=
|
||||
|
||||
# MIRROR overrides the default emsandbox mirror. This repository will
|
||||
# will be set in /etc/apt/sources.list and will also be used by
|
||||
# debootstrap to obtain all packages for the tarball unless
|
||||
# PROXY is also set.
|
||||
# DEFAULT: http://www.emdebian.org/emdebian/
|
||||
MIRROR=
|
||||
|
||||
# PROXY specifies a separate repository to pass to debootstrap that may
|
||||
# be local or otherwise not intended for use once the tarball is installed
|
||||
# Use MIRROR to set the same value in debootstrap and /etc/apt/sources.list
|
||||
# If PROXY is specified without MIRROR, the default emsandbox MIRROR will
|
||||
# be written into /etc/apt/sources.list
|
||||
# DEFAULT: empty
|
||||
PROXY=
|
||||
|
||||
# It is often useful to include a kernel image and/or modules or extra
|
||||
# files but these may be in generated or variable paths - e.g. including
|
||||
# a version string or in another part of the filesystem. To include these
|
||||
# files in the emsandbox tarball, write out a list of paths into a file in
|
||||
# $WORK/machine/$MACHINE/$VARIANT and read the contents into the
|
||||
# setup.sh script. The files copied or unpacked into the $BUILDPLACE
|
||||
# will then be included into the tarball.
|
||||
|
||||
# If there are extra files with absolute paths that do not change
|
||||
# between releases, specify them in EXTRA. Absolute paths only -
|
||||
# wildcards supported by 'cp' are allowed. Files are copied into
|
||||
# $BUILDPLACE unchanged to be processed by setup.sh (if it exists).
|
||||
EXTRA=
|
||||
|
||||
# TARBALL_NAME overrides the default name (emdebian-$ARCH) of the tarball
|
||||
# Do not specify a path here, just a filename with the .tgz suffix
|
||||
# DEFAULT: emdebian-$ARCH.tgz where $ARCH is specified to emsandbox or
|
||||
# as the dpkg-cross default architecture.
|
||||
TARBALL_NAME=
|
||||
|
||||
# SUITE is not recommended to be changed.
|
||||
# DEFAULT: unstable
|
||||
SUITE=
|
29
examples/setup.sh
Executable file
29
examples/setup.sh
Executable file
|
@ -0,0 +1,29 @@
|
|||
#!/bin/sh -e
|
||||
|
||||
# This setup script is an alternative method of adjusting the tarball
|
||||
# contents immediately after the first stage install has completed.
|
||||
# It may be easier to create a normal Debian package that can do the
|
||||
# job for you. (Remember to use the postinst if you want to append
|
||||
# to existing files instead of replacing the emsandbox versions.
|
||||
|
||||
# The script is called by embootstrap with the following arguments:
|
||||
|
||||
# $1 = $BUILDPLACE - the top directory of the debootstrapped system
|
||||
# $2 = $ARCH - the specified architecture, already checked with dpkg-architecture.
|
||||
|
||||
# This example file can act as a skeleton for your own scripts.
|
||||
# Copy into $WORK/machine/$MACHINE/$VARIANT/ and edit.
|
||||
# ($WORK is your emdebian working directory, as set in debconf.)
|
||||
# Use 'default' as the variant directory if no other variants exist.
|
||||
# setup.sh does not have to be executable.
|
||||
|
||||
# Use any other scripts or files that you need for first stage install.
|
||||
# To use any of those scripts or files in the second stage, ensure
|
||||
# that this script copies the relevant files into the tarball at
|
||||
# /machine/$MACHINE/$VARIANT/
|
||||
|
||||
# e.g. To pass the location of a kernel or other files to be added to the
|
||||
# tarball, write out a file into $WORK/machine/$MACHINE/$VARIANT and
|
||||
# read the contents into this script.
|
||||
|
||||
# Nothing to do by default.
|
|
@ -5,6 +5,6 @@ use warnings;
|
|||
|
||||
# Eventually, this will replace the em_ one or call em_ with
|
||||
# --arch and take over native duties.
|
||||
#debug
|
||||
|
||||
my $str = join(" ", @ARGV);
|
||||
system ("sudo /opt/working/emdebian/svn/current/em_multistrap $str");
|
||||
system ("/usr/sbin/em_multistrap $str");
|
||||
|
|
68
update-rc.d
Executable file
68
update-rc.d
Executable file
|
@ -0,0 +1,68 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# Copyright 2008 Hands.com Ltd <phil@hands.com>
|
||||
# Copyright 2008 Neil Williams <codehelp@debian.org>
|
||||
#
|
||||
# This program 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.
|
||||
|
||||
initd="/etc/init.d"
|
||||
etcd="/etc/rc.d"
|
||||
bn=$1;shift
|
||||
if [ "$bn" = '-f' ]; then
|
||||
bn=$1
|
||||
shift
|
||||
fi
|
||||
|
||||
defaults () {
|
||||
makelinks "S${1:-20}"
|
||||
makelinks "K${2:-${1:-20}}"
|
||||
}
|
||||
|
||||
makelinks () {
|
||||
echo " Adding symlink for $initd/$bn ...";
|
||||
echo "${etcd}/${1}${bn} -> ../init.d/$bn"
|
||||
ln -s "../init.d/$bn" "${etcd}/${1}${bn}"
|
||||
}
|
||||
|
||||
if [ -z "$bn" -o -z "$1" ]; then
|
||||
echo "Insufficient arguments"
|
||||
exit 1
|
||||
fi
|
||||
if [ ! -f "$initd/$bn" ]; then
|
||||
echo "update-rc.d: $initd/$bn: file does not exist\n"
|
||||
exit 1
|
||||
fi
|
||||
if [ "$1" = 'remove' ]; then
|
||||
shift
|
||||
echo "rm -f /etc/rc.d/*${bn}"
|
||||
rm -f "/etc/rc.d/*${bn}"
|
||||
exit;
|
||||
elif [ "$1" = 'defaults' ]; then
|
||||
makelinks "S${2:-20}"
|
||||
makelinks "K${3:-${2:-20}}"
|
||||
exit 0;
|
||||
else
|
||||
if [ "$1" = 'start' ]
|
||||
then
|
||||
shift
|
||||
num=$1
|
||||
# use two digit prefixes
|
||||
if [ $num -lt 10 ]; then
|
||||
num="0${num}"
|
||||
fi
|
||||
makelinks "S${num}"
|
||||
while [ "$1" != "." ]
|
||||
do
|
||||
shift
|
||||
done
|
||||
shift
|
||||
if [ "$1" = 'stop' ]; then
|
||||
shift
|
||||
makelinks "K${1}"
|
||||
fi
|
||||
fi
|
||||
exit 0;
|
||||
fi
|
Loading…
Reference in a new issue