diff --git a/debian/changelog b/debian/changelog index 77da007..17b809f 100644 --- a/debian/changelog +++ b/debian/changelog @@ -1,8 +1,9 @@ -emdebian-rootfs (2.1.0) experimental; urgency=low +multistrap (2.1.0) experimental; urgency=low * Experimental branch to replace pbuilder support in Crush. + * Drop emsandbox and use experimental multistrap. - -- Neil Williams Mon, 05 Apr 2010 20:41:47 +0100 + -- Neil Williams Mon, 05 Apr 2010 20:46:43 +0100 emdebian-rootfs (2.0.9) unstable; urgency=low diff --git a/debian/control b/debian/control index b2e45b2..7f4e8e1 100644 --- a/debian/control +++ b/debian/control @@ -1,41 +1,23 @@ -Source: emdebian-rootfs +Source: multistrap Section: utils -Priority: extra +Priority: optional Maintainer: Neil Williams Uploaders: Wookey Build-Depends: cdbs, debhelper (>= 5), po4a (>= 0.37.1), po-debconf -Build-Depends-Indep: devscripts, docbook-xml, docbook-xsl, gnupg, - libxml2-utils, xml-core, xsltproc, intltool +Build-Depends-Indep: devscripts, gnupg, intltool Standards-Version: 3.8.4 Homepage: http://www.emdebian.org/ Vcs-Browser: http://buildd.emdebian.org/svn/browser/current/host/trunk/emdebian-rootfs/trunk/ Vcs-Svn: http://buildd.emdebian.org/repos/current/host/trunk/emdebian-rootfs/trunk/ -Package: emdebian-rootfs -Architecture: all -Depends: ${perl:Depends}, ${misc:Depends}, apt, apt-cross (>= 0.5.0), - binutils-multiarch, debootstrap (>= 1.0.4), dpkg-cross (>= 2.1.0), - devscripts, emdebian-archive-keyring, multistrap, pbuilder, sudo, ucf, - libparse-debian-packages-perl -Replaces: emdebian-tools (<= 1.4.3) -Recommends: gcc -Suggests: deb-gview, debian-xcontrol, screen | minicom -Description: emdebian root filesystem support - Scripts for preparing root filesystems of Emdebian for specific - machines and variants. - . - Root filesystem tarballs created with emsandbox need minimal - configuration on the embedded device before the first boot. - . - Supports customisation of package selection and of files created - within the root filesystem. - Package: multistrap Section: admin Architecture: all Depends: ${perl:Depends}, ${misc:Depends}, apt, realpath, libconfig-auto-perl, libparse-debian-packages-perl -Replaces: emdebian-rootfs (<= 1.6.0) +Replaces: emdebian-rootfs (<= 2.0.9) +Conflicts: emdebian-rootfs (<= 2.0.9) +Provides: emdebian-rootfs Description: multiple repository bootstrap based on apt A debootstrap replacement with multiple repository support, using apt to handle all dependency issues and conflicts. @@ -49,3 +31,12 @@ Description: multiple repository bootstrap based on apt . Unlike debootstrap, multistrap relies on working versions of dpkg and apt outside the final filesystem. + . + Multistrap supercedes emdebian-rootfs and includes support + for preparing root filesystems for specific machines and variants. + Also included is the previous emdebian-rootfs support for + customisation of package selection and of files created + within the root filesystem. + . + Root filesystems created with multistrap need minimal + configuration on the embedded device before the first boot. diff --git a/debian/emdebian-rootfs.install b/debian/emdebian-rootfs.install deleted file mode 100644 index 5409ffe..0000000 --- a/debian/emdebian-rootfs.install +++ /dev/null @@ -1,17 +0,0 @@ -emsandbox ./usr/sbin -embootstrap ./usr/share/emdebian-tools/ -empbuilderlib ./usr/share/emdebian-tools/ -emsecondstage ./usr/share/emdebian-tools/ -update-rc.d ./usr/share/emdebian-tools/ -emrootfslib ./usr/share/emdebian-tools/ -emdebian.crossd ./usr/share/emdebian-tools/ -emdebian.gtk ./usr/share/emdebian-tools/ -emdebian.grip ./usr/share/emdebian-tools/ -emdebian.gpe ./usr/share/emdebian-tools/ -emdebian.coreutils ./usr/share/emdebian-tools/ -doc/emdebian-rootfs/man/* ./usr/share/man/ -examples/packages.conf ./usr/share/doc/emdebian-rootfs/examples/ -examples/setup.sh ./usr/share/doc/emdebian-rootfs/examples/ -examples/config.sh ./usr/share/doc/emdebian-rootfs/examples/ -examples/README ./usr/share/doc/emdebian-rootfs/examples/ -emdebian-rootfs ./etc/bash_completion.d/ diff --git a/debian/emdebian-rootfs.lintian-overrides b/debian/emdebian-rootfs.lintian-overrides deleted file mode 100644 index e8e2c5c..0000000 --- a/debian/emdebian-rootfs.lintian-overrides +++ /dev/null @@ -1,3 +0,0 @@ -# See 555330 - bug in the lintian test. -emdebian-rootfs: manpage-has-errors-from-man * - diff --git a/debian/emdebian-rootfs.postinst b/debian/emdebian-rootfs.postinst deleted file mode 100755 index 1326adf..0000000 --- a/debian/emdebian-rootfs.postinst +++ /dev/null @@ -1,35 +0,0 @@ -#! /bin/sh -# clear out the now unsupported emsandbox conf file. - -set -e - -case "$1" in - configure) - if [ -f '/etc/emsandbox.conf' ]; then - # Remove the configuration files - if [ -e /usr/bin/ucf ]; then - ucfr --purge emdebian-rootfs /etc/emsandbox.conf - ucf --purge /etc/emsandbox.conf - fi - rm /etc/emsandbox.conf - rm -f /etc/emsandbox.conf.ucf-old - rm -f /etc/emsandbox.conf.ucf-new - rm -f /etc/emsandbox.conf.ucf-dist - fi - ;; - - remove|upgrade|failed-upgrade|abort-install|abort-upgrade|disappear) - ;; - - *) - echo "postinst called with unknown argument \`$1'" >&2 - exit 1 - ;; -esac - -# dh_installdeb will replace this with shell code automatically -# generated by other debhelper scripts. - -#DEBHELPER# - -exit 0 diff --git a/debian/multistrap.install b/debian/multistrap.install index c5ed587..18412af 100644 --- a/debian/multistrap.install +++ b/debian/multistrap.install @@ -1,9 +1,11 @@ -em_multistrap ./usr/sbin/ multistrap ./usr/sbin/ doc/multistrap/man/* ./usr/share/man/ examples/multistrap-example.conf ./usr/share/doc/multistrap/examples/ examples/sid.conf ./usr/share/multistrap/ examples/squeeze.conf ./usr/share/multistrap/ examples/lenny.conf ./usr/share/multistrap/ +examples/setup.sh ./usr/share/doc/multistrap/examples/ +examples/config.sh ./usr/share/doc/multistrap/examples/ +update-rc.d ./usr/share/multistrap/ check-deps.sh ./usr/share/multistrap/ bash/multistrap ./etc/bash_completion.d/ diff --git a/debian/multistrap.links b/debian/multistrap.links deleted file mode 100644 index 3880fc5..0000000 --- a/debian/multistrap.links +++ /dev/null @@ -1,3 +0,0 @@ -/usr/share/man/pt/man1/em_multistrap.1 /usr/share/man/pt/man1/multistrap.1 -/usr/share/man/fr/man1/em_multistrap.1 /usr/share/man/fr/man1/multistrap.1 -/usr/share/man/man1/em_multistrap.1 /usr/share/man/man1/multistrap.1 diff --git a/doc/xml/emdebian-rootfs.1.xml b/doc/xml/emdebian-rootfs.1.xml deleted file mode 100644 index eb01478..0000000 --- a/doc/xml/emdebian-rootfs.1.xml +++ /dev/null @@ -1,146 +0,0 @@ - - - - -]> - - - emdebian-rootfs - Sun 11 Jan 2009 19:55:45 GMT - Release: 1.8.0 - Emdebian - - Neil - Williams - - Debian and Emdebian developer. - - - - The GNU GENERAL PUBLIC LICENSE Version 3, 29 June 2007 - This documentation is part of emdebian-tools. - 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. - 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/. - - - In Debian you can find a copy of the GNU General - Public Licence in /usr/share/common-licenses/GPL-3 - - - - - Emdebian Tools Reference - - Purpose - This documentation consists primarily of the manpages for emdebian-tools - 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 - Emdebian website and - Emdebian Wiki. - - - Some scripts embed the manpage content in the perl script as pod content. These manpages - are listed separately in the HTML versions. - - - Emdebian Tools manpages - &emsandbox; - &empbuilderlib; - &emrootfslib; - - - Other manpages and external links - 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: - - - Debian::Packages::Compare - Debian::Packages::Compare - manpage. - - - dh_gentdeb - dh_gentdeb manpage. - - - dpkg-gentdeb - dpkg-gentdeb manpage. - - - emtargetcmp - emtargetcmp manpage - - - emprunecross - emprunecross manpage - - - Emdebian::Tools - Emdebian::Tools function - reference. - - - - em_installtdeb - em_installtdeb manpage - - - emrecent - emrecent manpage - - - emgrip - emgrip manpage - - - em_autogrip - em_autogrip manpage - - - emdebcheck - emdebcheck manpage - - - emcache - emcache manpage - - - emdepends - emdepends manpage - - - splitout_tdeb - dplitout_tdeb manpage. - - - WWW references - - - - Emdebian.org website - - - - - Emdebian dependency maps - - - - - Emdebian presentation - - - - - - diff --git a/doc/xml/empbuilderlib.3.xml b/doc/xml/empbuilderlib.3.xml deleted file mode 100644 index 69c5745..0000000 --- a/doc/xml/empbuilderlib.3.xml +++ /dev/null @@ -1,77 +0,0 @@ - - - - empbuilderlib - - - - empbuilderlib - 3 - EMDEBIAN-ROOTFS - EMDEBIAN-ROOTFS - - - empbuilderlib - Common functions for Emdebian chroots - - - DESCRIPTION - empbuilderlib is intended solely for use on - the build machine. Do not use these functions in second_stage_install ! - empbuilderlib requires perl! - - empbuilderlib is a shell library which - requires perl and pbuilder (which means bash!). - empbuilderlib 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: - - - The functions are only useful to create cross-building chroots OR - - - the functions need to call pbuilder code directly and are not - necessary within first_stage_install. - - - - There should be no need to call pbuilder code within scripts that - generate a root filesystem. - - - autoclean_aptcache - Same as the pbuilder option but run by default in empdebuild - to remove obsolete .deb archives from the apt cache directories used by - empdebuild. - - - - copy_host_configuration - Copy hosts, hostname and resolv.conf from the system /etc/ - directory and adapts /etc/hostname to use a different - name (emdebian-$ARCH). - - - - extractembuildplace - Modified version of the equivalent function in pbuilder-modules - to extract the compressed chroot (used by empdebuild). - - - Author - empbuilderlib was written - by Neil Williams codehelp@debian.org. - - This manual page was written by Neil Williams - codehelp@debian.org - - - - SEE ALSO - See also apt-cross (1), - dpkg-cross (1), emdebian-tools (1), - emrootfslib (3). - - - diff --git a/doc/xml/emrootfslib.3.xml b/doc/xml/emrootfslib.3.xml deleted file mode 100644 index 8816718..0000000 --- a/doc/xml/emrootfslib.3.xml +++ /dev/null @@ -1,214 +0,0 @@ - - - - emrootfslib - - - - emrootfslib - 3 - EMDEBIAN-ROOTFS - EMDEBIAN-ROOTFS - - - emrootfslib - Common functions for Emdebian root filesystems - - - DESCRIPTION - emrootfslib is intended solely for use on - the build machine. Do not use these functions in second_stage_install ! - emrootfslib requires perl! - - There should be no need to call pbuilder code within scripts that - generate a root filesystem and bash code must not be used in - emrootfslib. - - - basic_etc_fstab - Removing packages from the normal Debian debootstrap set can - mean that certain critical files can be omitted. basic_etc_fstab - creates a basic version of $TARGET/etc/fstab where it does not - already exist. - - - - basic_group_setup - Removing packages from the normal Debian debootstrap set can - mean that certain critical files can be omitted. basic_group_setup - creates a basic version of $TARGET/etc/group where it does not - already exist. - - - - basic_passwd_setup - Removing packages from the normal Debian debootstrap set can - mean that certain critical files can be omitted. basic_passwd_setup - creates a basic version of $TARGET/etc/passwd where it does not - already exist. - - - - busybox_inittab - Note: this function overwrites an existing $TARGET/etc/inittab - - busybox does not support runlevels and so the /etc/inittab - file needs to be modified to support busybox. Currently, this function - overwrites an existing $TARGET/etc/inittab - this is likely to change - in future versions. - - - - busybox_rcS - Note: this function overwrites an existing $TARGET/etc/init.d/rcS - - busybox does not support runlevels and so the /etc/init.d/rcS - script needs to be modified to support busybox. Currently, this function - overwrites an existing $TARGET/etc/init.d/rcS - this is likely to change - in future versions. - - - - check_dirs - Check that the $BUILDPLACE, $BUILDRESULT and $APTCACHE directories - exist (used by empdebuild). - - - checkarch - Calls check_arch from Debian::DpkgCross using perl. - The perl call dies if the specified string does not match a - supported architecture. - - - create_emdebiantgz - Modified version of the equivalent function in pbuilder-modules - to extract the compressed chroot (used by empdebuild). - - - disable_apt_recommends - Enforces a default of not installing recommended packages inside the - chroot. - - - - extra_etc_rcd - Removing packages from the normal Debian debootstrap set can - mean that certain critical files can be omitted. extra_etc_rcd - creates a basic version of $TARGET/etc/rcS.d where it does not - already exist. - - - - make_dpkg_dirs - Prepare for unpacking and general dpkg work by setting up - $TARGET/var/lib/dpkg/status and $TARGET/var/lib/dpkg/available. - - - - prepare_proc - Ensure that $TARGET/proc and $TARGET/sys exist so that - proc and sys can be mounted automatically. - - - - prepare_var - Ensure that $TARGET/var/log/ and $TARGET/var/spool exist so - that various installation routines can proceed. - - - - set_approx_time - Normal Debian installations have a network connection and - typical Debian desktop boxes also have a backup battery. Some - embedded machines do not have either of these systems, making - it impossible to store or retrieve even a vaguely close indication - of the current time. - - set_approx_time uses the systems available on the build - machine to store an approximate indication of the time that the - root filesystem was created and write that time to a file in the - root filesystem itself. For most purposes, this is sufficient for - the purposes of setting up the root filesystem to the point where - a network connection can be created and a call can be made to an - internet clock using ntpdate-debian. - - - - set_cdebconf_default - Adds "export DEBCONF_USE_CDEBCONF=true" to - $TARGET/etc/profile for cdebconf support. - - - - symlink_rcS - Call repeatedly to create init symlinks, using the template - $TARGET/etc/rcS.d/S$number$file - - - - - - - - file is the filename in $TARGET/etc/init.d/ - - - - - - - - - number is the number for the link in the init sequence. - - - - - - - unpack_debootstrap - Specialized routine that replaces the normal second stage of - debootstrap (you may consider it a series of hacks if you prefer). - unpack uses dpkg to extract the files from the .deb package and - process the control information. Unlike dpkg - , the unpack routine does - NOT run any maintainer scripts which - would inevitably fail in a cross built environment. - Instead, it updates the relevant dpkg status and database files - in the root filesystem and leaves the package in the unpacked state. - - unpack_debootstrap also sets up the busybox applets - future - versions may split this functionality into a separate function. - - unpack_debootstrap also performs checks on /usr/sbin/invoke-rc.d - and /usr/sbin/update-rc.d - future versions may split this functionality - into a separate function. - - Finally, unpack_debootstrap removes all .deb package files - from /var/cache/apt/archives. The remaining task (dpkg --configure -a) - is performed via emsecondstage. - - - x_feign_install - Copied from debootstrap suite scripts to make a basic - installation of a .deb package - although this is the basis of - unpack_debootstrap, it is only really used for dpkg itself. - - - - Author - empbuilderlib was written - by Neil Williams codehelp@debian.org. - - This manual page was written by Neil Williams - codehelp@debian.org - - - - SEE ALSO - See also apt-cross (1), - dpkg-cross (1), emdebian-tools (1), - empdebuilderlib (3). - - - diff --git a/doc/xml/emsandbox.1.xml b/doc/xml/emsandbox.1.xml deleted file mode 100644 index 6414850..0000000 --- a/doc/xml/emsandbox.1.xml +++ /dev/null @@ -1,452 +0,0 @@ - - - - emsandbox - - - - emsandbox - 1 - EMDEBIAN-TOOLS - EMDEBIAN-TOOLS - - - emsandbox - create Emdebian root filesystems - - - - emsandbox - - -a - --arch - ARCHITECTURE - - - --create - create - - - - -s - --script - - FILENAME - - - -S - --suite - NAME - - - --machine-path - PATH - - - -m - --machine - NAME - - -v - --variant - NAME - - - - - - SHELL INTERPRETERS - emsandbox is bash code and uses - embootstrap which is bash code and also sources - pbuilder code which is also bash code. debootstrap - 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. - - This problem can show up as a failure within debootstrap - - -I: Retrieving zlib1g -I: Validating zlib1g - - The next line should be: - -I: Extracting base-passwd... - - 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 - embootstrap could migrate to cdebootstrap currently. - - The only current solution is to change your default shell to - /bin/bash inside the environment running emsandbox. - - - - DESCRIPTION - emsandbox supports customised generation of - basic root filesystems from cross-built Emdebian packages, ready for - unpacking and configuring on an embedded device. - - Note that emsandbox does not support all the - options available to debootstrap. Some of the - debootstrap options that are supported are implemented as machine - specific configuration files in your Emdebian work directory. - (See and .) - - emsandbox 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. - - The Emdebian rootfs, as generated by emsandbox - 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 - must be run on the actual device - before the first boot, using the emsecondstage - script which requires a working chroot environment. - Typically, emsecondstage 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. - - The tarball created by emsandbox should be - copied onto the target device and unpacked using: - - -# cd /mnt/target/dir -# tar -xzpf emdebian-arm.tgz - - Immediately after unpacking, start the package configuration - by running ./emsecondstage 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.) - - emsecondstage should always - be run from the directory into which it was installed. - - -# ./emsecondstage - - - - COMMANDS - - - | - - Runs debootstrap - with a modified suite rule set to create a basic Emdebian rootfs. - - Checks for an existing chroot and exits if one is found. - - - - - | - - print the usage message and exit. - - - - - - - - print the usage message and exit. - - - - - - OPTIONS - - - | ARCHITECTURE - - Override the dpkg-cross default architecture - for this operation on the chroot. - - - - - | FILENAME - - 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). - - 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. - - Customised scripts packages with emdebian-tools - include scripts for a root filesystem including libgtk2.0-0 and a complete - GPE root filesystem. - - - - - - PATH - - - Override the default path to machine and variant configuration. By - default, emsandbox uses ${WORK}/machine where - $WORK is the working directory specified - to emdebian-tools in the debconf configuration. - The specified path must already exist and contain the relevant - packages.conf configuration as well as the - setup.sh and config.sh shell - scripts (which may be empty). - - Examples of packages.conf, - setup.sh and config.sh are - in /usr/share/doc/emdebian-rootfs/examples/ - - - - - | MACHINE - - Load machine specific configuration data from your Emdebian - working directory. If no variant is specified, config is read from - $WORK/machine/$MACHINE/default/ where $WORK - is the work directory specified in debconf for emdebian-tools. - - - - - | VARIANT - - Load variant specific configuration data from your Emdebian - working directory. Requires . Configuration - data is read from $WORK/machine/$MACHINE/$VARIANT/ where $WORK - is the work directory specified in debconf for emdebian-tools. - - - - - | NAME - - Override the default suite [unstable] and specify another - supported suite. Note that if the Emdebian repository is used, - the suite chosen must 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. - - The selected suite is set in the root filesystem as the - default suite for apt to use when looking for updates. - - - - - - - Machine variants - emsandbox 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 - machine subdirectory of your Emdebian work directory. - Using the option to emsandbox loads - packages.conf from the $WORK/machine/$MACHINE/default - subdirectory prior to starting debootstrap. Once the first stage install is complete, - emsandbox calls setup.sh 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, config.sh - is copied into the /machine/$MACHINE/default/ directory - of the rootfs, ready to be called when emsecondstage has - completed the second stage of the debootstrap process. - - Skeleton versions of packages.conf, - setup.sh and config.sh are available - in /usr/share/emdebian-tools/machine/. - - 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. - - packages.conf supports: - - - - - - - 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 and specify a usable - mirror for the device in . - DEFAULT: empty - - - - - - - - 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 - - - - - - - - Overrides the default emsandbox mirror. This repository will be set in - /etc/apt/sources.list and will also be used by debootstrap to obtain - all packages for the tarball unless is also set. - - DEFAULT: http://www.emdebian.org/crush/ - - - - - - - - Specifies a separate repository to pass to debootstrap that may be local or - otherwise not intended for use once the tarball is installed. Use - to set the same value in debootstrap and /etc/apt/sources.list. - If is specified without , the default - emsandbox MIRROR (http://buildd.emdebian.org/emdebian/) will be written into - /etc/apt/sources.list. - DEFAULT: empty - - - - - - - - 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. - - - - - - - - - Override the default suite [unstable] and specify another - supported suite. Note that if the Emdebian repository is used, - the suite chosen must 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. - - The selected suite is set in the root filesystem as the - default suite for apt to use when looking for updates. - - Not recommended to be changed. - - DEFAULT: unstable - - - - - 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. - - - Automating rootfs builds - Providing you are trying to build a root filesystem for an - architecture supported within Debian, emdebian-tools - can help you automate the package builds. - See em_autobuild (1) - - - SHELL variables - 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 /etc/passwd - is bash which is not present in the Emdebian rootfs so chroot - needs the option. - - - FILES - Most emdebian-tools use configuration data from - apt-cross and dpkg-cross. - emsource and emsandbox also support - configuration using debconf 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 ~/.apt-cross/emsource or - ~/.apt-cross/emsandbox respectively. - - - /etc/emsandbox.conf - System-wide configuration file handled by debconf - controlling unpacking source archives to a default working - directory. Can also include a subversion username setting, intended for - single-user installations. /etc/emsandbox.conf - settings can be overridden on a per-user basis by copying the current - file to ~/.apt-cross/emsandbox and editing the - values. - Two variables can be set (see also /etc/emsandbox.conf): - - - - workingdir: A simple default - location for emsandbox 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. - - - - targetsuite: 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. - - - - - - ~/.apt-cross/emsandbox - User-specific version of /etc/emsandbox.conf, - supporting the same variables to provide user-specific overrides. - - - - - Author - emsandbox was written - by Neil Williams codehelp@debian.org. - - This manual page was written by Neil Williams - codehelp@debian.org - - - - SEE ALSO - See also apt-cross (1), em_make (1), - dpkg-cross (1), emdebian-tools (1). - - - diff --git a/em_multistrap b/em_multistrap deleted file mode 100755 index 731c081..0000000 --- a/em_multistrap +++ /dev/null @@ -1,1019 +0,0 @@ -#!/usr/bin/perl - -# Copyright (C) 2009, 2010 Neil Williams -# -# 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 . - -use strict; -use warnings; -use IO::File; -use Config::Auto; -use File::Basename; -use Parse::Debian::Packages; -use POSIX qw(locale_h); -use Locale::gettext; - -use vars qw/ $progname $ourversion $dstrap $extra @aptsources $mirror - @archives $deb $cachedir $config_str %packages $retval $str $retries - $dir $include $arch $foreign $suite $url $unpack $sourcedir $msg $etcdir - @e $sourcesname $libdir $dpkgdir @debootstrap %suites %components - $component $repo @dirs @touch %sources $section %keys $host $key $value - $type $file $config $tidy $noauth $keyring %keyrings $deflist @extrapkgs /; - -setlocale(LC_MESSAGES, ""); -textdomain("multistrap"); -$progname = basename($0); -$ourversion = &our_version(); -$unpack = "true"; - -while( @ARGV ) { - $_= shift( @ARGV ); - last if m/^--$/; - if (!/^-/) { - unshift(@ARGV,$_); - last; - } - elsif (/^(-\?|-h|--help|--version)$/) { - &usageversion(); - exit( 0 ); - } - elsif (/^(-f|--file)$/) { - $file = shift(@ARGV); - } - elsif (/^(-a|--arch)$/) { - $arch = shift(@ARGV); - } - elsif (/^(-d|--dir)$/) { - $dir = shift(@ARGV); - $dir .= ($dir =~ m:/$:) ? '' : "/"; - } - elsif (/^(--tidy-up)$/) { - $tidy++; - } - elsif (/^(--source-dir)$/) { - $sourcedir = shift (@ARGV); - $sourcedir .= ($sourcedir =~ m:/$:) ? '' : "/"; - $sourcedir = (-d $sourcedir) ? $sourcedir : undef; - } - elsif (/^(--no-auth)$/) { - $noauth++; - } - else { - die "$progname: "._g("Unknown option")." $_.\n"; - } -} -$msg = sprintf (_g("Need a configuration file - use %s -f\n"), $progname); -die ($msg) - if (not defined $file); -$config = Config::Auto::parse("$file"); -%keys=(); -foreach $key (%$config) -{ - $type = lc($key) if (ref $key ne "HASH"); - $value = $key if (ref $key eq "HASH"); - $keys{$type} = $value; -} -%sources=(); -%packages=(); -%suites=(); -%components=(); -%keyrings=(); -@aptsources=(); -foreach $section (sort keys %keys) -{ - if ($section eq "general") - { - $arch = $keys{$section}{'arch'} if (not defined $arch); - $dir = $keys{$section}{'directory'} if (not defined $dir); - # support the original value but replace by new value. - $unpack = lc($keys{$section}{'unpack'}) - if (defined $keys{$section}{'forceunpack'}); - $unpack = lc($keys{$section}{'unpack'}) - if (defined $keys{$section}{'unpack'}); - $tidy++ if ((defined $keys{$section}{'cleanup'}) and - ($keys{$section}{'cleanup'} eq "true")); - $noauth++ if ((defined $keys{$section}{'noauth'}) and - ($keys{$section}{'noauth'} eq "true")); - $sourcedir = $keys{$section}{'retainsources'} if - ((defined $keys{$section}{'retainsources'}) and - (-d $keys{$section}{'retainsources'})); - @debootstrap = split(' ', lc($keys{$section}{'debootstrap'})); - @aptsources = split (' ', lc($keys{$section}{'aptsources'})); - } - else - { - $sources{$section}=$keys{$section}{'source'}; - $packages{$section}=$keys{$section}{'packages'}; - $suites{$section}=$keys{$section}{'suite'}; - $components{$section}=$keys{$section}{'components'}; - if (not defined $components{$section}) - { - $components{$section}='main'; - } - $keyrings{$section}=$keys{$section}{'keyring'}; - push @extrapkgs, split (' ', lc($keys{$section}{'additional'})); - } -} -# Translators: fields are: programname, versionstring, configfile. -printf (_g("%s %s using %s\n"), $progname, $ourversion, $file); -$host = `dpkg-architecture -qDEB_BUILD_ARCH`; -chomp ($host); -if (not defined $arch) -{ - $arch = $host; - printf (_g("Defaulting architecture to native: %s\n"),$arch); -} -elsif ($arch eq $host) -{ - printf (_g("Defaulting architecture to native: %s\n"),$arch); -} -else -{ - printf (_g("Using foreign architecture: %s\n"), $arch); -} -$foreign++ if ($host ne $arch); - -unless (keys %sources and @aptsources) -{ - my $msg = sprintf(_g("No sources defined for a foreign multistrap. - Using your existing apt sources. To use different sources, - list them with aptsources= in '%s'."), $file); - warn ("$progname: $msg\n"); - $deflist = prepare_sources_list(); -} - -# Translators: fields are: programname, architecture, host architecture. -printf (_g("%s building %s multistrap on '%s'\n"), $progname, $arch, $host); -$cachedir = "var/cache/apt/"; # archives -$libdir = "var/lib/apt/"; # lists -$etcdir = "etc/apt/"; # sources -$dpkgdir = "var/lib/dpkg/"; # state - -if (not -d "$dir") -{ - my $ret = mkdir ("$dir"); - die ("Unable to create directory '$dir' $!\n") - if ($ret == 0); -} -$dir = `realpath $dir`; -chomp ($dir); -$dir .= ($dir =~ m:/$:) ? '' : "/"; -system ("mkdir -p ${dir}${cachedir}") if (not -d "${dir}${cachedir}"); -system ("mkdir -p ${dir}${libdir}") if (not -d "${dir}${libdir}"); -system ("mkdir -p ${dir}${dpkgdir}") if (not -d "${dir}${dpkgdir}"); -system ("mkdir -p ${dir}etc/apt/sources.list.d/") - if (not -d "${dir}etc/apt/sources.list.d/"); -system ("mkdir -p ${dir}etc/apt/preferences.d/") - if (not -d "${dir}etc/apt/preferences.d/"); -system ("mkdir -p ${dir}usr/share/info/dir") - if (not -d "${dir}usr/share/info/dir"); -system ("mkdir -p ${dir}/usr/share/doc/gcc-4.2-base/") - if (not -d "${dir}/usr/share/doc/gcc-4.2-base/"); -system ("touch ${dir}/usr/share/doc/gcc-4.2-base/.copyright"); -system ("touch ${dir}/usr/share/doc/gcc-4.2-base/changelog.Debian.gz"); -my $msg = sprintf(_g("Unable to create directory '%s'\n"), "${dir}etc/apt/preferences.d/"); -die ($msg) - if (not -d "${dir}etc/apt/preferences.d/"); - -@dirs = qw/ alternatives info parts updates/; -@touch = qw/ diversions statoverride status lock/; -foreach my $dpkgd (@dirs) { - if (not -d "${dir}${dpkgdir}$dpkgd") { - mkdir "${dir}${dpkgdir}$dpkgd"; - } -} -foreach my $file (@touch) { - utime(time, time, "${dir}${dpkgdir}/$file") or ( - open(F, ">${dir}${dpkgdir}/$file") && close F ); -} -utime(time, time, "${dir}etc/shells") or - (open(F, ">${dir}etc/shells") && close F ); - -if (not -d "${dir}etc/network") { - mkdir "${dir}etc/network"; -} - -if (not -d "${dir}dev") { - mkdir "${dir}dev"; -} - -# prevent the absolute symlink in libc6 from allowing -# writes outside the multistrap root dir. See: #553599 -if (-l "${dir}lib64" ) { - my $r = readlink "${dir}lib64"; - if ($r =~ m:^/:) - { - my $old = `pwd`; - chomp ($old); - unlink "${dir}lib64"; - chdir ("$dir"); - print _g("INF: ./lib64 -> /lib symbolic link reset to ./lib.\n"); - symlink "./lib", "lib64"; - chdir ("${old}"); - } -} -else -{ - my $old = `pwd`; - chomp ($old); - chdir ("$dir"); - print _g("INF: Setting ./lib64 -> ./lib symbolic link.\n"); - symlink "./lib", "lib64"; - chdir ("${old}"); -} - -unlink ("${dir}etc/apt/sources.list.d/multistrap.sources.list") - if (-f "${dir}etc/apt/sources.list.d/multistrap.sources.list"); -unlink ("${dir}etc/apt/sources.list") - if (-f "${dir}etc/apt/sources.list"); - -foreach $repo (sort keys %suites) -{ - if (not -e "${dir}${cachedir}") { - mkdir "${dir}${cachedir}"; - } - if (not -e "$dir/${libdir}lists") { - mkdir "$dir/${libdir}lists"; - } - if (not -e "$dir/${libdir}lists/partial") { - mkdir "$dir/${libdir}lists/partial"; - } - if (not -e "$dir/${cachedir}archives") { - mkdir "$dir/${cachedir}archives"; - } - if (not -e "$dir/${cachedir}archives/partial") { - mkdir "$dir/${cachedir}archives/partial"; - } -} -foreach my $aptsrc (@debootstrap) -{ - if (defined $deflist) - { - open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap.sources.list") - or die _g("Cannot open sources list"). $!; - print SOURCES $deflist; - close SOURCES; - } - elsif (-d "${dir}etc/apt/") - { - open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap.sources.list") - or die _g("Cannot open sources list"). $!; - $mirror = $sources{$aptsrc}; - $suite = $suites{$aptsrc}; - $component = (defined $components{$aptsrc}) ? $components{$aptsrc} : "main"; - print SOURCES< /lib symbolic link reset to ./lib after unpacking.\n"); - printf (_g("ERR: Some files may have been unpacked outside %s!\n"), $dir); - } - else - { - printf (_g("\nMultistrap system installed successfully in %s.\n\n"), $dir); - } -} -unlink ("${dir}etc/apt/sources.list.d/multistrap.sources.list") - if (-f "${dir}etc/apt/sources.list.d/multistrap.sources.list"); -foreach my $aptsrc (@aptsources) -{ - if (defined $deflist) - { - open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap.sources.list") - or die _g("Cannot open sources list"). $!; - print SOURCES $deflist; - close SOURCES; - } - elsif (-d "${dir}etc/apt/") - { - open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap.sources.list") - or die _g("Cannot open sources list"). $!; - $mirror = $sources{$aptsrc}; - $suite = $suites{$aptsrc}; - $component = (defined $components{$aptsrc}) ? $components{$aptsrc} : "main"; - print SOURCES<${dir}${libdir}lists/lock"); - close (LOCK); - opendir (DEBS, "${dir}${cachedir}archives/") - or die (_g("Cannot read apt archives directory.\n")); - @archives=grep(/.*\.deb$/, readdir DEBS); - closedir (DEBS); - } - my $old = `pwd`; - chomp ($old); - chdir ("${dir}"); - printf (_g("Using directory %s for unpacking operations\n"), ${dir}); - foreach $deb (sort @archives) - { - printf (_g("I: Extracting %s...\n"), $deb); - my $ver=`LC_ALL=C dpkg -f ./${cachedir}archives/$deb Version`; - my $pkg=`LC_ALL=C dpkg -f ./${cachedir}archives/$deb Package`; - chomp ($ver); - chomp ($pkg); - mkdir ("./tmp"); - my $tmpdir = `mktemp -p ./tmp -d -t multistrap.XXXXXX`; - chomp ($tmpdir); - my $datatar = `LC_ALL=C dpkg -X ./${cachedir}archives/$deb ${dir}`; - my $exit = `echo $?`; - chomp ($exit); - if ($exit ne "0") - { - printf(_g("dpkg -X failed with error code %s\nSkipping...\n"), $exit); - next; - } - my @lines = split("\n", $datatar); - open (LIST, ">>./${dpkgdir}info/${pkg}.list"); - foreach my $l (@lines) - { - chomp ($l); - $l =~ s:^\.::; - $l =~ s:^/$:/\.:; - $l =~ s:/$::; - print LIST "$l\n"; - } - close (LIST); - system ("dpkg -e ./${cachedir}archives/$deb ${tmpdir}/"); - opendir (MAINT, "./${tmpdir}"); - my @maint=grep(!m:\.\.?:, readdir (MAINT)); - closedir (MAINT); - open (AVAIL, ">>./${dpkgdir}available"); - open (STATUS, ">>./${dpkgdir}status"); - foreach my $mscript (@maint) - { - rename "./${tmpdir}/$mscript", "./${dpkgdir}info/$pkg.$mscript"; - if ( $mscript eq "control" ) - { - open (MSCRIPT, "./${dpkgdir}info/$pkg.$mscript"); - my @scr=; - close (MSCRIPT); - my @avail = grep(!/^$/, @scr); - print AVAIL @avail; - print STATUS @avail; - print AVAIL "\n"; - print STATUS "Status: install ok unpacked\n"; - unlink ("./${dpkgdir}info/$mscript"); - } - } - close (AVAIL); - if ( -f "./${dpkgdir}info/$pkg.conffiles") - { - print STATUS "Conffiles:\n"; - printf (_g(" -> Processing conffiles for %s\n"), $pkg); - open (CONF, "./${dpkgdir}info/$pkg.conffiles"); - my @lines=; - close (CONF); - foreach my $line (@lines) - { - chomp ($line); - my $md5=`LC_ALL=C md5sum ./$line | cut -d" " -f1`; - chomp ($md5); - print STATUS " $line $md5\n"; - } - } - print STATUS "\n"; - close (STATUS); - system ("rm -rf ./${tmpdir}"); - if (-l "${dir}lib64" ) { - my $r = readlink "${dir}lib64"; - if ($r =~ m:^/:) - { - my $old = `pwd`; - chomp ($old); - printf (_g("ERR: lib64 -> ./lib symbolic link clobbered by %s\n"), $pkg); - unlink "${dir}lib64"; - chdir ("$dir"); - print _g("INF: lib64 -> /lib symbolic link reset to ./lib.\n"); - symlink "./lib", "lib64"; - chdir ("${old}"); - } - } - } - chdir ("$old"); - print _g("I: Unpacking complete.\n"); -} - -sub check_bin_sh -{ - $dir = shift; - my $old = `pwd`; - chomp ($old); - # dash refuses to configure if no existing shell is found. - # (always expects a diversion to already exist). - # (works OK in subsequent upgrades.) #546528 - unlink ("$dir/var/lib/dpkg/info/dash.postinst"); - # now ensure that a usable shell is available as /bin/sh - if (not -l "$dir/bin/sh") - { - print (_g("ERR: ./bin/sh symbolic link does not exist.\n")); - if (-f "$dir/bin/dash") - { - print (_g("INF: Setting ./bin/sh -> ./bin/dash\n")); - chdir ("$dir/bin"); - symlink ("dash", "sh"); - chdir ("$old"); - } - elsif (-f "$dir/bin/bash") - { - print (_g("INF: ./bin/dash not found. Setting ./bin/sh -> ./bin/bash\n")); - chdir ("$dir/bin"); - symlink ("bash", "sh"); - chdir ("$old"); - } - } - if (-l "$dir/bin/sh") - { - print ("${dir}bin/sh found OK:\n"); - system ("(cd $dir ; ls -lh bin/sh)"); - } - else - { - die ("No shell."); - } -} - -sub tidy_apt -{ - print _g("I: Tidying up apt cache and list data.\n"); - unlink ("${dir}etc/apt/sources.list") - if (-f "${dir}etc/apt/sources.list"); - opendir (DEBS, "${dir}${libdir}lists/") - or die (_g("Cannot read apt lists directory.\n")); - my @lists=grep(!m:\.\.?$:, readdir DEBS); - closedir (DEBS); - foreach my $file (@lists) - { - next if (-d $file); - unlink ("${dir}${libdir}lists/$file"); - } - opendir (DEBS, "${dir}${cachedir}/") - or die (_g("Cannot read apt cache directory.\n")); - my @files=grep(!m:\.\.?$:, readdir DEBS); - closedir (DEBS); - foreach my $file (@files) - { - next if (-d $file); - next unless ($file =~ /\.bin$/); - unlink ("${dir}${cachedir}$file"); - } - if ($unpack eq "true") - { - opendir (DEBS, "${dir}${cachedir}/archives/") - or die (_g("Cannot read apt archives directory.\n")); - my @files=grep(!m:\.\.?$:, readdir DEBS); - closedir (DEBS); - foreach my $file (@files) - { - next if (-d $file); - next unless ($file =~ /\.deb$/); - (defined $sourcedir) ? - system ("mv ${dir}${cachedir}archives/$file $sourcedir/$file") : - unlink ("${dir}${cachedir}archives/$file"); - ; - } - } -} - -# if native arch, do a few tasks just because we can and probably should. -sub native -{ - print _g("I: Native mode - configuring unpacked packages . . .\n"); - my $e=`LC_ALL=C printenv`; - my $str = ($e =~ /\nUSER=root\n/) ? "" : "sudo"; - $str = (-f "/usr/bin/sudo") ? "$str" : ""; - my $env = "DEBIAN_FRONTEND=noninteractive ". - "DEBCONF_NONINTERACTIVE_SEEN=true ". - "LC_ALL=C LANGUAGE=C LANG=C"; - printf (_g("I: dpkg configuration settings:\n\t%s\n"), $env); - # check that we have a workable shell inside the chroot - &check_bin_sh("$dir"); - system ("$str $env chroot $dir dpkg --configure -a"); -} - -sub get_required_debs -{ - # emulate required="$(get_debs Priority: required)" - # from debootstrap/functions - # needs to be run after the first apt-get install so that - # Packages files exist - my @required=(); - my @debs=(); - opendir (PKGS, "${dir}${libdir}lists/") - or die sprintf(_g("Cannot open %s directory. %s\n"), - "${dir}${libdir}lists/", $!); - my @lists=grep(/_Packages$/, readdir (PKGS)); - closedir (PKGS); - foreach my $strap (@debootstrap) - { - my $s = lc($strap); - foreach my $l (@lists) - { - push (@required, $l); - } - } - foreach my $file (@required) - { - my $fh = IO::File->new("${dir}${libdir}lists/$file"); - my $parser = Parse::Debian::Packages->new( $fh ); - while (my %package = $parser->next) - { - next unless $package{'Priority'} eq "required"; - push @debs, $package{'Package'}; - } - } - return \@debs; -} - -# inherited from apt-cross -sub prepare_sources_list -{ - my @source_list=(); - # collate all available/configured sources into one list - if (-e "/etc/apt/sources.list") { - open (SOURCES, "/etc/apt/sources.list") - or die _g("cannot open apt sources list. %s",$!); - @source_list = ; - close (SOURCES); - } - if (-d "/etc/apt/sources.list.d/") { - opendir (FILES, "/etc/apt/sources.list.d/") - or die _g("cannot open apt sources.list directory %s\n",$!); - my @files = grep(!/^\.\.?$/, readdir FILES); - foreach my $f (@files) { - next if ($f =~ /\.ucf-old$/); - open (SOURCES, "/etc/apt/sources.list.d/$f") or - die _g("cannot open /etc/apt/sources.list.d/%s %s",$f, $!); - while() { - push @source_list, $_; - } - close (SOURCES); - } - closedir (FILES); - } - return \@source_list; -} - -sub usageversion { - printf STDERR (_g(" -%s version %s - -Usage: - %s [-a ARCH] [-d DIR] -f CONFIG_FILE - %s -?|-h|--help|--version - -Command: - -f|--file CONFIG_FILE: path the the multistrap configuration file. - -Options: - -a|--arch ARCHITECTURE: override the configuration file architecture. - -d|--dir PATH: override the configuration file directory. - --no-auth: do not use Secure Apt for any repositories - --tidy-up: remove apt cache data and downloaded archives. - -?|-h|--help: print this usage message and exit - --version: print this usage message and exit - -%s extends debootstrap to provide support for multiple -repositories, using a configuration file to specify the relevant suites, -architecture, extra packages and the mirror to use for each repository. - -Example configuration: -[General] -arch=armel -directory=/opt/multistrap/ -# same as --tidy-up option if set to true -cleanup=true -# same as --no-auth option if set to true -# keyring packages listed in each debootstrap will -# still be installed. -noauth=false -# extract all downloaded archives (default is true) -unpack=true -# aptsources is a list of sections to be used for downloading packages -# and lists and placed in the /etc/apt/sources.list.d/multistrap.sources.list -# of the target. Order is not important -aptsources=Grip Updates -# the order of sections is not important. -# the debootstrap option determines which repository -# is used to calculate the list of Priority: required packages. -debootstrap=Debian - -[Debian] -packages= -source=http://ftp.uk.debian.org/debian -keyring=debian-archive-keyring -suite=lenny - -This will result in a completely normal debootstrap of Debian lenny from -the specified mirror, for armel in /opt/multistrap/. - -'Architecture' and 'directory' can be overridden on the command line. - -Specify a package to extend the debootstap to include that package and -all dependencies. Dependencies will be calculated by apt so as to use -only the most recent suitable version from all configured repositories. - -General settings: - -'directory' specifies the top level directory where the debootstrap -will be created - it is not packed into a .tgz once complete. - -"), $progname, $ourversion, $progname, $progname, $progname) - or die ("$progname: ". _g("failed to write usage:") . "$!\n"); -} - -sub _g { - return gettext(shift); -} - -=pod - -=head1 Name - -em_multistrap - extends debootstrap for multiple repository support - -=head1 Synopsis - - em_multistrap [-a ARCH] [-d DIR] -f CONFIG_FILE - em_multistrap -?|-h|--help|--version - -=head1 Options - -(These options can also be set in the configuration file.) - ---tidy-up - remove apt cache data, downloaded Packages files and -the apt package cache. Same as cleanup=true. - ---no-auth - allow the use of unauthenticated repositories. Same -as noauth=true - -=head1 Description - -em_multistrap provides a debootstrap-like method based on apt and -extended to provide support for multiple repositories, using a -configuration file to specify the relevant suites, architecture, -extra packages and the mirror to use for each debootstrap. - -The aim is to create a complete debootstrap with all packages -installed and configured, instead of just the base system. - -Example configuration: - - [General] - arch=armel - directory=/opt/multistrap/ - # same as --tidy-up option if set to true - cleanup=true - # same as --no-auth option if set to true - # keyring packages listed in each debootstrap will - # still be installed. - noauth=false - # extract all downloaded archives (default is true) - unpack=true - # aptsources is a list of sections to be used for downloading packages - # and lists and placed in the /etc/apt/sources.list.d/multistrap.sources.list - # of the target. Order is not important - aptsources=Grip Updates - # the order of sections is not important. - # the debootstrap option determines which repository - # is used to calculate the list of Priority: required packages. - debootstrap=Debian - - [Debian] - packages= - source=http://ftp.uk.debian.org/debian - keyring=debian-archive-keyring - suite=lenny - -This will result in a completely normal debootstrap of Debian lenny from -the specified mirror, for armel in '/opt/multistrap/'. - -Specify a package to extend the multistrap to include that package and -all dependencies. - -Specify more debootstraps by adding new sections. Section names are used -in the debootstrap general option. - -Section names are case-insensitive. - -e.g. change - - debootstrap=Debian - -to - - debootstrap=Grip - -then add the new section for Grip: - - [Grip] - packages=locales - keyring=emdebian-archive-keyring - source=http://www.emdebian.org/grip - suite=lenny - -Setting Grip instead of Debian in the debootstrap option, as above, -will provide a base system from Emdebian Grip 1.0 and locate any -missing dependencies in Debian 5.0 Lenny, allowing you to add any -package(s) you need from Debian that are not yet in Emdebian Grip. - -All dependencies are resolved only by apt, using all configured -repositories, to use only the most recent and most suitable -dependencies. Note that multistrap turns off Install-Recommends -so if the multistrap needs a package that is only a Recommended -dependency, the recommended package needs to be specified in the -packages line explicitly. - -'Architecture' and 'directory' can be overridden on the command line. -Other general options have command line options, except debootstrap -itself. - -=head1 General settings: - -'directory' specifies the top level directory where the debootstrap -will be created - it is not packed into a .tgz once complete. - -As with debootstrap, em_multistrap will continue after errors. - -em_multistrap does not currently implement the machine:variant support -used in Emdebian but the build directory is not packed up at the -end of the run so other scripts can be used to implement customisations. - -=head1 Secure Apt - -To use authenticated apt repositories, multistrap either needs to be -able to install an appropriate keyring package from the existing apt -sources *outside the multistrap environment* or have the relevant keys -already configured using apt-key *on the host system*. - -If relevant packages exist, specify them in the 'keyring' option for -each repository. em_multistrap will then check that apt has already -installed this package so that the repository can be authenticated -before any packages are downloaded from it. - -Note that *all* repositories to be used with multistrap must be -authenticated or apt will fail. Similarly, secure apt can only be -disabled for all repositories (by using the --no-auth command line -option or setting the general noauth option in the configuration -file), even if only one repository does not have a suitable keyring -available. Not all packages need keyring packages, if you configure -apt-key appropriately. - -The keyring package(s) will also be installed inside the multistrap -environment to match the installed apt sources for the multistrap. - -All configuration of apt-key needs to be done for the machine -running multistrap itself. - -=head1 State - -multistrap is stateless - if the directory exists, it will simply -proceed as normal and apt will try to pick up where it left off. - -=head1 Configuration - -multistrap unpacks the downloaded packages but other stages of -system configuration are not attempted. Examples include: - - /etc/inittab - /etc/fstab - /etc/hosts - /etc/securetty - /etc/modules - /etc/hostname - /etc/network/interfaces - /etc/init.d - /etc/dhcp3 - -Any device-specific device nodes will also need to be created -using MAKEDEV. - -Once multistrap has successfully created the basic file and -directory layout, other device-specific scripts are needed before -the filesystem can be packaged up and installed onto the -target device. - -Once installed, the packages themselves need to be configured -using the package maintainer scripts and C, -unless this is a native multistrap. - -For C to work, F and F must be mounted (or -mountable), F is also recommended. - -See also: http://wiki.debian.org/Multistrap - -=head1 Environment - -To configure the unpacked packages (whether in native or cross mode), -certain environment variables are needed: - -Debconf needs to be told to accept that user interaction is not -desired: - - DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true - -Perl needs to be told to accept that no locales are available inside -the chroot and not to complain: - - LC_ALL=C LANGUAGE=C LANG=C - -Then, dpkg can configure the packages: - -chroot method (PATH = top directory of chroot): - - DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ - LC_ALL=C LANGUAGE=C LANG=C chroot /PATH/ dpkg --configure -a - -at a login shell: - - # export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true - # export LC_ALL=C LANGUAGE=C LANG=C - # dpkg --configure -a - -(As above, dpkg needs F and F mounted first.) - -=head1 Native mode - multistrap - -em_multistrap was not intended for native support, it was developed for -cross architecture support. In order for multiple repositories to be -used, em_multistrap only unpacks the packages selected by apt. - -In native mode, various post-multistrap operations are likely to be -needed that debootstrap would do for you: - - 1. copy /etc/hosts into the chroot - 2. clean the environment to unset LANGUAGE, LC_ALL and LANG - to silence nuisance perl warnings that obscure other errors - -(An alternative to unset the localisation variables is to add -locales to your multistrap configuration file in the 'packages' -option. - -A native multistrap can be used directly with chroot, so -C runs C at the end of the -multistrap process. - -=head1 Local repositories - -apt will not download packages from repositories that use the -file:// type, so multistrap is unable to locate the package -files. Always use a http:// or ftp:// method like -F. - -=cut diff --git a/embootstrap b/embootstrap deleted file mode 100755 index 57315af..0000000 --- a/embootstrap +++ /dev/null @@ -1,389 +0,0 @@ -#!/bin/bash -set -e - -# embootstrap -- create a bootstrap for emdebian builds -# -# Note that this script controls tarballs for empdebuild and emsandbox -# pass --cross to set an emsandbox tarball. -# -# Copyright (C) 2007-2010 Neil Williams -# -# 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 . -# - -CWD=`pwd` - -# test for sudo -# make sure sudo is in use. -# bash cannot seem to do this when set -e is enabled -# because grep returns non-zero on a non-match -# so I use perl. :-) -ISROOT=`perl -e '$e=\`printenv\`; ($e =~ /\nUSER=root\n/) ? print "yes" : print "no";'` -if [ $ISROOT == "no" ] ; then - echo "embootstrap needs to be run under sudo or as root." - exit 2 -fi - -. /usr/lib/pbuilder/pbuilder-modules -. /usr/lib/pbuilder/pbuilder-buildpackage-funcs -. /usr/share/emdebian-tools/empbuilderlib - -# move to our own function file later. - -# Need support for create (this script), update (unpack base.tgz) and login -# (sudo chroot /bin/sh) as well as the final empdebuild (emsource,emdebuild) -# in a separate script. - -# Currently, this script needs user intervention to build the chroot: -# emsetup asks for confirmation and apt-get install wants GnuPG verification. - -# This script will concentrate only on creating and updating the chroot. -# Parameters. -# WORK=location of this script. -# MIRROR=the Debian primary mirror that will replace the default debootstrap mirror -# (ftp.debian.org is not a primary and only supports 2 architectures). -# TODO: needs command line options to set the rest of these parameters. - -# Note --oknodo will cause failures, see #426877 - -WORK=$CWD - -get_work_dir -BUILDPLACE=$WORKDIR -WORKDIR=`echo ${WORKDIR}/ | tr -s \/` -echo "Using '$WORKDIR' as the Emdebian working directory." -BASETGZ="$BUILDPLACE/emdebian.tgz" -BASETGZ=`echo $BASETGZ | tr -s \/` -BUILDPLACE="$BUILDPLACE/pbuilder" -# tidy up // to / -BUILDPLACE=`echo $BUILDPLACE | tr -s \/` -MIRROR= -# don't die if the user has set 'None' for the dpkg-cross default. -get_default_arch - -BUILDPLACE="${WORKDIR}pbuilder/build" -if [ -d $BUILDPLACE ]; then - rm -rf $BUILDPLACE/* -fi -if [ ! -d $BUILDPLACE ]; then - mkdir -p $BUILDPLACE -fi -BASETGZ="${WORKDIR}emdebian.tgz" -SUITE=unstable -CROSS=x -MACHINE=x -VARIANT=x -MACHINEPATH="${WORKDIR}machine/" -USEDEVPTS="yes" -USEPROC="yes" - -while [ -n "$1" ]; do -case "$1" in - -a|--arch) - shift - ARCH=$1 - # chomp the argument to --arch - shift - ;; - --testing|testing) - shift; - BASETGZ="${WORKDIR}emdebian-testing.tgz" - SUITE=testing - echo "Creating an embootstrap testing chroot" - ;; - # only for emsandbox support, empdebuild does not pass -S - -S|--suite) - shift - SUITE=$1 - shift - ;; - --cross|cross) - shift; - BASETGZ="${WORKDIR}emdebian-$ARCH.tgz" - CROSS=$ARCH - echo "Creating an embootstrap $ARCH chroot" - ;; - --script) - shift - CMD_SCRIPT=$1 - if [ ! -f $CMD_SCRIPT ]; then - echo "Cannot find suite script '$CMD_SCRIPT'." - exit; - fi - echo "Using $CMD_SCRIPT" - shift - ;; - --machine-path) - shift - MACHINEPATH="$1/" - MACHINEPATH=`echo $MACHINEPATH | tr -s \/` - shift - ;; - --machine) - shift - MACHINE=$1 - VARIANT=default - if [ ! -d "${MACHINEPATH}$MACHINE" ]; then - echo "Cannot find machine directory: '${MACHINEPATH}$MACHINE'." - exit 4 - fi - shift - ;; - --variant) - shift - VARIANT=$1 - if [ ! $MACHINE ]; then - echo "Variant specified without a machine." - exit 3 - fi - if [ ! -d "${MACHINEPATH}$MACHINE/$VARIANT" ]; then - echo "Cannot find variant directory: '${MACHINEPATH}$MACHINE/$VARIANT'." - exit 3 - fi - shift - ;; - *) - echo "Unrecognised option: $1" - exit; - ;; -esac -done - -if [ "$ARCH" = "None.\n" ]; then - echo $ARCH - echo Use the --arch option or dpkg-reconfigure dpkg-cross - exit 2 -fi - -# include packages.conf if --machine used. -if [ "$MACHINE" != "x" -a "$VARIANT" != "x" -a $CROSS -a $CROSS = $ARCH ]; then - # sets INCLUDE, SCRIPT, MIRROR etc. - FILE="${MACHINEPATH}$MACHINE/$VARIANT/packages.conf" - if [ -f $FILE ]; then - . $FILE - else - echo "ERROR: Cannot find machine support: $FILE" - exit 1 - fi - echo "Using $MACHINE:$VARIANT" - if [ $TARBALL_NAME ]; then - echo " -> creating ${WORKDIR}/${TARBALL_NAME}" - BASETGZ="${WORKDIR}/${TARBALL_NAME}" - fi -fi - -checkarch -HOST_ARCH=`dpkg-architecture -qDEB_HOST_ARCH` - -# let the command line override the packages.conf -if [ ! $SCRIPT ]; then - SCRIPT=$CMD_SCRIPT -fi - -# if neither command line nor packages.conf have a script set, use default. -if [ ! $SCRIPT ]; then - SCRIPT="/usr/share/emdebian-tools/emdebian.crossd" -fi - -if [ $CROSS -a $CROSS = $ARCH ]; then - echo "Building $ARCH chroot on $HOST_ARCH to install $ARCH packages." -else - echo "Building $HOST_ARCH chroot on $HOST_ARCH to cross-build $ARCH packages." -fi -if [ -f ${BASETGZ} ]; then - echo "${BASETGZ} already exists! Aborting . . ." - exit 1; -fi -echo "Checking for a user writeable tree in $BUILDPLACE" -check_dirs -echo " -> running debootstrap" -export LANG=C -export LC_ALL=C -# debootstrap 1.0.7 has moved -WORK="/usr/share/debootstrap/" -# handle old versions of debootstrap so that we can migrate into testing. -if [ -f "/usr/lib/debootstrap/functions" ]; then - WORK="/usr/lib/debootstrap/"; -fi -FOREIGN= -INC= -if [ $CROSS -a $CROSS = $ARCH ]; then - echo " -> cross detected, using foreign." - FOREIGN="--foreign" - if [ ! $MIRROR ]; then - MIRROR="http://www.emdebian.org/crush/" - fi - if [ ! $PROXY ]; then - PROXY="http://www.emdebian.org/crush/" - fi - if [ $INCLUDE ]; then - INC="--include=$INCLUDE" - fi - # if SUITE is empty in packages.conf, reset the default - if [ ! $SUITE ]; then - SUITE=unstable - fi - BUILDD=$SCRIPT - if [ ! -f ${WORKDIR}/stamp-debootstrap ]; then - echo "DEBOOTSTRAP_DIR=$WORK debootstrap $INC --verbose $FOREIGN --arch ${ARCH} $SUITE $BUILDPLACE $PROXY $BUILDD" - DEBOOTSTRAP_DIR=$WORK debootstrap ${INC} --verbose $FOREIGN --arch ${ARCH} $SUITE $BUILDPLACE $PROXY $BUILDD - echo " -> debootstrap stage complete" - echo " -> Checking for machine:variant hooks" - # hooks - if [ $INC ]; then - echo "${INC}" >> $BUILDPLACE/debootstrap/machineincludes - fi - if [ -f ${MACHINEPATH}/$MACHINE/$VARIANT/setup.sh ]; then - if [ ! -z "$EXTRA" ]; then - if [ -e $EXTRA ]; then - cp $EXTRA $BUILDPLACE/ - fi - fi - echo " -> Running $MACHINE/$VARIANT/setup.sh $BUILDPLACE $ARCH" - sh ${MACHINEPATH}/$MACHINE/$VARIANT/setup.sh $BUILDPLACE $ARCH - fi - if [ -f ${MACHINEPATH}/$MACHINE/$VARIANT/config.sh ]; then - echo " -> Copying config.sh for $MACHINE:$VARIANT into tarball" - mkdir -p $BUILDPLACE/machine/ - cp ${MACHINEPATH}/$MACHINE/$VARIANT/config.sh $BUILDPLACE/machine/ - fi - touch ${WORKDIR}/stamp-debootstrap - fi # end of $CROSS -else # else if not $CROSS - # TODO this should be configurable - emdebian-tools will add a primary later. - # copy or use the ~/.apt-cross/sources.foo. files. - if [ ! $MIRROR ]; then - get_primary - if [ ! -z "$PRIMARY" ]; then - MIRROR="http://${PRIMARY}/debian" - fi - fi - if [ ! $MIRROR ]; then - MIRROR="http://ftp.fr.debian.org/debian/" - fi - BUILDD=/usr/share/emdebian-tools/emdebian.buildd - if [ ! -f ${WORKDIR}/stamp-debootstrap ]; then - echo "DEBOOTSTRAP_DIR=$WORK debootstrap --verbose $SUITE $BUILDPLACE $MIRROR $BUILDD" - DEBOOTSTRAP_DIR=$WORK debootstrap --verbose $SUITE $BUILDPLACE $MIRROR $BUILDD - touch ${WORKDIR}/stamp-debootstrap - fi -fi -mkdir -p "$BUILDPLACE/tmp/buildd" - -copy_host_configuration - -# emdebian-tools will be reconfigured later. -# ensure src is available if not emsandbox -echo " -> Installing apt-lines for $MIRROR" -mkdir -p "$BUILDPLACE/etc/apt/sources.list.d/" -rm -f "$BUILDPLACE"/etc/apt/sources.list -if [ $CROSS -a $CROSS = $ARCH ]; then - cat >> "$BUILDPLACE"/etc/apt/sources.list.d/emdebian.sources.list << EOF -#emdebian target repository : default source list -# created by emsandbox -deb $MIRROR $SUITE main -#deb-src $MIRROR $SUITE main -EOF -else - cat >> "$BUILDPLACE"/etc/apt/sources.list << EOF -deb $MIRROR $SUITE main -deb-src $MIRROR $SUITE main -EOF -fi - -if [ $CROSS -a $CROSS = $ARCH ]; then - # copy our secure apt key into the chroot for apt-key - cp /usr/share/emdebian-tools/emdebian-archive-keyring.gpg $BUILDPLACE/ - # copy in our install helper - cp /usr/share/emdebian-tools/emsecondstage $BUILDPLACE/ - # only executable by root to allow debootstrap to work properly. - chmod 744 $BUILDPLACE/emsecondstage - rm -f $BUILDPLACE/debootstrap/debootstrap.log - # empty if using unpack but should still exist. - save_aptcache -else - echo "Refreshing the base.tgz " - echo " -> upgrading packages" - mountproc - chroot $BUILDPLACE /usr/bin/apt-get update - recover_aptcache - chroot $BUILDPLACE /usr/bin/apt-get -y --force-yes dist-upgrade - echo " -> adding the Emdebian repository key" - chroot $BUILDPLACE mkdir -p /home/$SUDO_USER/.gnupg - chroot $BUILDPLACE mkdir -p /home/$SUDO_USER/.dpkg-cross - if [ -f /home/$SUDO_USER/.devscripts ]; then - cp /home/$SUDO_USER/.devscripts $BUILDPLACE/home/$SUDO_USER/.devscripts - fi - cp /usr/share/emdebian-tools/emdebian-archive-keyring.gpg $BUILDPLACE/ - chroot $BUILDPLACE apt-key add emdebian-archive-keyring.gpg - if [ -f emdebian-archive-keyring.gpg ]; then - rm emdebian-archive-keyring.gpg - fi - echo " -> updating /etc/hosts" - cp /etc/hosts $BUILDPLACE/etc/hosts - # emdebian.buildd installs emdebian-tools which sets up apt for the emdebian repository - echo " -> updating the apt cache" - chroot "$BUILDPLACE" /usr/bin/apt-get update - # upgrade emdebian-tools and apt-cross before running emsetup - echo " -> upgrading emdebian-tools and apt-cross" - chroot "$BUILDPLACE" /usr/bin/apt-get -y --force-yes dist-upgrade - echo " -> updating apt-cross cache" - DPKG_CROSS="/home/$SUDO_USER/.dpkg-cross" - if [ ! -f $DPKG_CROSS/apt.conf-${SUITE} ]; then - chroot $BUILDPLACE /usr/bin/apt-cross -a $ARCH -S $SUITE -u - else - echo " -> copying existing apt-cross cache" - cp $DPKG_CROSS/apt.conf-$SUITE $BUILDPLACE/$DPKG_CROSS/ - cp $DPKG_CROSS/sources.$SUITE $BUILDPLACE/$DPKG_CROSS/ - cp $DPKG_CROSS/status-$SUITE $BUILDPLACE/$DPKG_CROSS/ - cp -r $DPKG_CROSS/$SUITE $BUILDPLACE/$DPKG_CROSS/ - fi - echo " -> running emsetup" - if chroot "$BUILDPLACE" /usr/bin/emsetup -v -a $ARCH --yes; then - : - else - echo " -> emsetup failed" - if [ "${LOGIN_AFTER_FAIL}" = "yes" ]; then - echo " -> Logging into the chroot" - echo " -> Build directory: /trunk/$SVN" - echobacktime - chroot $BUILDPLACE /bin/sh - save_aptcache - echo " -> emsetup failed" - chroot $BUILDPLACE /usr/bin/apt-get clean - umountproc - create_emdebiantgz - cleanbuildplace - rm ${WORKDIR}/stamp-debootstrap - exit 1; - fi - save_aptcache - umountproc - chroot $BUILDPLACE /usr/bin/apt-get clean - create_emdebiantgz - cleanbuildplace - rm ${WORKDIR}/stamp-debootstrap - echobacktime - echo " -> emsetup failed: exiting with an error!" - echo " Try --login-after-fail" - exit 1; - fi - umountproc - save_aptcache - chroot $BUILDPLACE /usr/bin/apt-get clean -fi - -create_emdebiantgz -cleanbuildplace -rm ${WORKDIR}/stamp-debootstrap diff --git a/emdebian-rootfs b/emdebian-rootfs deleted file mode 100644 index 4db7a90..0000000 --- a/emdebian-rootfs +++ /dev/null @@ -1,93 +0,0 @@ -# bash completion support -# -# Copyright (C) 2008 Neil Williams -# -# 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 . -# - -_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 diff --git a/emdebian.busybox b/emdebian.busybox deleted file mode 100644 index 0c8b854..0000000 --- a/emdebian.busybox +++ /dev/null @@ -1,87 +0,0 @@ -# emdebian secondstage support (example only). -# busybox is not currently built with internal dpkg -# support so this package set might not work. -# -# Copyright (C) 2007-2008 Neil Williams -# -# 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 . -# - -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." -} diff --git a/emdebian.coreutils b/emdebian.coreutils deleted file mode 100644 index 49a713d..0000000 --- a/emdebian.coreutils +++ /dev/null @@ -1,80 +0,0 @@ -# emdebian secondstage support (Default busybox, dpkg and apt version) -# -# Copyright (C) 2007-2008 Neil Williams -# -# 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 . -# - -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." -} diff --git a/emdebian.crossd b/emdebian.crossd deleted file mode 100644 index 54cb6c9..0000000 --- a/emdebian.crossd +++ /dev/null @@ -1,85 +0,0 @@ -# emdebian secondstage support (Default busybox, dpkg and apt version) -# -# Copyright (C) 2007-2008 Neil Williams -# -# 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 . -# - -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." -} diff --git a/emdebian.gpe b/emdebian.gpe deleted file mode 100644 index cf58efa..0000000 --- a/emdebian.gpe +++ /dev/null @@ -1,90 +0,0 @@ -# emdebian secondstage support (busybox, dpkg, apt + gtk version) -# -# Copyright (C) 2007-2008 Neil Williams -# -# 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 . -# - -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." -} diff --git a/emdebian.grip b/emdebian.grip deleted file mode 100644 index 673f679..0000000 --- a/emdebian.grip +++ /dev/null @@ -1,101 +0,0 @@ -# emdebian secondstage support (Grip version) -# -# Copyright (C) 2007-2009 Neil Williams -# -# 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 . -# - -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 -} diff --git a/emdebian.gtk b/emdebian.gtk deleted file mode 100644 index 5c665da..0000000 --- a/emdebian.gtk +++ /dev/null @@ -1,84 +0,0 @@ -# emdebian secondstage support (busybox, dpkg, apt + gtk version) -# -# Copyright (C) 2007-2008 Neil Williams -# -# 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 . -# - -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." -} diff --git a/empbuilderlib b/empbuilderlib deleted file mode 100644 index 575ec24..0000000 --- a/empbuilderlib +++ /dev/null @@ -1,223 +0,0 @@ -# empbuilderlib : shell library to support building chroots for Emdebian. -# -# Copyright (C) 2006-2010 Neil Williams -# 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 . -# - -# This shell library requires perl and pbuilder (which means bash!) ! -# Draws in POSIX shell functions from emrootfslib to be able to call -# in functions from first_stage_install within debootstrap. The only -# reasons to continue putting new functions in here are if: -# 1. the functions are only useful to create cross-building chroots OR -# 2. the functions need to call pbuilder code directly. -# There should be no need to call pbuilder code within scripts that -# generate a root filesystem. - -# Intended solely for use on the build machine. Do not use these functions -# in second_stage_install ! - -. /usr/share/emdebian-tools/emrootfslib -. /usr/lib/pbuilder/pbuilder-modules - -WORKPLACE="${WORKDIR}/pbuilder" -BASETGZ="${WORKDIR}/emdebian.tgz" - -#pbuilder base values -DEBIAN_BUILDARCH=$ARCH -# cross-building chroot is same arch as host. -BUILDRESULT="$WORKPLACE/result/" -# tidy up // to / -BUILDRESULT=`echo $BUILDRESULT | tr -s \/` -APTCACHE="$WORKPLACE/aptcache/" -# tidy up // to / -APTCACHE=`echo $APTCACHE | tr -s \/` -AUTO_DEBSIGN=yes -APTCACHEHARDLINK="no" -BUILDPLACE="$WORKPLACE/build" - -# the default is to add a PID in the buildplace. -BASEBUILDPLACE="$BUILDPLACE" -if [ "${PRESERVE_BUILDPLACE}" != "yes" ]; then - BUILDPLACE="$BUILDPLACE/$$" -fi - -function extractembuildplace () { - # after calling this function, umountproc, and cleanbuildplace - # needs to be called. Please trap it. - if [ ! \( "${PRESERVE_BUILDPLACE}" = "yes" -a -d "$BUILDPLACE" \) ]; then - cleanbuildplace - echo "Building the Emdebian build Environment" - if ! mkdir -p "$BUILDPLACE"; then - echo "E: failed to build the directory to chroot" - exit 1 - fi - echo " -> extracting base tarball [${BASETGZ}]" - if [ ! -f "$BASETGZ" ]; then - echo "E: failed to find $BASETGZ, have you created your base tarball yet?" - exit 1 - fi - if ! (cd "$BUILDPLACE" && tar xfzp "$BASETGZ"); then - echo "E: failed to extract $BASETGZ to $BUILDPLACE" - exit 1 - fi - echo " -> creating local configuration" - if [ $CROSS -a $CROSS != $ARCH ]; then - hostname -f > "$BUILDPLACE/etc/mailname" - else - echo "emdebian-$ARCH" > "$BUILDPLACE/etc/mailname" - fi - if [ ! -f "$BUILDPLACE/etc/apt/apt.conf.d/10disablerecommends" ]; then - disable_apt_recommends - fi - fi - copy_local_configuration - mountproc - mkdir -p "$BUILDPLACE/tmp/buildd" - chmod 1777 "$BUILDPLACE/tmp" - if [ "$OVERRIDE_APTLINES" = "yes" ]; then - installaptlines - fi -} - -function autoclean_aptcache() { - if [ -n "$APTCACHE" ]; then - echo " -> Cleaning the cached apt archive" - chroot $BUILDPLACE /usr/bin/apt-get autoclean || true - find "$APTCACHE/" -maxdepth 1 -name \*.deb | \ - while read A; do - if [ ! -f "$BUILDPLACE/var/cache/apt/archives/"$(basename "$A") -a \ - -f "$A" ]; then - echo " -> obsolete cache content "$(basename "$A")" removed" - rm -f "$A" || true - fi - done - fi -} - -# intended only for chroots -function copy_host_configuration () { - echo " -> copying local configuration" - if [ $CROSS -a $CROSS != $ARCH ]; then - for a in hosts hostname resolv.conf; do - sudo rm -f "$BUILDPLACE/etc/$a" - if [ ! -f "/etc/$a" ]; then - echo "E: /etc/$a does not exist, your setup is insane. fix it" >&2 - sudo cp $( readlink -f "/etc/$a" ) "$BUILDPLACE/etc/$a"; - fi - done - else - # sandboxes need a different hostname - mkdir -p "$BUILDPLACE"/etc/ - cat > "$BUILDPLACE"/etc/hostname << EOF -emdebian-$ARCH -EOF - fi -} - -function createemchroot() -{ - if [ $SUITE == testing ]; then - BASETGZ="${WORKDIR}/emdebian-testing.tgz" - SUITE=testing - . /usr/share/emdebian-tools/embootstrap --arch $ARCH testing - echo "Creating an embootstrap testing chroot" - else - BASETGZ="$WORKDIR/emdebian.tgz" - . /usr/share/emdebian-tools/embootstrap --arch $ARCH - fi -} - -function checkembuilddep () { - # call satisfydepends - local BUILDOPT="--binary-all" - case "${BINARY_ARCH}" in - yes) BUILDOPT="--binary-arch";; - *) ;; - esac - PBUILDERSATISFYDEPENDSCMD=/usr/lib/pbuilder/pbuilder-satisfydepends - CONTROL=$BUILDPLACE/trunk/$SVN/debian/control - # this version parses debian/control, NOT the .dsc - # so that when Emdebian removes dependencies, the chroot does too. - echo "Running: $PBUILDERSATISFYDEPENDSCMD --control $CONTROL --chroot $BUILDPLACE ${BUILDOPT}" - if "$PBUILDERSATISFYDEPENDSCMD" --control "$CONTROL" --chroot "${BUILDPLACE}" "${BUILDOPT}" ; then - echo " -> installed ${HOST_ARCH} dependencies." - else - echo "E: pbuilder-satisfydepends failed." >&2 - exit 2 - fi - # install extra packages to the chroot - if [ -n "$EXTRAPACKAGES" ]; then - if echo "DEBIAN_FRONTEND=noninteractive usr/bin/apt-get -y --force-yes install ${EXTRAPACKAGES}" | chroot $BUILDPLACE /bin/sh; then - : - else - # if apt failed (maybe update needs to be run), save so far and exit cleanly - save_aptcache - umountproc - cleanbuildplace - exit 1; - fi - fi -} - -# get $ARCH .deb and put into /var/cache/apt/archives to -# allow these to be saved between builds. -function save_aptcrosscache() { - # save the current aptcache archive - # it is safe to call this function several times. - local doit - if [ -n "$APTCACHE" ]; then - echo "Copying back the cached apt-cross archive contents" - mkdir -p "$APTCACHE" ; - if [ "$APTCACHEHARDLINK" = "yes" ]; then - doit=ln - else - doit=cp - fi - # apt-cross puts the archives in the chroot / - find "$BUILDPLACE/" -maxdepth 1 -name \*.deb | \ - while read A ;do - if [ ! -f "$APTCACHE/"$(basename "$A") -a -f "$A" ]; then - echo " -> new cache content "$(basename "$A")" added" - $doit "$A" "$APTCACHE/" || true - fi - done - fi -} - -function get_aptcross_dir () -{ - if [ -z "$HOME" -o ! -d $HOME ]; then - HOME="/tmp"; - fi - path="$HOME/.apt-cross"; - if [ ! -d $path ]; then - mkdir $path; - fi -} - -function get_primary () -{ - get_aptcross_dir - if [ -f "$path/emsource.conf" ]; then - PRIMARY=`grep primary $path/emsource.conf|cut -d: -f2|tr -d ' '` - else - if [ -f "/etc/emsource.conf" ]; then - PRIMARY=`grep primary /etc/emsource.conf|cut -d: -f2|tr -d ' '` - else - PRIMARY="ftp.uk.debian.org" - fi - fi -} diff --git a/emrootfslib b/emrootfslib deleted file mode 100644 index ddc4d0c..0000000 --- a/emrootfslib +++ /dev/null @@ -1,721 +0,0 @@ -# emrootfslib : shell library to support root filesystems for Emdebian. -# -# This file is POSIX shell, compatible with debootstrap. -# Do not include or reference pbuilder functions or bash code here. -# -# Copyright (C) 2006-2010 Neil Williams -# -# 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 . -# - -# This shell library requires perl ! - -# Intended solely for use on the build machine. Do not use these functions -# in second_stage_install ! - -OURVERSION=`dpkg-query -W -f='${Version}' emdebian-rootfs` - -get_aptcross_dir () -{ - if [ -z "$HOME" -o ! -d "$HOME" ]; then - HOME="/tmp"; - fi - path="$HOME/.apt-cross"; - if [ ! -d "$path" ]; then - mkdir $path; - fi -} - -get_default_arch () -{ -if [ -f "/etc/dpkg-cross/cross-compile" ]; then - ARCH=`grep default_arch /etc/dpkg-cross/cross-compile|grep -v '^#'|cut -d'=' -f2` -fi -if [ -z "$ARCH" ]; then - ARCH="None" -fi -} - -get_work_dir () -{ - get_aptcross_dir - if [ -f "$path/emsource.conf" ]; then - WORKDIR=`grep workingdir $path/emsource.conf|cut -d: -f2|tr -d ' '` - else - if [ -f "/etc/emsource.conf" ]; then - WORKDIR=`grep workingdir /etc/emsource.conf|cut -d: -f2|tr -d ' '` - else - WORKDIR="/tmp" - fi - fi -} - -get_work_dir -get_default_arch - -WORKPLACE="${WORKDIR}/pbuilder" -BASETGZ="${WORKDIR}/emdebian.tgz" - -#pbuilder base values -DEBIAN_BUILDARCH=$ARCH -# cross-building chroot is same arch as host. -BUILDRESULT="$WORKPLACE/result/" -# tidy up // to / -BUILDRESULT=`echo $BUILDRESULT | tr -s \/` -APTCACHE="$WORKPLACE/aptcache/" -# tidy up // to / -APTCACHE=`echo $APTCACHE | tr -s \/` -AUTO_DEBSIGN=yes -APTCACHEHARDLINK="no" -BUILDPLACE="$WORKPLACE/build" - -# the default is to add a PID in the buildplace. -BASEBUILDPLACE="$BUILDPLACE" -if [ "${PRESERVE_BUILDPLACE}" != "yes" ]; then - BUILDPLACE="$BUILDPLACE/$$" -fi - -checkarch () -{ - ARCH=$ARCH perl -e 'use Debian::DpkgCross; $arch = $ENV{ARCH}; $arch=~s/ //g; \ - die "Unsupported architecture: $arch Use --arch\n" if (not defined (&check_arch($arch)));' -} - -create_emdebiantgz() { - ( - if ! cd "$BUILDPLACE"; then - echo "Error: unexpected error in chdir to $BUILDPLACE" >&2 - exit 1; - fi - while test -f "${BASETGZ}.tmp"; do - echo " -> Someone else has lock over ${BASETGZ}.tmp, waiting" - sleep 10s - done - echo " -> creating base tarball [${BASETGZ}]" - if ! sudo tar cfz "${BASETGZ}.tmp" * ; then - echo " -> failed building base tarball" - rm -f "${BASETGZ}.tmp" - exit 1; - fi - mv "${BASETGZ}.tmp" "${BASETGZ}" - ) -} - -check_dirs() -{ - if [ ! -d $BUILDPLACE ] ; then - mkdir -p $BUILDPLACE - fi - if [ ! -d $BUILDRESULT ] ; then - mkdir -p $BUILDRESULT - fi - if [ ! -d $APTCACHE ] ; then - mkdir -p $APTCACHE - fi -} - -disable_apt_recommends () { - if [ -d "$BUILDPLACE/etc/apt/apt.conf.d/" ]; then - if [ ! -f "$BUILDPLACE/etc/apt/apt.conf.d/10disablerecommends" ]; then - echo " -> disabling Apt::Install-Recommends" - cat > $BUILDPLACE/etc/apt/apt.conf.d/10disablerecommends << 'EOF' -APT -{ - Install-Recommends "false" -}; -EOF - fi - fi -} - -disable_apt_pdiffs () { - if [ -d "$BUILDPLACE/etc/apt/apt.conf.d/" ]; then - if [ ! -f "$BUILDPLACE/etc/apt/apt.conf.d/12disablepdiffs" ]; then - echo " -> disabling Apt::Acquire::PDiffs" - cat > $BUILDPLACE/etc/apt/apt.conf.d/12disablepdiffs << 'EOF' -APT -{ - Acquire::PDiffs "false"; -}; -EOF - fi - fi -} - -apt_autoremove_always () { - if [ -d "$BUILDPLACE/etc/apt/apt.conf.d/" ]; then - if [ ! -f "$BUILDPLACE/etc/apt/apt.conf.d/11always_autoremove" ]; then - echo " -> enabling Apt::AutomaticRemove" - cat > $BUILDPLACE/etc/apt/apt.conf.d/11always_autoremove << 'EOF' -APT -{ - AutomaticRemove "true" -}; -EOF - fi - fi -} - -unpack_debootstrap () { - info INSTCORE "Starting unpacking in $BUILDPLACE" - for deb in `ls $BUILDPLACE/var/cache/apt/archives/*.deb`; do - ver=`dpkg -f $deb Version` - pkg=`dpkg -f $deb Package` - info INSTCORE "Unpacking $pkg ($ver) ...." - dpkg -x $deb $BUILDPLACE/ - # get the package listing with reduced parsing complexity - mkdir $BUILDPLACE/listing - ar -p $deb data.tar.gz > $BUILDPLACE/listing/data.tar.gz - tar -tzf $BUILDPLACE/listing/data.tar.gz | sed -e 's/^\.//' | sed -e 's/^\/$/\/\./' | sed -e 's/\/$//' > $BUILDPLACE/var/lib/dpkg/info/${pkg}.list - rm -rf $BUILDPLACE/listing - rm -rf $BUILDPLACE/tmp/* - dpkg -e $deb $BUILDPLACE/tmp/ - for maint in `ls $BUILDPLACE/tmp/`; do - mv $BUILDPLACE/tmp/$maint $BUILDPLACE/var/lib/dpkg/info/$pkg.$maint - if [ $maint = "control" ]; then - grep -v "^$" $BUILDPLACE/var/lib/dpkg/info/$pkg.$maint >> $BUILDPLACE/var/lib/dpkg/available - grep -v "^$" $BUILDPLACE/var/lib/dpkg/info/$pkg.$maint >> $BUILDPLACE/var/lib/dpkg/status - echo "" >> $BUILDPLACE/var/lib/dpkg/available - echo "Status: install ok unpacked" >> $BUILDPLACE/var/lib/dpkg/status - rm $BUILDPLACE/var/lib/dpkg/info/$pkg.$maint - fi - # need a dpkg filter to make this stick - if [ $maint = "symbols" ]; then - rm $BUILDPLACE/var/lib/dpkg/info/$pkg.symbols - fi - done - if [ -f $BUILDPLACE/var/lib/dpkg/info/$pkg.conffiles ]; then - echo "Conffiles:" >> $BUILDPLACE/var/lib/dpkg/status - info INSTCORE "Processing $pkg.conffiles" - for line in `cat $BUILDPLACE/var/lib/dpkg/info/$pkg.conffiles`; do - md5=`md5sum $BUILDPLACE/$line | cut -d" " -f1` - echo " $line $md5" >> $BUILDPLACE/var/lib/dpkg/status - done - fi - echo "" >> $BUILDPLACE/var/lib/dpkg/status - done - if [ ! -e "$BUILDPLACE/etc/localtime" ]; then - ln -sf /usr/share/zoneinfo/UTC "$BUILDPLACE/etc/localtime" - fi - info INSTCORE "Removing archives..." - rm -f $BUILDPLACE/var/cache/apt/archives/*.deb - # (skip stages in emsecondstage) - touch $BUILDPLACE/debootstrap/unpacked -} - -busybox_symlinks () -{ - # busybox symlinks are best managed in postinst so that dpkg - # does not complain when they are replaced by Debian packages. - # this allows more applets to be supported by default. - if [ -f $BUILDPLACE/usr/share/busybox/busybox.links ]; then - cd $BUILDPLACE - # setup busybox - cp usr/share/busybox/busybox.links . - cp usr/share/busybox/install.sh . - # link in the rest of its applets from OUTSIDE the chroot - info INSTCORE "Symlinking the busybox applets..." - sh ./install.sh $BUILDPLACE/ --symlinks - rm $BUILDPLACE/install.sh - rm $BUILDPLACE/busybox.links - else - info INSTCORE "busybox configuration not required" - fi -} - -disable_invokercd () -{ - # invoke-rc.d is usually shell but is being looked at in Debian. - if [ ! -f $BUILDPLACE/usr/sbin/invoke-rc.d ]; then - echo '#!/bin/sh' > $BUILDPLACE/usr/sbin/invoke-rc.d - echo 'exec /etc/init.d/$1 $2' > $BUILDPLACE/usr/sbin/invoke-rc.d - echo '' >> $BUILDPLACE/usr/sbin/invoke-rc.d - chmod 755 $BUILDPLACE/usr/sbin/invoke-rc.d - fi -} - -disable_updatercd () -{ - # a better fix for /usr/sbin/update-rc.d is available via sysv-rc - if [ ! -f $BUILDPLACE/usr/sbin/update-rc.d ]; then - echo "#!/bin/sh" > $BUILDPLACE/usr/sbin/update-rc.d - echo "" >> $BUILDPLACE/usr/sbin/update-rc.d - chmod 755 $BUILDPLACE/usr/sbin/update-rc.d - fi - RC=`head $BUILDPLACE/usr/sbin/update-rc.d | grep /usr/bin/perl || true` - if [ "$RC" != "" ]; then - info INSTCORE "Replacing perl update-rc.d" - echo "#!/bin/sh" > $BUILDPLACE/usr/sbin/update-rc.d - echo "" >> $BUILDPLACE/usr/sbin/update-rc.d - chmod 755 $BUILDPLACE/usr/sbin/update-rc.d - fi -} - -extra_etc_rcd () -{ - if [ ! -d $BUILDPLACE/etc/rcS.d ]; then - mkdir $BUILDPLACE/etc/rcS.d - fi - if [ ! -d $BUILDPLACE/etc/rc0.d ]; then - mkdir $BUILDPLACE/etc/rc0.d - fi - if [ ! -d $BUILDPLACE/etc/rc1.d ]; then - mkdir $BUILDPLACE/etc/rc1.d - fi - if [ ! -d $BUILDPLACE/etc/rc6.d ]; then - mkdir $BUILDPLACE/etc/rc6.d - fi -} - -provide_var_lib_x11 () -{ - if [ ! -d $BUILDPLACE/var/lib/x11 ]; then - mkdir -p $BUILDPLACE/var/lib/x11 - fi -} - -basic_group_setup () { - if [ ! -f $BUILDPLACE/etc/group ]; then - echo \ -"root:x:0: -daemon:x:1: -bin:x:2: -sys:x:3: -adm:x:4: -tty:x:5: -disk:x:6: -lp:x:7: -mail:x:8: -news:x:9: -uucp:x:10: -man:x:12: -proxy:x:13: -kmem:x:15: -audio:x:29: -utmp:x:43: -video:x:44: -" > $BUILDPLACE/etc/group - fi -} - -basic_passwd_setup () { - if [ ! -f $BUILDPLACE/etc/passwd ]; then - echo \ -"root:x:0:0:root:/root:/bin/sh -daemon:x:1:1:daemon:/usr/sbin:/bin/sh -bin:x:2:2:bin:/bin:/bin/sh -sys:x:3:3:sys:/dev:/bin/sh -sync:x:4:65534:sync:/bin:/bin/sync -games:x:5:60:games:/usr/games:/bin/sh -man:x:6:12:man:/var/cache/man:/bin/sh -lp:x:7:7:lp:/var/spool/lpd:/bin/sh -mail:x:8:8:mail:/var/mail:/bin/sh -news:x:9:9:news:/var/spool/news:/bin/sh -uucp:x:10:10:uucp:/var/spool/uucp:/bin/sh -proxy:x:13:13:proxy:/bin:/bin/sh -www-data:x:33:33:www-data:/var/www:/bin/sh -backup:x:34:34:backup:/var/backups:/bin/sh -list:x:38:38:Mailing List Manager:/var/list:/bin/sh -irc:x:39:39:ircd:/var/run/ircd:/bin/sh -gnats:x:41:41:Gnats Bug-Reporting System (admin):/var/lib/gnats:/bin/sh -nobody:x:65534:65534:nobody:/nonexistent:/bin/sh -" > $BUILDPLACE/etc/passwd - fi -} - -# need /etc/shadow too -basic_shadow_setup () { - if [ ! -f $BUILDPLACE/etc/shadow ]; then - echo \ -"root:$1$Vu4M34LT$0L2BfH9nXbSG1zQWxUH8M1:0:::::: -daemon:*:13896:0:99999:7::: -bin:*:0:0:99999:7::: -sys:*:0:0:99999:7::: -sync:*:0:0:99999:7::: -games:*:0:0:99999:7::: -man:*:0:0:99999:7::: -lp:*:0:0:99999:7::: -mail:*:0:0:99999:7::: -news:*:0:0:99999:7::: -uucp:*:0:0:99999:7::: -proxy:*:0:0:99999:7::: -www-data:*:0:0:99999:7::: -backup:*:0:0:99999:7::: -list:*:0:0:99999:7::: -irc:*:0:0:99999:7::: -gnats:*:0:0:99999:7::: -nobody:*:0:0:99999:7:::" > $BUILDPLACE/etc/shadow - fi -} - -provide_empty_adduser () -{ - if [ ! -f $BUILDPLACE/usr/sbin/adduser ]; then - echo \ -'#!/bin/sh - -' > $BUILDPLACE/usr/sbin/adduser - chmod 755 $BUILDPLACE/usr/sbin/adduser - fi - if [ ! -f $BUILDPLACE/usr/sbin/deluser ]; then - echo \ -'#!/bin/sh - -' > $BUILDPLACE/usr/sbin/deluser - chmod 755 $BUILDPLACE/usr/sbin/deluser - fi -} - -provide_empty_addgroup () -{ - if [ ! -f $BUILDPLACE/usr/sbin/addgroup ]; then - echo \ -'#!/bin/sh - -' > $BUILDPLACE/usr/sbin/addgroup - chmod 755 $BUILDPLACE/usr/sbin/addgroup - fi - if [ ! -f $BUILDPLACE/usr/sbin/delgroup ]; then - echo \ -'#!/bin/sh - -' > $BUILDPLACE/usr/sbin/delgroup - chmod 755 $BUILDPLACE/usr/sbin/delgroup - fi -} - -provide_empty_dpkg_divert () -{ - if [ ! -f $BUILDPLACE/usr/bin/dpkg-divert ]; then - echo \ -'#!/bin/sh - -' > $BUILDPLACE/usr/bin/dpkg-divert - chmod 755 $BUILDPLACE/usr/bin/dpkg-divert - fi -} - -provide_empty_install_info () { - if [ ! -f $BUILDPLACE/usr/sbin/install-info ]; then - echo \ -'#!/bin/sh -exec /etc/init.d/$1 $2 -' > $BUILDPLACE/usr/sbin/install-info - chmod 755 $BUILDPLACE/usr/sbin/install-info - fi -} - -set_approx_time () { - if [ -d $BUILDPLACE/bin ]; then - DATE=`date` - ZERO=`date -d@0` - # if we have a usable date, store it. - if [ "$DATE" != "$ZERO" ]; then - APPROX=`stat -c%Y $BUILDPLACE/bin/` - STR=`date -d@$APPROX +%m%d%H%M%Y` - info INSTCORE "Storing approximate time '$STR' in './datestring'" - echo "$STR" > $BUILDPLACE/datestring - fi - fi -} - -basic_etc_fstab () { - if [ ! -f "$BUILDPLACE/etc/fstab" ]; then - cat > $BUILDPLACE/etc/fstab << 'EOF' -# /etc/fstab: static file system information. -# -# -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 -# -# 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 -} diff --git a/emsandbox b/emsandbox deleted file mode 100755 index f3efa28..0000000 --- a/emsandbox +++ /dev/null @@ -1,172 +0,0 @@ -#!/bin/bash -set -e -# emsandbox : emdebian roots creation. -# -# Copyright (C) 2006-2008 Neil Williams -# -# 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 . -# - -# the name is not finalised -PROG=emsandbox - -function usagehelp () { - # print out help message - cat < embootstrap complete" -else - /usr/share/emdebian-tools/embootstrap --arch $ARCH --cross $CUSTOM -fi diff --git a/emsecondstage b/emsecondstage deleted file mode 100755 index c519bc6..0000000 --- a/emsecondstage +++ /dev/null @@ -1,133 +0,0 @@ -#!/bin/sh - -set -e -# emsandbox : emdebian rootfs installer -# -# Copyright (C) 2007-2008 Neil Williams -# -# 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 . - -# 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 < 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." diff --git a/multistrap b/multistrap index d2dd4d1..acee770 100755 --- a/multistrap +++ b/multistrap @@ -1,10 +1,1102 @@ #!/usr/bin/perl +# Copyright (C) 2009, 2010 Neil Williams +# +# 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 . + use strict; use warnings; +use IO::File; +use Config::Auto; +use File::Basename; +use Parse::Debian::Packages; +use POSIX qw(locale_h); +use Locale::gettext; + +use vars qw/ $progname $ourversion $dstrap $extra @aptsources $mirror + @archives $deb $cachedir $config_str %packages $retval $str $retries + $dir $include $arch $foreign $suite $url $unpack $sourcedir $msg $etcdir + @e $sourcesname $libdir $dpkgdir @debootstrap %suites %components + $component $repo @dirs @touch %sources $section %keys $host $key $value + $type $file $config $tidy $noauth $keyring %keyrings $deflist + @extrapkgs @includes %source $setupsh $configsh $omitrequired /; + +setlocale(LC_MESSAGES, ""); +textdomain("multistrap"); +$progname = basename($0); +$ourversion = &our_version(); +$unpack = "true"; + +while( @ARGV ) { + $_= shift( @ARGV ); + last if m/^--$/; + if (!/^-/) { + unshift(@ARGV,$_); + last; + } + elsif (/^(-\?|-h|--help|--version)$/) { + &usageversion(); + exit( 0 ); + } + elsif (/^(-f|--file)$/) { + $file = shift(@ARGV); + } + elsif (/^(-a|--arch)$/) { + $arch = shift(@ARGV); + } + elsif (/^(-d|--dir)$/) { + $dir = shift(@ARGV); + $dir .= ($dir =~ m:/$:) ? '' : "/"; + } + elsif (/^(--tidy-up)$/) { + $tidy++; + } + elsif (/^(--source-dir)$/) { + $sourcedir = shift (@ARGV); + $sourcedir .= ($sourcedir =~ m:/$:) ? '' : "/"; + $sourcedir = (-d $sourcedir) ? $sourcedir : undef; + } + elsif (/^(--no-auth)$/) { + $noauth++; + } + else { + die "$progname: "._g("Unknown option")." $_.\n"; + } +} +$msg = sprintf (_g("Need a configuration file - use %s -f\n"), $progname); +die ($msg) + if (not defined $file); + +$cfgdir=dirname($file); +cascade($file); +foreach my $inc (@includes) +{ + $chk = `realpath $cfgdir/$inc 2>/dev/null`; + next if ($chk =~ /^\n?$/); + chomp ($chk); + printf (_g("%s %s using %s\n"), $progname, $ourversion, $chk); + cascade($chk); +} + +# Translators: fields are: programname, versionstring, configfile. +printf (_g("%s %s using %s\n"), $progname, $ourversion, $file); +$host = `dpkg-architecture -qDEB_BUILD_ARCH`; +chomp ($host); +if (not defined $arch) +{ + $arch = $host; + printf (_g("Defaulting architecture to native: %s\n"),$arch); +} +elsif ($arch eq $host) +{ + printf (_g("Defaulting architecture to native: %s\n"),$arch); +} +else +{ + printf (_g("Using foreign architecture: %s\n"), $arch); +} +$foreign++ if ($host ne $arch); + +unless (keys %sources and @aptsources) +{ + my $msg = sprintf(_g("No sources defined for a foreign multistrap. + Using your existing apt sources. To use different sources, + list them with aptsources= in '%s'."), $file); + warn ("$progname: $msg\n"); + $deflist = prepare_sources_list(); +} + +# Translators: fields are: programname, architecture, host architecture. +printf (_g("%s building %s multistrap on '%s'\n"), $progname, $arch, $host); +$cachedir = "var/cache/apt/"; # archives +$libdir = "var/lib/apt/"; # lists +$etcdir = "etc/apt/"; # sources +$dpkgdir = "var/lib/dpkg/"; # state + +if (not -d "$dir") +{ + my $ret = mkdir ("$dir"); + die ("Unable to create directory '$dir' $!\n") + if ($ret == 0); +} +$dir = `realpath $dir`; +chomp ($dir); +$dir .= ($dir =~ m:/$:) ? '' : "/"; +system ("mkdir -p ${dir}${cachedir}") if (not -d "${dir}${cachedir}"); +system ("mkdir -p ${dir}${libdir}") if (not -d "${dir}${libdir}"); +system ("mkdir -p ${dir}${dpkgdir}") if (not -d "${dir}${dpkgdir}"); +system ("mkdir -p ${dir}etc/apt/sources.list.d/") + if (not -d "${dir}etc/apt/sources.list.d/"); +system ("mkdir -p ${dir}etc/apt/preferences.d/") + if (not -d "${dir}etc/apt/preferences.d/"); +system ("mkdir -p ${dir}usr/share/info/dir") + if (not -d "${dir}usr/share/info/dir"); +#system ("mkdir -p ${dir}/usr/share/doc/gcc-4.2-base/") +# if (not -d "${dir}/usr/share/doc/gcc-4.2-base/"); +#system ("touch ${dir}/usr/share/doc/gcc-4.2-base/.copyright"); +#system ("touch ${dir}/usr/share/doc/gcc-4.2-base/#changelog.Debian.gz"); +my $msg = sprintf(_g("Unable to create directory '%s'\n"), "${dir}etc/apt/preferences.d/"); +die ($msg) + if (not -d "${dir}etc/apt/preferences.d/"); + +@dirs = qw/ alternatives info parts updates/; +@touch = qw/ diversions statoverride status lock/; +foreach my $dpkgd (@dirs) { + if (not -d "${dir}${dpkgdir}$dpkgd") { + mkdir "${dir}${dpkgdir}$dpkgd"; + } +} +foreach my $file (@touch) { + utime(time, time, "${dir}${dpkgdir}/$file") or ( + open(F, ">${dir}${dpkgdir}/$file") && close F ); +} +utime(time, time, "${dir}etc/shells") or + (open(F, ">${dir}etc/shells") && close F ); + +if (not -d "${dir}etc/network") { + mkdir "${dir}etc/network"; +} + +if (not -d "${dir}dev") { + mkdir "${dir}dev"; +} + +# prevent the absolute symlink in libc6 from allowing +# writes outside the multistrap root dir. See: #553599 +if (-l "${dir}lib64" ) { + my $r = readlink "${dir}lib64"; + if ($r =~ m:^/:) + { + my $old = `pwd`; + chomp ($old); + unlink "${dir}lib64"; + chdir ("$dir"); + print _g("INF: ./lib64 -> /lib symbolic link reset to ./lib.\n"); + symlink "./lib", "lib64"; + chdir ("${old}"); + } +} +else +{ + my $old = `pwd`; + chomp ($old); + chdir ("$dir"); + print _g("INF: Setting ./lib64 -> ./lib symbolic link.\n"); + symlink "./lib", "lib64"; + chdir ("${old}"); +} + +unlink ("${dir}etc/apt/sources.list.d/multistrap.sources.list") + if (-f "${dir}etc/apt/sources.list.d/multistrap.sources.list"); +unlink ("${dir}etc/apt/sources.list") + if (-f "${dir}etc/apt/sources.list"); + +foreach $repo (sort keys %suites) +{ + if (not -e "${dir}${cachedir}") { + mkdir "${dir}${cachedir}"; + } + if (not -e "$dir/${libdir}lists") { + mkdir "$dir/${libdir}lists"; + } + if (not -e "$dir/${libdir}lists/partial") { + mkdir "$dir/${libdir}lists/partial"; + } + if (not -e "$dir/${cachedir}archives") { + mkdir "$dir/${cachedir}archives"; + } + if (not -e "$dir/${cachedir}archives/partial") { + mkdir "$dir/${cachedir}archives/partial"; + } +} +foreach my $aptsrc (@aptsources) +{ + if (defined $deflist) + { + open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap.sources.list") + or die _g("Cannot open sources list"). $!; + print SOURCES $deflist; + close SOURCES; + } + elsif (-d "${dir}etc/apt/") + { + open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap.sources.list") + or die _g("Cannot open sources list"). $!; + $mirror = $sources{$aptsrc}; + $suite = $suites{$aptsrc}; + $component = (defined $components{$aptsrc}) ? $components{$aptsrc} : "main"; + print SOURCES< /lib symbolic link reset to ./lib after unpacking.\n"); + printf (_g("ERR: Some files may have been unpacked outside %s!\n"), $dir); + } + else + { + printf (_g("\nMultistrap system installed successfully in %s.\n\n"), $dir); + } +} +unlink ("${dir}etc/apt/sources.list.d/multistrap.sources.list") + if (-f "${dir}etc/apt/sources.list.d/multistrap.sources.list"); +foreach my $aptsrc (@aptsources) +{ + if (defined $deflist) + { + open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap.sources.list") + or die _g("Cannot open sources list"). $!; + print SOURCES $deflist; + close SOURCES; + } + elsif (-d "${dir}etc/apt/") + { + open (SOURCES, ">>${dir}etc/apt/sources.list.d/multistrap.sources.list") + or die _g("Cannot open sources list"). $!; + $mirror = $sources{$aptsrc}; + $suite = $suites{$aptsrc}; + $component = (defined $components{$aptsrc}) ? $components{$aptsrc} : "main"; + print SOURCES<${dir}${libdir}lists/lock"); + close (LOCK); + opendir (DEBS, "${dir}${cachedir}archives/") + or die (_g("Cannot read apt archives directory.\n")); + @archives=grep(/.*\.deb$/, readdir DEBS); + closedir (DEBS); + } + my $old = `pwd`; + chomp ($old); + chdir ("${dir}"); + printf (_g("Using directory %s for unpacking operations\n"), ${dir}); + foreach $deb (sort @archives) + { + printf (_g("I: Extracting %s...\n"), $deb); + my $ver=`LC_ALL=C dpkg -f ./${cachedir}archives/$deb Version`; + my $pkg=`LC_ALL=C dpkg -f ./${cachedir}archives/$deb Package`; + chomp ($ver); + chomp ($pkg); + mkdir ("./tmp"); + my $tmpdir = `mktemp -p ./tmp -d -t multistrap.XXXXXX`; + chomp ($tmpdir); + my $datatar = `LC_ALL=C dpkg -X ./${cachedir}archives/$deb ${dir}`; + my $exit = `echo $?`; + chomp ($exit); + if ($exit ne "0") + { + printf(_g("dpkg -X failed with error code %s\nSkipping...\n"), $exit); + next; + } + my @lines = split("\n", $datatar); + open (LIST, ">>./${dpkgdir}info/${pkg}.list"); + foreach my $l (@lines) + { + chomp ($l); + $l =~ s:^\.::; + $l =~ s:^/$:/\.:; + $l =~ s:/$::; + print LIST "$l\n"; + } + close (LIST); + system ("dpkg -e ./${cachedir}archives/$deb ${tmpdir}/"); + opendir (MAINT, "./${tmpdir}"); + my @maint=grep(!m:\.\.?:, readdir (MAINT)); + closedir (MAINT); + open (AVAIL, ">>./${dpkgdir}available"); + open (STATUS, ">>./${dpkgdir}status"); + foreach my $mscript (@maint) + { + rename "./${tmpdir}/$mscript", "./${dpkgdir}info/$pkg.$mscript"; + if ( $mscript eq "control" ) + { + open (MSCRIPT, "./${dpkgdir}info/$pkg.$mscript"); + my @scr=; + close (MSCRIPT); + my @avail = grep(!/^$/, @scr); + print AVAIL @avail; + print STATUS @avail; + print AVAIL "\n"; + print STATUS "Status: install ok unpacked\n"; + unlink ("./${dpkgdir}info/$mscript"); + } + } + close (AVAIL); + if ( -f "./${dpkgdir}info/$pkg.conffiles") + { + print STATUS "Conffiles:\n"; + printf (_g(" -> Processing conffiles for %s\n"), $pkg); + open (CONF, "./${dpkgdir}info/$pkg.conffiles"); + my @lines=; + close (CONF); + foreach my $line (@lines) + { + chomp ($line); + my $md5=`LC_ALL=C md5sum ./$line | cut -d" " -f1`; + chomp ($md5); + print STATUS " $line $md5\n"; + } + } + print STATUS "\n"; + close (STATUS); + system ("rm -rf ./${tmpdir}"); + if (-l "${dir}lib64" ) { + my $r = readlink "${dir}lib64"; + if ($r =~ m:^/:) + { + my $old = `pwd`; + chomp ($old); + printf (_g("ERR: lib64 -> ./lib symbolic link clobbered by %s\n"), $pkg); + unlink "${dir}lib64"; + chdir ("$dir"); + print _g("INF: lib64 -> /lib symbolic link reset to ./lib.\n"); + symlink "./lib", "lib64"; + chdir ("${old}"); + } + } + } + chdir ("$old"); + print _g("I: Unpacking complete.\n"); +} + +sub check_bin_sh +{ + $dir = shift; + my $old = `pwd`; + chomp ($old); + # dash refuses to configure if no existing shell is found. + # (always expects a diversion to already exist). + # (works OK in subsequent upgrades.) #546528 + unlink ("$dir/var/lib/dpkg/info/dash.postinst"); + # now ensure that a usable shell is available as /bin/sh + if (not -l "$dir/bin/sh") + { + print (_g("ERR: ./bin/sh symbolic link does not exist.\n")); + if (-f "$dir/bin/dash") + { + print (_g("INF: Setting ./bin/sh -> ./bin/dash\n")); + chdir ("$dir/bin"); + symlink ("dash", "sh"); + chdir ("$old"); + } + elsif (-f "$dir/bin/bash") + { + print (_g("INF: ./bin/dash not found. Setting ./bin/sh -> ./bin/bash\n")); + chdir ("$dir/bin"); + symlink ("bash", "sh"); + chdir ("$old"); + } + } + if (-l "$dir/bin/sh") + { + print ("${dir}bin/sh found OK:\n"); + system ("(cd $dir ; ls -lh bin/sh)"); + } + else + { + die ("No shell."); + } +} + +sub tidy_apt +{ + print _g("I: Tidying up apt cache and list data.\n"); + unlink ("${dir}etc/apt/sources.list") + if (-f "${dir}etc/apt/sources.list"); + opendir (DEBS, "${dir}${libdir}lists/") + or die (_g("Cannot read apt lists directory.\n")); + my @lists=grep(!m:\.\.?$:, readdir DEBS); + closedir (DEBS); + foreach my $file (@lists) + { + next if (-d $file); + unlink ("${dir}${libdir}lists/$file"); + } + opendir (DEBS, "${dir}${cachedir}/") + or die (_g("Cannot read apt cache directory.\n")); + my @files=grep(!m:\.\.?$:, readdir DEBS); + closedir (DEBS); + foreach my $file (@files) + { + next if (-d $file); + next unless ($file =~ /\.bin$/); + unlink ("${dir}${cachedir}$file"); + } + if ($unpack eq "true") + { + opendir (DEBS, "${dir}${cachedir}/archives/") + or die (_g("Cannot read apt archives directory.\n")); + my @files=grep(!m:\.\.?$:, readdir DEBS); + closedir (DEBS); + foreach my $file (@files) + { + next if (-d $file); + next unless ($file =~ /\.deb$/); + (defined $sourcedir) ? + system ("mv ${dir}${cachedir}archives/$file $sourcedir/$file") : + unlink ("${dir}${cachedir}archives/$file"); + ; + } + } +} + +# if native arch, do a few tasks just because we can and probably should. +sub native +{ + print _g("I: Native mode - configuring unpacked packages . . .\n"); + my $e=`LC_ALL=C printenv`; + my $str = ($e =~ /\nUSER=root\n/) ? "" : "sudo"; + $str = (-f "/usr/bin/sudo") ? "$str" : ""; + my $env = "DEBIAN_FRONTEND=noninteractive ". + "DEBCONF_NONINTERACTIVE_SEEN=true ". + "LC_ALL=C LANGUAGE=C LANG=C"; + printf (_g("I: dpkg configuration settings:\n\t%s\n"), $env); + # check that we have a workable shell inside the chroot + &check_bin_sh("$dir"); + system ("$str $env chroot $dir dpkg --configure -a"); +} + +sub get_required_debs +{ + # emulate required="$(get_debs Priority: required)" + # from debootstrap/functions + # needs to be run after the first apt-get install so that + # Packages files exist + my @required=(); + my @debs=(); + opendir (PKGS, "${dir}${libdir}lists/") + or die sprintf(_g("Cannot open %s directory. %s\n"), + "${dir}${libdir}lists/", $!); + my @lists=grep(/_Packages$/, readdir (PKGS)); + closedir (PKGS); + foreach my $strap (@debootstrap) + { + my $s = lc($strap); + foreach my $l (@lists) + { + push (@required, $l); + } + } + foreach my $file (@required) + { + my $fh = IO::File->new("${dir}${libdir}lists/$file"); + my $parser = Parse::Debian::Packages->new( $fh ); + while (my %package = $parser->next) + { + next unless $package{'Priority'} eq "required"; + push @debs, $package{'Package'}; + } + } + return \@debs; +} + +# inherited from apt-cross +sub prepare_sources_list +{ + my @source_list=(); + # collate all available/configured sources into one list + if (-e "/etc/apt/sources.list") { + open (SOURCES, "/etc/apt/sources.list") + or die _g("cannot open apt sources list. %s",$!); + @source_list = ; + close (SOURCES); + } + if (-d "/etc/apt/sources.list.d/") { + opendir (FILES, "/etc/apt/sources.list.d/") + or die _g("cannot open apt sources.list directory %s\n",$!); + my @files = grep(!/^\.\.?$/, readdir FILES); + foreach my $f (@files) { + next if ($f =~ /\.ucf-old$/); + open (SOURCES, "/etc/apt/sources.list.d/$f") or + die _g("cannot open /etc/apt/sources.list.d/%s %s",$f, $!); + while() { + push @source_list, $_; + } + close (SOURCES); + } + closedir (FILES); + } + return \@source_list; +} + +sub usageversion { + printf STDERR (_g(" +%s version %s + +Usage: + %s [-a ARCH] [-d DIR] -f CONFIG_FILE + %s -?|-h|--help|--version + +Command: + -f|--file CONFIG_FILE: path the the multistrap configuration file. + +Options: + -a|--arch ARCHITECTURE: override the configuration file architecture. + -d|--dir PATH: override the configuration file directory. + --no-auth: do not use Secure Apt for any repositories + --tidy-up: remove apt cache data and downloaded archives. + -?|-h|--help: print this usage message and exit + --version: print this usage message and exit + +%s extends debootstrap to provide support for multiple +repositories, using a configuration file to specify the relevant suites, +architecture, extra packages and the mirror to use for each repository. + +Example configuration: +[General] +arch=armel +directory=/opt/multistrap/ +# same as --tidy-up option if set to true +cleanup=true +# same as --no-auth option if set to true +# keyring packages listed in each debootstrap will +# still be installed. +noauth=false +# extract all downloaded archives (default is true) +unpack=true +# aptsources is a list of sections to be used for downloading packages +# and lists and placed in the /etc/apt/sources.list.d/multistrap.sources.list +# of the target. Order is not important +aptsources=Grip Updates +# the order of sections is not important. +# the debootstrap option determines which repository +# is used to calculate the list of Priority: required packages. +debootstrap=Debian + +[Debian] +packages= +source=http://ftp.uk.debian.org/debian +keyring=debian-archive-keyring +suite=lenny + +This will result in a completely normal debootstrap of Debian lenny from +the specified mirror, for armel in /opt/multistrap/. + +'Architecture' and 'directory' can be overridden on the command line. + +Specify a package to extend the debootstap to include that package and +all dependencies. Dependencies will be calculated by apt so as to use +only the most recent suitable version from all configured repositories. + +General settings: + +'directory' specifies the top level directory where the debootstrap +will be created - it is not packed into a .tgz once complete. + +"), $progname, $ourversion, $progname, $progname, $progname) + or die ("$progname: ". _g("failed to write usage:") . "$!\n"); +} + +sub cascade +{ + $file = shift; + $config = Config::Auto::parse($file); + foreach $key (%$config) + { + $type = lc($key) if (ref $key ne "HASH"); + $value = $key if (ref $key eq "HASH"); + $keys{$type} = $value; + } + + foreach $section (sort keys %keys) + { + if ($section eq "general") + { + $arch = $keys{$section}{'arch'} + if (defined $keys{$section}{'arch'} + and (not defined $arch)); + $dir = $keys{$section}{'directory'} + if (defined $keys{$section}{'directory'} + and (not defined $dir)); + # support the original value but replace by new value. + $unpack = lc($keys{$section}{'unpack'}) + if (defined $keys{$section}{'forceunpack'} + and (not defined $unpack)); + $unpack = lc($keys{$section}{'unpack'}) + if (defined $keys{$section}{'unpack'} + and (not defined $unpack)); + $configsh = lc($keys{$section}{'configscript'}) + if (defined $keys{$section}{'configscript'} + and (not defined $configsh)); + $setupsh = lc($keys{$section}{'setupscript'}) + if (defined $keys{$section}{'setupscript'} + and (not defined $setupsh)); + $omitrequired = lc($keys{$section}{'omitrequired'}) + if (defined $keys{$section}{'omitrequired'} + and (not defined $omitrequired)); + $tidy++ if ((defined $keys{$section}{'cleanup'}) and + ($keys{$section}{'cleanup'} eq "true") and + (defined $tidy)); + $noauth++ if ((defined $keys{$section}{'noauth'}) and + ($keys{$section}{'noauth'} eq "true") and + (defined $noauth)); + $sourcedir = $keys{$section}{'retainsources'} if + ((defined $keys{$section}{'retainsources'}) and + (-d $keys{$section}{'retainsources'})); + my @d = split(' ', lc($keys{$section}{'debootstrap'})); + push @debootstrap, @d; + my @a = split (' ', lc($keys{$section}{'aptsources'})); + push @aptsources, @a; + my @i = split (' ', lc($keys{$section}{'include'})); + push @includes, @i; + } + else + { + $sources{$section}=$keys{$section}{'source'} + if (not exists $source{$section}); + $packages{$section}=$keys{$section}{'packages'} + if (not exists $packages{$section}); + $suites{$section}=$keys{$section}{'suite'} + if (not exists $suites{$section}); + $components{$section}=$keys{$section}{'components'} + if (not exists $components{$section}); + if (not defined $components{$section}) + { + $components{$section}='main'; + } + $keyrings{$section}=$keys{$section}{'keyring'} + if (not exists $keyrings{$section}); + push @extrapkgs, split (' ', lc($keys{$section}{'additional'})); + } + } +} + +sub _g { + return gettext(shift); +} + +=pod + +=head1 Name + +multistrap - extends debootstrap for multiple repository support + +=head1 Synopsis + + multistrap [-a ARCH] [-d DIR] -f CONFIG_FILE + multistrap -?|-h|--help|--version + +=head1 Options + +(These options can also be set in the configuration file.) + +--tidy-up - remove apt cache data, downloaded Packages files and +the apt package cache. Same as cleanup=true. + +--no-auth - allow the use of unauthenticated repositories. Same +as noauth=true + +=head1 Description + +multistrap provides a debootstrap-like method based on apt and +extended to provide support for multiple repositories, using a +configuration file to specify the relevant suites, architecture, +extra packages and the mirror to use for each debootstrap. + +The aim is to create a complete debootstrap with all packages +installed and configured, instead of just the base system. + +Example configuration: + + [General] + arch=armel + directory=/opt/multistrap/ + # same as --tidy-up option if set to true + cleanup=true + # same as --no-auth option if set to true + # keyring packages listed in each debootstrap will + # still be installed. + noauth=false + # extract all downloaded archives (default is true) + unpack=true + # aptsources is a list of sections to be used for downloading packages + # and lists and placed in the /etc/apt/sources.list.d/multistrap.sources.list + # of the target. Order is not important + aptsources=Grip Updates + # the order of sections is not important. + # the debootstrap option determines which repository + # is used to calculate the list of Priority: required packages. + debootstrap=Debian + + [Debian] + packages= + source=http://ftp.uk.debian.org/debian + keyring=debian-archive-keyring + suite=lenny + +This will result in a completely normal debootstrap of Debian lenny from +the specified mirror, for armel in '/opt/multistrap/'. + +Specify a package to extend the multistrap to include that package and +all dependencies. + +Specify more debootstraps by adding new sections. Section names are used +in the debootstrap general option. + +Section names are case-insensitive. + +e.g. change + + debootstrap=Debian + +to + + debootstrap=Grip + +then add the new section for Grip: + + [Grip] + packages=locales + keyring=emdebian-archive-keyring + source=http://www.emdebian.org/grip + suite=lenny + +Setting Grip instead of Debian in the debootstrap option, as above, +will provide a base system from Emdebian Grip 1.0 and locate any +missing dependencies in Debian 5.0 Lenny, allowing you to add any +package(s) you need from Debian that are not yet in Emdebian Grip. + +All dependencies are resolved only by apt, using all configured +repositories, to use only the most recent and most suitable +dependencies. Note that multistrap turns off Install-Recommends +so if the multistrap needs a package that is only a Recommended +dependency, the recommended package needs to be specified in the +packages line explicitly. + +'Architecture' and 'directory' can be overridden on the command line. +Other general options have command line options, except debootstrap +itself. + +=head1 General settings: + +'directory' specifies the top level directory where the debootstrap +will be created - it is not packed into a .tgz once complete. + +As with debootstrap, multistrap will continue after errors. + +multistrap does not currently implement the machine:variant support +used in Emdebian but the build directory is not packed up at the +end of the run so other scripts can be used to implement customisations. + +=head1 Secure Apt + +To use authenticated apt repositories, multistrap either needs to be +able to install an appropriate keyring package from the existing apt +sources *outside the multistrap environment* or have the relevant keys +already configured using apt-key *on the host system*. + +If relevant packages exist, specify them in the 'keyring' option for +each repository. multistrap will then check that apt has already +installed this package so that the repository can be authenticated +before any packages are downloaded from it. + +Note that *all* repositories to be used with multistrap must be +authenticated or apt will fail. Similarly, secure apt can only be +disabled for all repositories (by using the --no-auth command line +option or setting the general noauth option in the configuration +file), even if only one repository does not have a suitable keyring +available. Not all packages need keyring packages, if you configure +apt-key appropriately. + +The keyring package(s) will also be installed inside the multistrap +environment to match the installed apt sources for the multistrap. + +All configuration of apt-key needs to be done for the machine +running multistrap itself. + +=head1 State + +multistrap is stateless - if the directory exists, it will simply +proceed as normal and apt will try to pick up where it left off. + +=head1 Configuration + +multistrap unpacks the downloaded packages but other stages of +system configuration are not attempted. Examples include: + + /etc/inittab + /etc/fstab + /etc/hosts + /etc/securetty + /etc/modules + /etc/hostname + /etc/network/interfaces + /etc/init.d + /etc/dhcp3 + +Any device-specific device nodes will also need to be created +using MAKEDEV. + +As an alternative, multistrap includes a device-table.pl helper +script that can work around some of the issues with MAKEDEV. +device-table.pl requires a device table file along the lines of +the one in the mtd-utils source package. + +Once multistrap has successfully created the basic file and +directory layout, other device-specific scripts are needed before +the filesystem can be packaged up and installed onto the +target device. + +Once installed, the packages themselves need to be configured +using the package maintainer scripts and C, +unless this is a native multistrap. + +For C to work, F and F must be mounted (or +mountable), F is also recommended. + +See also: http://wiki.debian.org/Multistrap + +=head1 Environment + +To configure the unpacked packages (whether in native or cross mode), +certain environment variables are needed: + +Debconf needs to be told to accept that user interaction is not +desired: + + DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true + +Perl needs to be told to accept that no locales are available inside +the chroot and not to complain: + + LC_ALL=C LANGUAGE=C LANG=C + +Then, dpkg can configure the packages: + +chroot method (PATH = top directory of chroot): + + DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true \ + LC_ALL=C LANGUAGE=C LANG=C chroot /PATH/ dpkg --configure -a + +at a login shell: + + # export DEBIAN_FRONTEND=noninteractive DEBCONF_NONINTERACTIVE_SEEN=true + # export LC_ALL=C LANGUAGE=C LANG=C + # dpkg --configure -a + +(As above, dpkg needs F and F mounted first.) + +=head1 Native mode - multistrap + +multistrap was not intended for native support, it was developed for +cross architecture support. In order for multiple repositories to be +used, multistrap only unpacks the packages selected by apt. + +In native mode, various post-multistrap operations are likely to be +needed that debootstrap would do for you: + + 1. copy /etc/hosts into the chroot + 2. clean the environment to unset LANGUAGE, LC_ALL and LANG + to silence nuisance perl warnings that obscure other errors + +(An alternative to unset the localisation variables is to add +locales to your multistrap configuration file in the 'packages' +option. + +A native multistrap can be used directly with chroot, so +C runs C at the end of the +multistrap process. + +=head1 Cascading configuration + +=head1 Machine:variant support + +The old packages.conf variables from emsandbox can all be converted +into C configuration variables. The machine:variant +support in C concentrates on the scripts, +F and F + +Once C has unpacked the downloaded packages, the +C can be called, passing the location and architecture of +the root filesystem, so that other fine tuning can take place. At +this stage, any operations inside the rootfs must not try to execute +any binaries within the rootfs. As the final stage of the multistrap +process, C is copied into the F +directory of the rootfs. + +One advantage of using machine:variant support is that the entire +rootfilesystem can be managed by a single call to multistrap - this +is useful when building root filesystems in userspace. + +=head1 Restricting package selection + +C includes Required packages by default, the current list +of packages can be seen using: + + grep-available -FPriority 'required' -sPackage -# Eventually, this will replace the em_ one or call em_ with -# --arch and take over native duties. +If the OmitRequired option is set to true, these packages will not be +added - whilst useful, this option can easily lead to a useless +rootfs. Only the packages specified manually in the configuration +files will be used in the calculations - dependencies of those packages +will be added but no others. -my $str = join(" ", @ARGV); -system ("/usr/sbin/em_multistrap $str"); +=cut diff --git a/po/POTFILES.in b/po/POTFILES.in index c569ba1..f21bc82 100644 --- a/po/POTFILES.in +++ b/po/POTFILES.in @@ -1 +1 @@ -em_multistrap +multistrap diff --git a/po4a-build.conf b/po4a-build.conf index cb17d0c..170c4e9 100644 --- a/po4a-build.conf +++ b/po4a-build.conf @@ -5,25 +5,25 @@ CONFIG="doc/po4a.config" # PODIR po directory for manpages/docs PODIR="doc/po" # POTFILE path -POTFILE="doc/po/emdebian-rootfs.pot" +POTFILE="doc/po/multistrap.pot" # base directory for generated files, e.g. doc BASEDIR="doc" # the binary packages that will contain generated manpages -BINARIES="emdebian-rootfs multistrap" +BINARIES="multistrap" # the Docbook XML manpages for Section 3. -XMLMAN3="empbuilderlib.3.xml emrootfslib.3.xml" +XMLMAN3="" # the binary packages using DocBook XML & xsltproc -XMLPACKAGES="emdebian-rootfs" +XMLPACKAGES="" # the DocBook XML files for Section 1. -XMLMAN1="emsandbox.1.xml" +XMLMAN1="" # the pattern to find the XML files -XMLDIR="doc/xml/" +XMLDIR="" # the pattern to find the .docbook files DOCBOOKDIR="" # the XSL file to use for Docbook XSL XSLFILE="http://docbook.sourceforge.net/release/xsl/current/manpages/docbook.xsl" # the POD files for man1 -PODFILE="em_multistrap" +PODFILE="multistrap" # the POD files for man3/ - module names regenerated from the path. PODMODULES="" # POD files for section 7