
commit
f45e6190c0
27 changed files with 5891 additions and 0 deletions
@ -0,0 +1,102 @@ |
|||
CC=gcc |
|||
CFLAGS=-Wall -W -O2 |
|||
|
|||
ARCH := $(shell dpkg --print-architecture) |
|||
setarchdevs = $(if $(findstring $(ARCH),$(1)),$(2)) |
|||
|
|||
DEVS := generic hde hdf hdg hdh sde sdf sdg sdh scd-all initrd input usb md lp rtc video \
|
|||
$(call setarchdevs,i386,isdn-io eda edb sonycd mcd mcdx cdu535 \
|
|||
optcd sjcd cm206cd gscd lmscd sbpcd \
|
|||
aztcd bpcd dac960 ida fd0 fd1 ataraid cciss) \
|
|||
$(call setarchdevs,sparc,hdc hdd busmice) \
|
|||
$(call setarchdevs,m68k,fd0 fd1 adc add ade adf hdc hdd) \
|
|||
$(call setarchdevs,powerpc,hdc hdd fd0 fd1 isdn-io m68k-mice) \
|
|||
$(call setarchdevs,ia64,ida fd0 fd1 ataraid cciss) |
|||
|
|||
all: pkgdetails devices-std.tar.gz devices.tar.gz debootstrap-arch |
|||
clean: |
|||
rm -f pkgdetails pkgdetails.o devices-std.tar.gz devices.tar.gz |
|||
rm -f debootstrap-arch |
|||
rm -rf dev |
|||
|
|||
DSDIR=$(DESTDIR)/usr/lib/debootstrap |
|||
install: |
|||
mkdir -p $(DSDIR)/scripts |
|||
mkdir -p $(DESTDIR)/usr/sbin |
|||
mkdir -p $(DESTDIR)/usr/share/man/man8 |
|||
install -o root -g root -m 0644 potato $(DSDIR)/scripts/ |
|||
install -o root -g root -m 0644 woody $(DSDIR)/scripts/ |
|||
install -o root -g root -m 0644 woody.buildd $(DSDIR)/scripts/ |
|||
install -o root -g root -m 0644 sarge $(DSDIR)/scripts/ |
|||
install -o root -g root -m 0644 sarge.buildd $(DSDIR)/scripts/ |
|||
install -o root -g root -m 0644 sarge.fakechroot $(DSDIR)/scripts/ |
|||
install -o root -g root -m 0644 sid $(DSDIR)/scripts/ |
|||
install -o root -g root -m 0644 warty $(DSDIR)/scripts/ |
|||
install -o root -g root -m 0644 warty.buildd $(DSDIR)/scripts/ |
|||
install -o root -g root -m 0644 hoary $(DSDIR)/scripts/ |
|||
install -o root -g root -m 0644 hoary.buildd $(DSDIR)/scripts/ |
|||
install -o root -g root -m 0644 breezy $(DSDIR)/scripts/ |
|||
install -o root -g root -m 0644 functions $(DSDIR)/ |
|||
|
|||
# no special script for etch anymore |
|||
ln -s sid $(DSDIR)/scripts/etch |
|||
ln -s sid $(DSDIR)/scripts/lenny |
|||
|
|||
install -o root -g root -m 0755 debootstrap.8 $(DESTDIR)/usr/share/man/man8/ |
|||
install -o root -g root -m 0755 debootstrap $(DESTDIR)/usr/sbin/ |
|||
|
|||
install-allarch: install |
|||
install -o root -g root -m 0644 devices-std.tar.gz \
|
|||
$(DSDIR)/devices.tar.gz |
|||
|
|||
install-arch: install |
|||
install -o root -g root -m 0755 pkgdetails $(DSDIR)/ |
|||
install -o root -g root -m 0644 devices.tar.gz $(DSDIR)/ |
|||
install -o root -g root -m 0644 debootstrap-arch $(DSDIR)/arch |
|||
|
|||
pkgdetails: pkgdetails.o |
|||
$(CC) -o $@ $^ |
|||
|
|||
debootstrap-arch: |
|||
echo $(ARCH) >debootstrap-arch |
|||
|
|||
devices-std.tar.gz: |
|||
rm -rf dev |
|||
mkdir -p dev |
|||
chown 0:0 dev |
|||
chmod 755 dev |
|||
(cd dev && /dev/MAKEDEV std ptmx) |
|||
tar cf - dev | gzip -9 >devices-std.tar.gz |
|||
rm -rf dev |
|||
|
|||
devices.tar.gz: |
|||
rm -rf dev |
|||
|
|||
mkdir -p dev |
|||
chown 0:0 dev |
|||
chmod 755 dev |
|||
|
|||
(cd dev && /dev/MAKEDEV $(DEVS)) |
|||
|
|||
ifeq ($(ARCH),powerpc) |
|||
# Maybe remove amiga/atari mice also? What about usbmouse?
|
|||
rm -f dev/adbmouse |
|||
ln -sf input/mice dev/mouse |
|||
ln -sf input/js0 dev/js0 |
|||
ln -sf input/js1 dev/js1 |
|||
endif |
|||
|
|||
@if ! find dev -maxdepth 0 -perm 755 -uid 0 -gid 0 | \
|
|||
grep -q "^dev$$"; \
|
|||
then \
|
|||
echo "======================================================="; \
|
|||
echo "ERROR"; echo; \
|
|||
echo "./dev has bad permissions! should be 755 root.root. Was:"; \
|
|||
ls -ld ./dev; \
|
|||
echo "======================================================="; \
|
|||
false; \
|
|||
fi |
|||
|
|||
tar cf - dev | gzip -9 >devices.tar.gz |
|||
rm -rf dev |
|||
|
@ -0,0 +1,20 @@ |
|||
|
|||
Features: |
|||
++ second stage via chroot debootstrap/debootstrap |
|||
++ debootstrap/deb file to record deb destinations/information |
|||
|
|||
-- configuration file |
|||
-- versus command line |
|||
-- support for sources (vs mirrors) |
|||
-- faux-pinning for packages |
|||
|
|||
++ merge variants into single script (optionally anyway) |
|||
++ makedev in second stage |
|||
++ awk/perl pkgdetails |
|||
++ granular dpkg progress bar |
|||
++ determine required/base dynamically |
|||
++ store required/base in $T/debootstrap for two-stage installs |
|||
|
|||
Packages format: |
|||
std: Priority: required + Priority: important |
|||
buildd: Priority: required + Build-Essential: yes |
@ -0,0 +1,162 @@ |
|||
mirror_style release |
|||
download_style apt |
|||
finddebs_style from-indices |
|||
variants - buildd |
|||
|
|||
work_out_debs () { |
|||
LIBC6=libc6 |
|||
if [ "$ARCH" = "alpha" -o "$ARCH" = "ia64" ]; then LIBC6="libc6.1"; fi |
|||
|
|||
required="$(get_debs Priority: required)" |
|||
|
|||
if doing_variant -; then |
|||
#required="$required $(get_debs Priority: important)" |
|||
# ^^ should be getting debconf here somehow maybe |
|||
base="$(get_debs Priority: important)" |
|||
elif doing_variant buildd; then |
|||
# TODO: add Build-Essential: yes extraoverrides |
|||
#base="$(get_debs Build-Essential: yes)" |
|||
|
|||
add () { if [ "$ARCH" = "$1" ]; then eval "$2=\"\$$2 $3\""; fi; } |
|||
|
|||
base="apt binutils cpio cpp cpp-4.0 dpkg-dev g++ g++-4.0 gcc gcc-4.0 gcc-4.0-base ${LIBC6}-dev libdb4.2 libgdbm3 libstdc++6 libstdc++6-4.0-dev linux-kernel-headers make patch perl perl-modules" |
|||
|
|||
add ia64 base "libunwind7-dev" |
|||
add sparc base "lib64gcc1" |
|||
add sparc base "libc6-dev-sparc64" |
|||
add sparc base "libc6-sparc64" |
|||
fi |
|||
} |
|||
|
|||
first_stage_install () { |
|||
extract $required |
|||
|
|||
mkdir -p "$TARGET/var/lib/dpkg" |
|||
: >"$TARGET/var/lib/dpkg/status" |
|||
echo >"$TARGET/var/lib/dpkg/available" |
|||
|
|||
setup_etc |
|||
if [ ! -e "$TARGET/etc/fstab" ]; then |
|||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" |
|||
chown 0.0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab" |
|||
fi |
|||
|
|||
setup_devices |
|||
|
|||
x_feign_install () { |
|||
local pkg="$1" |
|||
local deb="$(debfor $pkg)" |
|||
local ver="$( |
|||
ar -p "$TARGET/$deb" control.tar.gz | zcat | |
|||
tar -O -xf - control ./control 2>/dev/null | |
|||
sed -ne 's/^Version: *//Ip' | head -n 1 |
|||
)" |
|||
|
|||
mkdir -p "$TARGET/var/lib/dpkg/info" |
|||
|
|||
echo \ |
|||
"Package: $pkg |
|||
Version: $ver |
|||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" |
|||
|
|||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list" |
|||
} |
|||
|
|||
x_feign_install dpkg |
|||
} |
|||
|
|||
second_stage_install () { |
|||
x_core_install () { |
|||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") |
|||
} |
|||
|
|||
p () { |
|||
baseprog="$(($baseprog + ${1:-1}))" |
|||
} |
|||
|
|||
setup_proc |
|||
in_target /sbin/ldconfig |
|||
|
|||
DEBIAN_FRONTEND=noninteractive |
|||
DEBCONF_NONINTERACTIVE_SEEN=true |
|||
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN |
|||
|
|||
baseprog=0 |
|||
bases=7 |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #1 |
|||
info INSTCORE "Installing core packages..." |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #2 |
|||
ln -sf mawk $TARGET/usr/bin/awk |
|||
x_core_install base-files base-passwd |
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #3 |
|||
x_core_install dpkg |
|||
|
|||
if [ ! -e "$TARGET/etc/localtime" ]; then |
|||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" |
|||
fi |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #4 |
|||
x_core_install $LIBC6 |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #5 |
|||
x_core_install perl-base |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #6 |
|||
rm $TARGET/usr/bin/awk |
|||
x_core_install mawk |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #7 |
|||
if doing_variant -; then |
|||
x_core_install debconf |
|||
fi |
|||
|
|||
baseprog=0 |
|||
bases=$(set -- $required; echo $#) |
|||
|
|||
info UNPACKREQ "Unpacking required packages..." |
|||
|
|||
smallyes '' | |
|||
(repeat 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" \ |
|||
dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 | |
|||
dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1 |
|||
|
|||
info CONFREQ "Configuring required packages..." |
|||
|
|||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" |
|||
echo \ |
|||
"#!/bin/sh |
|||
echo |
|||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" |
|||
chmod 755 "$TARGET/sbin/start-stop-daemon" |
|||
|
|||
setup_dselect_method apt |
|||
|
|||
smallyes '' | |
|||
(in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" \ |
|||
dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 | |
|||
dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1 |
|||
|
|||
baseprog=0 |
|||
bases="$(set -- $base; echo $#)" |
|||
|
|||
info UNPACKBASE "Unpacking the base system..." |
|||
|
|||
smallyes '' | |
|||
(repeat 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" \ |
|||
dpkg --status-fd 8 --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 | |
|||
dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1 |
|||
|
|||
info CONFBASE "Configuring the base system..." |
|||
|
|||
smallyes '' | |
|||
(repeat 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" \ |
|||
dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 | |
|||
dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1 |
|||
|
|||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" |
|||
|
|||
progress $bases $bases CONFBASE "Configuring base system" |
|||
info BASESUCCESS "Base system installed successfully." |
|||
} |
@ -0,0 +1,36 @@ |
|||
README for debootstrap |
|||
====================== |
|||
|
|||
See the manpage for (some) documentation. |
|||
|
|||
Future |
|||
------ |
|||
|
|||
* Cross-strap support - so you can bootstrap a filesystem to the |
|||
point where it will successfully boot, and finish installing itself |
|||
without having to be running the target architecture or OS yourself. |
|||
This means you should be able to run |
|||
|
|||
debootstrap --arch powerpc sarge ./sarge-ppc-chroot ... |
|||
|
|||
on an i386 system, boot a powerpc box with sarge-ppc-chroot as its |
|||
root files system, and have it "work". The cross-hurd package does |
|||
something similar, and should be replaced by this feature. |
|||
|
|||
* There should be some (better) way of telling debootstrap what "base" |
|||
packages you want to install -- this varies between making a chroot, |
|||
doing an install, and doing a buildd. Also, some installs want |
|||
different base packages (to setup networking, or kernels, eg) |
|||
|
|||
* There should be some be some way of intuiting required/base from the |
|||
Packages file. Unfortunately this requires changes to apt-ftparchive |
|||
so we can have different packages be required or in base on different |
|||
architectures. |
|||
|
|||
NMUing |
|||
------ |
|||
|
|||
If you're working on boot-floppies or debian-installer or similar, and |
|||
there's a problem with debootstrap that you need fixed, feel free to do |
|||
an NMU to fix it. Usual rules: try not to break anything, and mail the |
|||
patch to the BTS. Don't worry about asking first though. |
File diff suppressed because it is too large
@ -0,0 +1 @@ |
|||
4 |
@ -0,0 +1,30 @@ |
|||
Source: debootstrap |
|||
Section: admin |
|||
Maintainer: Anthony Towns <ajt@debian.org> |
|||
Uploaders: J.H.M. Dassen (Ray) <jdassen@debian.org> |
|||
Build-Depends: debhelper (>= 4.2), makedev (>= 2.3.1-69) |
|||
Standards-Version: 3.6.2 |
|||
|
|||
Package: debootstrap |
|||
Priority: extra |
|||
Architecture: all |
|||
Depends: wget, binutils |
|||
Description: Bootstrap a basic Debian system |
|||
debootstrap is used to create a Debian base system from scratch, |
|||
without requiring the availability of dpkg or apt. It does this by |
|||
downloading .deb files from a mirror site, and carefully unpacking them |
|||
into a directory which can eventually be chrooted into. |
|||
|
|||
Package: debootstrap-udeb |
|||
Priority: required |
|||
Section: debian-installer |
|||
XC-Package-Type: udeb |
|||
Architecture: any |
|||
Depends: ${shlibs:Depends}, mounted-partitions |
|||
Description: Bootstrap the Debian system |
|||
debootstrap is used to create a Debian base system from scratch, |
|||
without requiring the availability of dpkg or apt. It does this by |
|||
downloading .deb files from a mirror site, and carefully unpacking them |
|||
into a directory which can eventually be chrooted into. |
|||
. |
|||
debootstrap-udeb is a minimal package used by debian-installer. |
@ -0,0 +1,32 @@ |
|||
This package was debianized by Anthony Towns <ajt@debian.org> on |
|||
Tue, 30 Jan 2001 10:54:45 +1000. |
|||
|
|||
It was written from scratch for Debian by Anthony Towns <ajt@debian.org> |
|||
based loosely on the code for constructing base tarballs as part of the |
|||
boot-floppies package. |
|||
|
|||
The upstream site is http://code.erisian.com.au/Wiki/debootstrap . |
|||
|
|||
Copyright: |
|||
|
|||
Copyright (c) 2001-2005 Anthony Towns |
|||
|
|||
Permission is hereby granted, free of charge, to any person obtaining |
|||
a copy of this software and associated documentation files (the |
|||
"Software"), to deal in the Software without restriction, including |
|||
without limitation the rights to use, copy, modify, merge, publish, |
|||
distribute, sublicense, and/or sell copies of the Software, and to |
|||
permit persons to whom the Software is furnished to do so, subject to |
|||
the following conditions: |
|||
|
|||
The above copyright notice and this permission notice shall be |
|||
included in all copies or substantial portions of the Software. |
|||
|
|||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, |
|||
EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF |
|||
MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. |
|||
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY |
|||
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, |
|||
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE |
|||
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|||
|
@ -0,0 +1,2 @@ |
|||
usr/lib/debootstrap/scripts |
|||
usr/share/man/man8 |
@ -0,0 +1,2 @@ |
|||
usr/sbin |
|||
usr/share/man/man8 |
@ -0,0 +1,91 @@ |
|||
#!/usr/bin/make -f |
|||
|
|||
# Uncomment this to turn on verbose mode. |
|||
#export DH_VERBOSE=1 |
|||
|
|||
configure: |
|||
dh_testdir |
|||
|
|||
clean: |
|||
dh_testdir |
|||
|
|||
-$(MAKE) clean |
|||
|
|||
dh_clean |
|||
|
|||
build: configure |
|||
# need to be root to make devices, so build is done in install target |
|||
|
|||
real-build: build |
|||
dh_testdir |
|||
dh_testroot |
|||
|
|||
$(MAKE) all |
|||
|
|||
install: real-build |
|||
dh_testdir |
|||
dh_testroot |
|||
|
|||
dh_clean -k |
|||
dh_installdirs |
|||
|
|||
# install the package into debian/debootstrap |
|||
$(MAKE) install-allarch DESTDIR=$(CURDIR)/debian/debootstrap |
|||
$(MAKE) install-arch DESTDIR=$(CURDIR)/debian/debootstrap-udeb |
|||
|
|||
binary-indep: install |
|||
# We have nothing to do by default. |
|||
|
|||
ARCHES="i386" |
|||
SUITE="testing" |
|||
VERSION=$(SUITE) |
|||
MIRROR="http://ftp.debian.org/debian" |
|||
|
|||
binary-basedebs: |
|||
dh_testdir |
|||
dh_testroot |
|||
|
|||
$(MAKE) pkgdetails |
|||
|
|||
ln -s . scripts |
|||
for a in $(ARCHES); do \ |
|||
rm -rf chroot-dir; \ |
|||
mkdir -p chroot-dir; \ |
|||
DEBOOTSTRAP_DIR=. ./debootstrap --arch $$a --download-only $(SUITE) chroot-dir $(MIRROR); \ |
|||
(cd chroot-dir && tar cf ../../basedebs_$(VERSION)_$$a.tar *); \ |
|||
rm -rf chroot-dir; \ |
|||
done |
|||
rm -f scripts |
|||
|
|||
binary-indep: install |
|||
dh_testdir |
|||
dh_testroot |
|||
dh_installdocs -i |
|||
dh_installman -i debootstrap.8 |
|||
dh_installchangelogs -i |
|||
dh_link -i |
|||
dh_compress -i |
|||
dh_fixperms -i |
|||
dh_installdeb -i |
|||
dh_shlibdeps -i |
|||
dh_gencontrol -i |
|||
dh_md5sums -i |
|||
dh_builddeb -i |
|||
|
|||
binary-arch: install |
|||
dh_testdir |
|||
dh_testroot |
|||
-rm -rf debian/debootstrap-udeb/usr/share \ |
|||
debian/debootstrap-udeb/usr/lib/debootstrap/scripts/potato \ |
|||
debian/debootstrap-udeb/usr/lib/debootstrap/scripts/*.buildd \ |
|||
debian/debootstrap-udeb/usr/lib/debootstrap/scripts/*.fakechroot |
|||
dh_strip -s |
|||
dh_compress -s |
|||
dh_fixperms -s |
|||
dh_installdeb -s |
|||
dh_shlibdeps -s |
|||
dh_gencontrol -s |
|||
dh_builddeb -s |
|||
|
|||
binary: binary-indep binary-arch |
|||
.PHONY: build real-build clean binary-indep binary-arch binary install configure binary-basedebs |
@ -0,0 +1,491 @@ |
|||
#!/bin/sh -e |
|||
|
|||
unset TMP TEMP TMPDIR || true |
|||
|
|||
########################################################################### |
|||
|
|||
if [ "$DEBOOTSTRAP_DIR" = "" ]; then |
|||
if [ -x /debootstrap/debootstrap ]; then |
|||
DEBOOTSTRAP_DIR=/debootstrap |
|||
else |
|||
DEBOOTSTRAP_DIR=/usr/lib/debootstrap |
|||
fi |
|||
fi |
|||
|
|||
if [ -x "/usr/bin/gettext" ]; then |
|||
USE_GETTEXT_INTERACTION=yes |
|||
fi |
|||
|
|||
DEVICES_TARGZ=$DEBOOTSTRAP_DIR/devices.tar.gz |
|||
|
|||
. $DEBOOTSTRAP_DIR/functions |
|||
exec 4>&1 |
|||
|
|||
GETTEXT_LANG=$LANG |
|||
LANG=C |
|||
USE_COMPONENTS=main |
|||
KEYRING="" |
|||
VARIANT="" |
|||
|
|||
DEF_MIRROR="http://ftp.debian.org/debian" |
|||
|
|||
export LANG USE_COMPONENTS |
|||
umask 022 |
|||
|
|||
########################################################################### |
|||
|
|||
## phases: |
|||
## finddebs dldebs printdebs first_stage second_stage |
|||
|
|||
RESOLVE_DEPS=true |
|||
|
|||
WHAT_TO_DO="finddebs dldebs first_stage second_stage" |
|||
am_doing_phase () { |
|||
# usage: if am_doing_phase finddebs; then ...; fi |
|||
local x; |
|||
for x in "$@"; do |
|||
if echo " $WHAT_TO_DO " | grep -q " $1 "; then return 0; fi |
|||
done |
|||
return 1 |
|||
} |
|||
|
|||
########################################################################### |
|||
|
|||
usage_err() |
|||
{ |
|||
info USAGE1 "usage: [OPTION]... <suite> <target> [<mirror> [<script>]]" |
|||
info USAGE2 "Try \`${0##*/} --help' for more information." |
|||
error "$@" |
|||
} |
|||
|
|||
usage() |
|||
{ |
|||
echo "Usage: ${0##*/} [OPTION]... <suite> <target> [<mirror> [<script>]]" |
|||
echo "Bootstrap Debian base system." |
|||
echo |
|||
cat <<EOF |
|||
--help display this help and exit |
|||
--verbose don't turn off the output of wget |
|||
|
|||
--download-only download packages, but don't perform installation |
|||
--print-debs print the packages to be installed, and exit |
|||
|
|||
--arch A set the target architecture (use if no dpkg) |
|||
[ --arch powerpc ] |
|||
|
|||
--include=A,B,C adds specified names to the list of base packages |
|||
--exclude=A,B,C removes specified packages from the list |
|||
--components=A,B,C use packages from the listed components of the |
|||
archive |
|||
--variant=X use variant X of the bootstrap scripts |
|||
(currently supported variants: buildd, fakechroot) |
|||
--keyring=K check Release files against keyring K |
|||
--no-resolve-deps don't try to resolve dependencies automatically |
|||
|
|||
--unpack-tarball T acquire .debs from a tarball instead of http |
|||
--make-tarball T download .debs and create a tarball (tgz format) |
|||
|
|||
--boot-floppies used for internal purposes by boot-floppies |
|||
--debian-installer used for internal purposes by debian-installer |
|||
EOF |
|||
} |
|||
|
|||
########################################################################### |
|||
|
|||
if [ "$PKGDETAILS" = "" ]; then |
|||
error 1 NO_PKGDETAILS "No pkgdetails available; either install perl, or build pkgdetails.c from source" |
|||
fi |
|||
|
|||
########################################################################### |
|||
|
|||
if [ $# != 0 ] ; then |
|||
while true ; do |
|||
case "$1" in |
|||
--help) |
|||
usage |
|||
exit 0 |
|||
;; |
|||
--boot-floppies) |
|||
if [ -n "$USE_DEBIANINSTALLER_INTERACTION" ] ; then |
|||
error 1 ARG_BFDI "Can only use one of --boot-floppies and --debian-installer" |
|||
fi |
|||
if ! (echo -n "" >&3) 2>/dev/null; then |
|||
error 1 ARG_BFBYHAND "If running debootstrap by hand, don't use --boot-floppies" |
|||
fi |
|||
USE_BOOTFLOPPIES_INTERACTION=yes |
|||
unset USE_GETTEXT_INTERACTION |
|||
shift |
|||
;; |
|||
--debian-installer) |
|||
if [ -n "$USE_BOOTFLOPPIES_INTERACTION" ] ; then |
|||
error 1 ARG_BFDI "Can only use one of --boot-floppies and --debian-installer" |
|||
fi |
|||
if ! (echo -n "" >&3) 2>/dev/null; then |
|||
error 1 ARG_DIBYHAND "If running debootstrap by hand, don't use --debian-installer" |
|||
fi |
|||
USE_DEBIANINSTALLER_INTERACTION=yes |
|||
shift |
|||
;; |
|||
--foreign) |
|||
WHAT_TO_DO="finddebs dldebs first_stage" |
|||
shift |
|||
;; |
|||
--second-stage) |
|||
WHAT_TO_DO="finddebs second_stage" |
|||
SECOND_STAGE_ONLY=true |
|||
shift |
|||
;; |
|||
--print-debs) |
|||
WHAT_TO_DO="finddebs printdebs kill_target" |
|||
shift |
|||
;; |
|||
--download-only) |
|||
WHAT_TO_DO="finddebs dldebs" |
|||
shift |
|||
;; |
|||
--make-tarball) |
|||
WHAT_TO_DO="finddebs dldebs maketarball kill_target" |
|||
if [ -n "$2" ] ; then |
|||
MAKE_TARBALL="$2" |
|||
shift 2 |
|||
else |
|||
error 1 NEEDARG "option requires an argument %s" "$1" |
|||
fi |
|||
;; |
|||
--resolve-deps) |
|||
# redundant, but avoids breaking compatability |
|||
RESOLVE_DEPS=true |
|||
shift |
|||
;; |
|||
--no-resolve-deps) |
|||
RESOLVE_DEPS=false |
|||
shift |
|||
;; |
|||
--keep-debootstrap-dir) |
|||
KEEP_DEBOOTSTRAP_DIR=true |
|||
shift |
|||
;; |
|||
--arch) |
|||
if [ -n "$2" ] ; then |
|||
ARCH="$2" |
|||
shift 2 |
|||
else |
|||
error 1 NEEDARG "option requires an argument %s" "$1" |
|||
fi |
|||
;; |
|||
--unpack-tarball) |
|||
if [ -n "$2" ] ; then |
|||
if [ ! -f "$2" ] ; then |
|||
error 1 NOTARBALL "%s: No such file or directory" "$2" |
|||
fi |
|||
UNPACK_TARBALL="$2" |
|||
shift 2 |
|||
else |
|||
error 1 NEEDARG "option requires an argument %s" "$1" |
|||
fi |
|||
;; |
|||
--include*) |
|||
additional="$(echo $1 | cut -f2 -d"="|tr , " ")" |
|||
shift 1 |
|||
;; |
|||
--exclude*) |
|||
exclude="$(echo $1 | cut -f2 -d"="|tr , " ")" |
|||
shift 1 |
|||
;; |
|||
--verbose) |
|||
verbose=true |
|||
export verbose |
|||
shift 1 |
|||
;; |
|||
--components*) |
|||
USE_COMPONENTS="$(echo "$1" | cut -f2 -d"="|tr , "|")" |
|||
if [ "$USE_COMPONENTS" = "" ]; then |
|||
error 1 NEEDARG "option requires an argument %s" "$1" |
|||
fi |
|||
export USE_COMPONENTS |
|||
shift 1 |
|||
;; |
|||
--variant*) |
|||
VARIANT="$(echo "$1" | cut -f2 -d"=")" |
|||
shift 1 |
|||
;; |
|||
--keyring*) |
|||
if ! gpgv --version >/dev/null 2>&1; then |
|||
error 1 NEEDGPGV "gpgv not installed, but required for Release verification" |
|||
fi |
|||
KEYRING="$(echo "$1" | cut -f2 -d"=")" |
|||
if [ "$KEYRING" = "" ]; then |
|||
error 1 NEEDARG "option requires an argument %s" "$1" |
|||
fi |
|||
shift 1 |
|||
;; |
|||
*) |
|||
break |
|||
;; |
|||
esac |
|||
done |
|||
fi |
|||
|
|||
########################################################################### |
|||
|
|||
if [ "$SECOND_STAGE_ONLY" = "true" ]; then |
|||
SUITE=$(cat $DEBOOTSTRAP_DIR/suite) |
|||
ARCH=$(cat $DEBOOTSTRAP_DIR/arch) |
|||
if [ -e $DEBOOTSTRAP_DIR/variant ]; then |
|||
VARIANT=$(cat $DEBOOTSTRAP_DIR/variant) |
|||
SUPPORTED_VARIANTS="$VARIANT" |
|||
fi |
|||
TARGET=/ |
|||
MIRRORS=null: |
|||
SCRIPT=$DEBOOTSTRAP_DIR/suite-script |
|||
else |
|||
if [ "$1" = "" -o "$2" = "" ]; then |
|||
usage_err 1 NEEDSUITETARGET "You must specify a suite and a target." |
|||
fi |
|||
SUITE="$1" |
|||
TARGET="$2" |
|||
TARGET="${TARGET%/}" |
|||
if [ "${TARGET#/}" = "${TARGET}" ]; then |
|||
if [ "${TARGET%/*}" = "$TARGET" ] ; then |
|||
TARGET="$(echo `pwd`/$TARGET)" |
|||
else |
|||
TARGET="$(cd ${TARGET%/*}; echo `pwd`/${TARGET##*/})" |
|||
fi |
|||
fi |
|||
|
|||
MIRRORS="$DEF_MIRROR" |
|||
SCRIPT="$DEBOOTSTRAP_DIR/scripts/$1" |
|||
if [ -n "$VARIANT" -a -e "${SCRIPT}.${VARIANT}" ]; then |
|||
SCRIPT="${SCRIPT}.${VARIANT}" |
|||
SUPPORTED_VARIANTS="$VARIANT" |
|||
fi |
|||
if [ "$3" != "" ]; then |
|||
MIRRORS="$3" |
|||
MIRRORS="${MIRRORS%/}" |
|||
if [ "$4" != "" ]; then |
|||
SCRIPT="$4" |
|||
fi |
|||
fi |
|||
fi |
|||
|
|||
########################################################################### |
|||
|
|||
if [ "$ARCH" != "" ]; then |
|||
true |
|||
elif [ -x /usr/bin/dpkg ] && /usr/bin/dpkg --print-installation-architecture >/dev/null 2>&1 |
|||
then |
|||
ARCH=`/usr/bin/dpkg --print-installation-architecture` |
|||
elif [ -e $DEBOOTSTRAP_DIR/arch ]; then |
|||
ARCH=`cat $DEBOOTSTRAP_DIR/arch` |
|||
else |
|||
error 1 WHATARCH "Couldn't work out current architecture" |
|||
fi |
|||
|
|||
export MIRRORS ARCH SUITE TARGET |
|||
|
|||
if am_doing_phase first_stage second_stage; then |
|||
if [ -x /usr/bin/id ] && [ `id -u` -ne 0 ]; then |
|||
error 1 NEEDROOT "debootstrap can only run as root" |
|||
fi |
|||
fi |
|||
|
|||
if [ ! -e "$SCRIPT" ]; then |
|||
error 1 NOSCRIPT "No such script: %s" "$SCRIPT" |
|||
fi |
|||
|
|||
########################################################################### |
|||
|
|||
if [ "$TARGET" != "" ]; then |
|||
mkdir -p "$TARGET/debootstrap" |
|||
fi |
|||
|
|||
########################################################################### |
|||
|
|||
# Use of fd's by functions/scripts: |
|||
# |
|||
# stdin/stdout/stderr: used normally |
|||
# fd 4: I:/W:/etc information |
|||
# fd 5,6: spare for functions |
|||
# fd 7,8: spare for scripts |
|||
|
|||
if [ "$USE_DEBIANINSTALLER_INTERACTION" = yes ]; then |
|||
# stdout=stderr: full log of debootstrap run |
|||
# fd 3: I:/W:/etc information |
|||
exec 4>&3 |
|||
elif [ "$USE_BOOTFLOPPIES_INTERACTION" = yes ]; then |
|||
# stdout=stderr: full log of debootstrap run |
|||
# fd 3: I:/W:/etc information |
|||
exec 4>&3 |
|||
elif am_doing_phase printdebs; then |
|||
# stderr: I:/W:/etc information |
|||
# stdout: debs needed |
|||
exec 4>&2 |
|||
else |
|||
# stderr: used in exceptional circumstances only |
|||
# stdout: I:/W:/etc information |
|||
# $TARGET/debootstrap/debootstrap.log: full log of debootstrap run |
|||
exec 4>&1 |
|||
exec >>$TARGET/debootstrap/debootstrap.log |
|||
exec 2>&1 |
|||
fi |
|||
|
|||
########################################################################### |
|||
|
|||
if [ "$UNPACK_TARBALL" ]; then |
|||
if [ "${UNPACK_TARBALL#/}" = "$UNPACK_TARBALL" ]; then |
|||
error 1 TARPATH "Tarball must be given a complete path" |
|||
fi |
|||
if [ "${UNPACK_TARBALL%.tar}" != "$UNPACK_TARBALL" ]; then |
|||
(cd "$TARGET" && tar -xf "$UNPACK_TARBALL") |
|||
elif [ "${UNPACK_TARBALL%.tgz}" != "$UNPACK_TARBALL" ]; then |
|||
(cd "$TARGET" && zcat "$UNPACK_TARBALL" | tar -xf -) |
|||
else |
|||
error 1 NOTTAR "Unknown tarball: must be either .tar or .tgz" |
|||
fi |
|||
fi |
|||
|
|||
########################################################################### |
|||
|
|||
. "$SCRIPT" |
|||
|
|||
ok=false |
|||
for v in $SUPPORTED_VARIANTS; do |
|||
if doing_variant $v; then ok=true; fi |
|||
done |
|||
if ! $ok; then |
|||
error 1 UNSUPPVARIANT "unsupported variant" |
|||
fi |
|||
|
|||
########################################################################### |
|||
|
|||
if am_doing_phase finddebs; then |
|||
if [ "$FINDDEBS_NEEDS_INDICES" = "true" -o "$RESOLVE_DEPS" = "true" ]; then |
|||
download_indices |
|||
GOT_INDICES=true |
|||
fi |
|||
|
|||
work_out_debs |
|||
|
|||
base=$(without "$base $additional" "$exclude") |
|||
|
|||
if [ "$RESOLVE_DEPS" = true ]; then |
|||
requiredX=$(echo $(echo $required | tr ' ' '\n' | sort | uniq)) |
|||
baseX=$(echo $(echo $base | tr ' ' '\n' | sort | uniq)) |
|||
|
|||
baseN=$(without "$baseX" "$requiredX") |
|||
baseU=$(without "$baseX" "$baseN") |
|||
|
|||
if [ "$baseU" != "" ]; then |
|||
info REDUNDANTBASE "Found packages in base already in required: %s" "$baseU" |
|||
sleep 5 |
|||
fi |
|||
|
|||
info RESOLVEREQ "Resolving dependencies of required packages..." |
|||
required=$(resolve_deps $requiredX) |
|||
info RESOLVEBASE "Resolving dependencies of base packages..." |
|||
base=$(resolve_deps $baseX) |
|||
base=$(without "$base" "$required") |
|||
|
|||
requiredX=$(without "$required" "$requiredX") |
|||
baseX=$(without "$base" "$baseX") |
|||
if [ "$requiredX" != "" ]; then |
|||
info NEWREQUIRED "Found additional required dependencies: %s" "$requiredX" |
|||
sleep 5 |
|||
fi |
|||
if [ "$baseX" != "" ]; then |
|||
info NEWBASE "Found additional base dependencies: %s" "$baseX" |
|||
sleep 5 |
|||
fi |
|||
fi |
|||
|
|||
all_debs="$required $base" |
|||
fi |
|||
|
|||
if am_doing_phase printdebs; then |
|||
echo "$all_debs" |
|||
fi |
|||
|
|||
if am_doing_phase dldebs; then |
|||
if [ "$GOT_INDICES" != "true" ]; then |
|||
download_indices |
|||
fi |
|||
download $all_debs |
|||
fi |
|||
|
|||
if am_doing_phase maketarball; then |
|||
(cd $TARGET; |
|||
tar czf - var/lib/apt var/cache/apt) >$MAKE_TARBALL |
|||
fi |
|||
|
|||
if am_doing_phase first_stage; then |
|||
# first stage sets up the chroot -- no calls should be made to |
|||
# "chroot $TARGET" here; but they should be possible by the time it's |
|||
# finished |
|||
first_stage_install |
|||
|
|||
if ! am_doing_phase second_stage; then |
|||
cp "$0" $TARGET/debootstrap/debootstrap |
|||
cp $DEBOOTSTRAP_DIR/functions $TARGET/debootstrap/functions |
|||
cp $SCRIPT $TARGET/debootstrap/suite-script |
|||
echo "$ARCH" >$TARGET/debootstrap/arch |
|||
echo "$SUITE" >$TARGET/debootstrap/suite |
|||
[ "" = "$VARIANT" ] || |
|||
echo "$VARIANT" >$TARGET/debootstrap/variant |
|||
echo "$required" >$TARGET/debootstrap/required |
|||
echo "$base" >$TARGET/debootstrap/base |
|||
|
|||
chmod 755 $TARGET/debootstrap/debootstrap |
|||
fi |
|||
fi |
|||
|
|||
if am_doing_phase second_stage; then |
|||
if [ "$SECOND_STAGE_ONLY" = true ]; then |
|||
required="$(cat $DEBOOTSTRAP_DIR/required)" |
|||
base="$(cat $DEBOOTSTRAP_DIR/base)" |
|||
all_debs="$required $base" |
|||
fi |
|||
|
|||
# second stage uses the chroot to clean itself up -- has to be able to |
|||
# work from entirely within the chroot (in case we've booted into it, |
|||
# possibly over NFS eg) |
|||
|
|||
second_stage_install |
|||
|
|||
# create sources.list |
|||
# first, kill debootstrap.invalid sources.list |
|||
if [ -e "$TARGET/etc/apt/sources.list" ]; then |
|||
rm -f "$TARGET/etc/apt/sources.list" |
|||
fi |
|||
if [ "${MIRRORS#http://}" != "$MIRRORS" ]; then |
|||
setup_apt_sources ${MIRRORS%% *} |
|||
mv_invalid_to ${MIRRORS%% *} |
|||
else |
|||
setup_apt_sources $DEF_MIRROR |
|||
mv_invalid_to $DEF_MIRROR |
|||
fi |
|||
|
|||
if [ -e $TARGET/debootstrap/debootstrap.log ]; then |
|||
cp $TARGET/debootstrap/debootstrap.log $TARGET/var/log/bootstrap.log |
|||
fi |
|||
sync |
|||
|
|||
if [ "$KEEP_DEBOOTSTRAP_DIR" = true ]; then |
|||
if [ -x $TARGET/debootstrap/debootstrap ]; then |
|||
chmod 644 "$TARGET/debootstrap/debootstrap" |
|||
fi |
|||
else |
|||
rm -rf "$TARGET/debootstrap" |
|||
fi |
|||
fi |
|||
|
|||
if am_doing_phase kill_target; then |
|||
if [ "$KEEP_DEBOOTSTRAP_DIR" != true ]; then |
|||
info KILLTARGET "Deleting target directory" |
|||
rm -rf "$TARGET" |
|||
fi |
|||
fi |
|||
|
|||
if [ -n "$USE_BOOTFLOPPIES_INTERACTION" ] ; then |
|||
echo "I: debootstrap: Successfully completed" # goes to /dev/tty4 |
|||
sleep 1 || true # give the user a second to see the success notice. |
|||
fi |
@ -0,0 +1,133 @@ |
|||
.TH DEBOOTSTRAP 8 2001-04-27 "Debian Project" "Debian GNU/Linux manual" |
|||
.SH NAME |
|||
debootstrap \- Bootstrap a basic Debian system |
|||
.SH SYNOPSIS |
|||
.B debootstrap |
|||
.RB [ OPTION\&.\&.\&. ] |
|||
.I SUITE TARGET |
|||
.RI [ MIRROR |
|||
.RI [ SCRIPT ]] |
|||
|
|||
.B debootstrap |
|||
.RB [ OPTION\&.\&.\&. ] |
|||
.R --second-stage |
|||
.SH DESCRIPTION |
|||
.B debootstrap |
|||
bootstraps a basic Debian system of |
|||
.I SUITE |
|||
(eg, sarge, etch, lenny, sid) into |
|||
.I TARGET |
|||
from |
|||
.I MIRROR |
|||
by running |
|||
.IR SCRIPT . |
|||
.I MIRROR |
|||
can be an http:// URL or a file:/// URL. Notice that file:/ URLs are |
|||
translated to file:/// (correct scheme as described in RFC1738 for local filenames), |
|||
and file:// will \fBnot\fR work. |
|||
.PP |
|||
\fBDebootstrap\fR can be used to install Debian in a system without using an |
|||
installation disk but can also be used to run a different Debian flavor in a \fBchroot\fR |
|||
environment. This way you can create a full (minimal) Debian installation which |
|||
can be used for testing purposes (see the \fBEXAMPLES\fR section). |
|||
If you are looking for a chroot system to build packages please take a look at |
|||
\fBpbuilder\fR. |
|||
.SH "OPTIONS" |
|||
.PP |
|||
.IP "\fB\-\-arch ARCH\fP" |
|||
Set the target architecture (use if dpkg isn't installed). See also \-\-foreign. |
|||
.IP |
|||
.IP "\fB\-\-include=alpha,beta\fP" |
|||
Comma separated list of packages which will be added to download and extract |
|||
lists. Don't forget to resolve the dependencies manually, otherwise the |
|||
installation may fail. |
|||
.IP |
|||
.IP "\fB\-\-exclude=alpha,beta\fP" |
|||
Comma separated list of packages which will be removed from download and |
|||
extract lists. WARNING: you can and probably will exclude essential packages, be |
|||
careful using this option. |
|||
.IP |
|||
.IP "\fB\-\-no\-resolve\-deps\fP" |
|||
By default, debootstrap will attempt to automatically resolve any missing |
|||
dependencies, warning if any are found. Note that this is not a complete |
|||
dependency resolve in the sense of dpkg or apt, and that it is far better |
|||
to specify the entire base system than rely on this option. With this |
|||
option set, this behaviour is disabled. |
|||
.IP |
|||
.IP "\fB\-\-variant=buildd|fakechroot\fP" |
|||
Name of the bootstrap script variant to use. Currently, the variant |
|||
supported are buildd, which installs the build-essential packages into |
|||
.IR TARGET |
|||
and fakechroot, which installs the packages without root privileges. |
|||
The default, with no \fB\-\-variant=X\fP argument, is to create a base |
|||
Debian installation in |
|||
.IR TARGET . |
|||
.IP |
|||
.IP "\fB\-\-verbose\fP" |
|||
Produce more info about downloading. |
|||
.IP |
|||
.IP "\fB\-\-print\-debs\fP" |
|||
Print the packages to be installed, and exit. Note that a TARGET directory |
|||
must be specified so debootstrap can download Packages files to determine |
|||
which packages should be installed, and to resolve dependencies. The TARGET |
|||
directory will be deleted unless \-\-keep\-debootstrap\-dir is specified. |
|||
.IP |
|||
.IP "\fB\-\-download\-only\fP" |
|||
Download packages, but don't perform installation |
|||
.IP |
|||
.IP "\fB\-\-foreign\fP" |
|||
Do the initial unpack phase of bootstrapping only, for example if the |
|||
target architecture does not match the host architecture. A copy of |
|||
debootstrap sufficient for completing the bootstrap process will be |
|||
installed as /deboostrap/debootstrap in the target filesystem. |
|||
.IP |
|||
.IP "\fB\-\-second\-stage\fP" |
|||
Complete the bootstrapping process. Other arguments are generally not |
|||
needed. |
|||
.IP |
|||
.IP "\fB\-\-keep\-debootstrap\-dir\fP" |
|||
Don't delete the /debootstrap directory in the target after completing the |
|||
installation. |
|||
.IP |
|||
.IP "\fB\-\-unpack\-tarball FILE\fP" |
|||
Acquire .debs from tarball FILE instead of downloading via http |
|||
.IP |
|||
.IP "\fB\-\-boot\-floppies\fP" |
|||
Used for internal purposes by boot-floppies |
|||
.IP |
|||
.IP "\fB\-\-debian\-installer\fP" |
|||
Used for internal purposes by the debian-installer |
|||
.IP |
|||
.SH "EXAMPLE" |
|||
. |
|||
.PP |
|||
To setup a \fIsarge\fR system: |
|||
.PP |
|||
# debootstrap sarge ./sarge-chroot http://ftp.debian.org/debian |
|||
.PP |
|||
# debootstrap sarge ./sarge-chroot file:///PATH_TO_LOCAL_MIRROR/debian |
|||
.PP |
|||
Full process to create a complete Debian installation of \fIsid\fR (unstable): |
|||
.PP |
|||
main # cd / ; mkdir /sid-root |
|||
main # debootstrap sid /sid-root http://ftp.debian.org/debian/ |
|||
[ ... watch it download the whole system ] |
|||
main # echo "proc /sid-root/proc proc none 0 0" >> /etc/fstab |
|||
main # mount proc /sid-root/proc -t proc |
|||
main # cp /etc/hosts /sid-root/etc/hosts |
|||
main # chroot /sid-root /bin/bash |
|||
chroot # dselect |
|||
[ you may use aptitude, install mc and vim ... ] |
|||
main # echo "8:23:respawn:/usr/sbin/chroot /sid-root " \\ |
|||
"/sbin/getty 38400 tty8" >> /etc/inittab |
|||
[ define a login tty that will use this system ] |
|||
main # init q |
|||
[ reload init ] |
|||
.PP |
|||
Note that you will generally need a recent version of debootstrap to |
|||
do this; the version currently in stable will generally have stopped |
|||
working due to changes to unstable shortly after the last release. |
|||
.SH AUTHOR |
|||
.B debootstrap |
|||
was written by Anthony Towns <ajt@debian.org>. |
|||
This manpage was written by Matt Kraai <kraai@debian.org>. |
File diff suppressed because it is too large
@ -0,0 +1,178 @@ |
|||
mirror_style release |
|||
download_style apt |
|||
|
|||
work_out_debs () { |
|||
|
|||
required="base-files base-passwd bash bsdutils coreutils libacl1 libattr1 debconf debconf-i18n liblocale-gettext-perl libtext-iconv-perl libtext-wrapi18n-perl libtext-charwidth-perl debianutils diff dpkg dselect libblkid1 e2fsprogs e2fslibs libcomerr2 libss2 libuuid1 findutils grep gzip hostname libcap1 libdb1-compat libdb3 libncurses5 libnewt0.51 libpam-modules libpam-runtime libpam0g libpopt0 login makedev mawk mount ncurses-base ncurses-bin passwd perl-base procps python-minimal python2.4-minimal sed slang1a-utf8 lsb-base initscripts sysvinit sysv-rc tar util-linux zlib1g whiptail libgcc1 gcc-3.3-base libstdc++5" |
|||
|
|||
base="adduser alsa-base alsa-utils apt apt-utils aptitude at base-config bind9-host bsdmainutils bzip2 console-common console-data console-tools cpio cramfsprogs cron dash dhcp3-client dhcp3-common discover1 discover1-data dmsetup dnsutils dosfstools ed eject ethtool evms evms-ncurses fdutils file ftp gettext-base gnupg grepmap groff-base hdparm hotplug ifrename ifupdown info initrd-tools iproute iptables iputils-arping iputils-ping iputils-tracepath jfsutils klogd less libasound2 libbz2-1.0 libconsole libdb4.2 libdevmapper1.00 libdiscover1 libdns16 libevms-2.5 libfribidi0 libgc1 libgcrypt11 libgdbm3 libgnutls11 libgpg-error0 libgpmg1 libidn11 libisc7 libiw27 libldap2 liblockfile1 liblwres1 liblzo1 libmagic1 libncursesw5 libopencdk8 libparted1.6-12 libpcap0.8 libreiserfs0.3-0 libsasl2 libsasl2-modules libsigc++-1.2-5c102 libssl0.9.7 libtasn1-2 libusb-0.1-4 libwrap0 locales logrotate lsb-release lshw lsof lvm-common lvm10 lvm2 mailx man-db manpages mdadm mii-diag mime-support module-init-tools mtr-tiny mutt nano net-tools netbase netcat netkit-inetd ntp ntpdate openssh-client parted pciutils popularity-contest postfix postfix-tls ppp pppconfig pppoeconf psmisc python python2.4 reiser4progs reiserfsprogs reportbug rsync strace sudo sysklogd tcpd tcpdump telnet time ubuntu-base ubuntu-keyring udev usbutils vim vim-common w3m wget wireless-tools xfsprogs" |
|||
|
|||
without_package () { |
|||
echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' ' |
|||
} |
|||
subst_package () { |
|||
echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' ' |
|||
} |
|||
|
|||
LIBC6=libc6 |
|||
|
|||
case $ARCH in |
|||
"i386") |
|||
required="$required libc6 libc6-i686" |
|||
base="$base dmidecode libelfg0 ltrace memtest86+ libreadline4" |
|||
;; |
|||
"powerpc") |
|||
required="$required libc6 libreadline4" |
|||
base="$base hfsplus hfsutils libelfg0 libhfsp0 ltrace mac-fdisk pmac-fdisk powerpc-utils" |
|||
;; |
|||
"amd64") |
|||
required="$required libc6" |
|||
base="$base dmidecode libelfg0 ltrace memtest86+ libreadline4" |
|||
;; |
|||
"ia64") |
|||
required="$required libc6.1 libunwind7" |
|||
base="$base dmidecode libreadline4" |
|||
LIBC6="libc6.1" |
|||
;; |
|||
"sparc") |
|||
required="$required libc6" |
|||
base="$base lib64gcc1 libc6-sparc64 libreadline4" |
|||
;; |
|||
*) |
|||
# who knows? |
|||
;; |
|||
esac |
|||
} |
|||
|
|||
install_debs () { |
|||
first_stage_install |
|||
second_stage_install |
|||
} |
|||
|
|||
first_stage_install () { |
|||
extract $required |
|||
|
|||
mkdir -p "$TARGET/var/lib/dpkg" |
|||
: >"$TARGET/var/lib/dpkg/status" |
|||
echo >"$TARGET/var/lib/dpkg/available" |
|||
|
|||
setup_etc |
|||
if [ ! -e "$TARGET/etc/fstab" ]; then |
|||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" |
|||
chown 0.0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab" |
|||
fi |
|||
|
|||
setup_devices |
|||
|
|||
x_feign_install () { |
|||
local pkg="$1" |
|||
local deb="$(debfor $pkg)" |
|||
local ver="$( |
|||
ar -p "$TARGET/$deb" control.tar.gz | zcat | |
|||
tar -O -xf - control ./control 2>/dev/null | |
|||
sed -ne 's/^Version: *//Ip' | head -n 1 |
|||
)" |
|||
|
|||
mkdir -p "$TARGET/var/lib/dpkg/info" |
|||
|
|||
echo \ |
|||
"Package: $pkg |
|||
Version: $ver |
|||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" |
|||
|
|||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list" |
|||
} |
|||
|
|||
x_feign_install dpkg |
|||
} |
|||
|
|||
second_stage_install () { |
|||
x_core_install () { |
|||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") |
|||
} |
|||
p () { |
|||
baseprog="$(($baseprog + ${1:-1}))" |
|||
} |
|||
|
|||
DEBIAN_FRONTEND=noninteractive |
|||
DEBCONF_NONINTERACTIVE_SEEN=true |
|||
export DEBIAN_FRONTEND DEBCONF_NONINTERACTIVE_SEEN |
|||
|
|||
baseprog=0 |
|||
bases=7 |
|||
|
|||
setup_proc |
|||
in_target /sbin/ldconfig |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #1 |
|||
info INSTCORE "Installing core packages..." |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #2 |
|||
ln -sf mawk $TARGET/usr/bin/awk |
|||
x_core_install base-files base-passwd |
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #3 |
|||
x_core_install dpkg |
|||
|
|||
if [ ! -e "$TARGET/etc/localtime" ]; then |
|||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" |
|||
fi |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #4 |
|||
x_core_install $LIBC6 |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #5 |
|||
x_core_install perl-base |
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #6 |
|||
rm $TARGET/usr/bin/awk |
|||
x_core_install mawk |
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #7 |
|||
x_core_install debconf |
|||
|
|||
baseprog=0 |
|||
bases="$(set -- $required; echo $#)" |
|||
|
|||
info UNPACKREQ "Unpacking required packages..." |
|||
|
|||
smallyes '' | (repeat 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --status-fd 8 --force-depends --unpack $(debfor $required) 8>&1 1>&7 | dpkg_progress $baseprog $bases UNPACKREQ "Unpacking required packages" UNPACKING) 7>&1 |
|||
|
|||
baseprog=0 |
|||
|
|||
info CONFREQ "Configuring required packages..." |
|||
|
|||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" |
|||
echo \ |
|||
"#!/bin/sh |
|||
echo |
|||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" |
|||
chmod 755 "$TARGET/sbin/start-stop-daemon" |
|||
|
|||
setup_dselect_method apt |
|||
#on_exit "(in_target_nofail umount /dev/pts) || true" |
|||
|
|||
smallyes '' | (in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --status-fd 8 --configure --pending --force-configure-any --force-depends 8>&1 1>&7 | dpkg_progress $baseprog $bases CONFREQ "Configuring required packages" CONFIGURING) 7>&1 |
|||
|
|||
baseprog=0 |
|||
bases="$(set -- $base; echo $#)" |
|||
|
|||
info UNPACKBASE "Unpacking the base system..." |
|||
|
|||
smallyes '' | (repeat 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --status-fd 8 --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) 8>&1 1>&7 | dpkg_progress $baseprog $bases UNPACKBASE "Unpacking base system" UNPACKING) 7>&1 |
|||
|
|||
baseprog=0 |
|||
|
|||
info CONFBASE "Configuring the base system..." |
|||
|
|||
mv "$TARGET/usr/sbin/sendmail" "$TARGET/usr/sbin/sendmail.REAL" |
|||
ln -s /bin/true "$TARGET/usr/sbin/sendmail" |
|||
|
|||
smallyes '' | (repeat 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --status-fd 8 --force-confold --skip-same-version --configure -a 8>&1 1>&7 | dpkg_progress $baseprog $bases CONFBASE "Configuring base system" CONFIGURING) 7>&1 |
|||
|
|||
rm -f "$TARGET/usr/sbin/sendmail" |
|||
mv "$TARGET/usr/sbin/sendmail.REAL" "$TARGET/usr/sbin/sendmail" |
|||
|
|||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" |
|||
|
|||
progress $bases $bases CONFBASE "Configuring base system" |
|||
info BASESUCCESS "Base system installed successfully." |
|||
} |
|||
|
@ -0,0 +1,161 @@ |
|||
mirror_style release |
|||
download_style apt |
|||
|
|||
work_out_debs () { |
|||
required="base-files base-passwd bash bsdutils build-essential coreutils debianutils diff dpkg dselect e2fslibs e2fsprogs fakeroot findutils gcc-3.3-base grep gzip hostname initscripts libacl1 libattr1 libblkid1 libc6 libcap1 libcomerr2 libdb1-compat libdb3 libgcc1 libncurses5 libpam-modules libpam-runtime libpam0g libss2 libstdc++5 libuuid1 login lsb-base mawk mount ncurses-base ncurses-bin passwd perl-base pkgstriptranslations python-minimal python2.4-minimal sed slang1a-utf8 sysv-rc sysvinit tar util-linux zlib1g" |
|||
|
|||
base="apt binutils cpio cpp cpp-3.3 dpkg-dev g++ g++-3.3 gcc gcc-3.3 libc6-dev libdb4.2 libgdbm3 libstdc++5-3.3-dev linux-kernel-headers make patch perl perl-modules" |
|||
|
|||
without_package () { |
|||
echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' ' |
|||
} |
|||
subst_package () { |
|||
echo "$3" | tr ' ' '\n' | sed "s/^$1$/$2/" | tr '\n' ' ' |
|||
} |
|||
|
|||
LIBC6=libc6 |
|||
|
|||
case $ARCH in |
|||
"amd64") |
|||
;; |
|||
"i386") |
|||
;; |
|||
"powerpc") |
|||
;; |
|||
"ia64") |
|||
required="$(subst_package "libc6" "libc6.1" "$required")" |
|||
base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")" |
|||
base="$base libunwind7 libunwind7-dev" |
|||
LIBC6="libc6.1" |
|||
;; |
|||
|
|||
# Unsupported architectures: |
|||
"alpha") |
|||
required="$(subst_package "libc6" "libc6.1" "$required")" |
|||
base="$(subst_package "libc6-dev" "libc6.1-dev" "$base")" |
|||
LIBC6="libc6.1" |
|||
;; |
|||
*) |
|||
# who knows? |
|||
;; |
|||
esac |
|||
} |
|||
|
|||
install_debs () { |
|||
first_stage_install |
|||
second_stage_install |
|||
} |
|||
|
|||
first_stage_install () { |
|||
extract $required |
|||
|
|||
mkdir -p "$TARGET/var/lib/dpkg" |
|||
: >"$TARGET/var/lib/dpkg/status" |
|||
echo >"$TARGET/var/lib/dpkg/available" |
|||
|
|||
setup_etc |
|||
if [ ! -e "$TARGET/etc/fstab" ]; then |
|||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" |
|||
chown 0.0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab" |
|||
fi |
|||
|
|||
setup_devices |
|||
|
|||
x_feign_install () { |
|||
local pkg="$1" |
|||
local deb="$(debfor $pkg)" |
|||
local ver="$( |
|||
ar -p "$TARGET/$deb" control.tar.gz | zcat | |
|||
tar -O -xf - control ./control 2>/dev/null | |
|||
sed -ne 's/^Version: *//Ip' | head -n 1 |
|||
)" |
|||
|
|||
mkdir -p "$TARGET/var/lib/dpkg/info" |
|||
|
|||
echo \ |
|||
"Package: $pkg |
|||
Version: $ver |
|||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" |
|||
|
|||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list" |
|||
} |
|||
|
|||
x_feign_install dpkg |
|||
} |
|||
|
|||
second_stage_install () { |
|||
x_core_install () { |
|||
smallyes '' | in_target dpkg --force-depends --install $(debfor "$@") |
|||
} |
|||
p () { |
|||
baseprog="$(($baseprog + ${1:-1}))" |
|||
} |
|||
|
|||
DEBIAN_FRONTEND=noninteractive |
|||
export DEBIAN_FRONTEND |
|||
|
|||
baseprog=0 |
|||
bases=40 |
|||
|
|||
setup_proc |
|||
in_target /sbin/ldconfig |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #1 |
|||
info INSTCORE "Installing core packages..." |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #2 |
|||
ln -sf mawk $TARGET/usr/bin/awk |
|||
x_core_install base-files base-passwd |
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #3 |
|||
x_core_install dpkg |
|||
|
|||
if [ ! -e "$TARGET/etc/localtime" ]; then |
|||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" |
|||
fi |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #4 |
|||
x_core_install $LIBC6 |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #5 |
|||
x_core_install perl-base |
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #6 |
|||
rm $TARGET/usr/bin/awk |
|||
x_core_install mawk |
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #7 |
|||
|
|||
info UNPACKREQ "Unpacking required packages..." |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #8 |
|||
smallyes '' | repeat 5 in_target_failmsg UNPACK_REQ_FAIL_FIVE "Failure while unpacking required packages. This will be attempted up to five times." "" dpkg --force-depends --unpack $(debfor $required) |
|||
p 10; progress $baseprog $bases INSTCORE "Installing core packages" #18 |
|||
|
|||
info CONFREQ "Configuring required packages..." |
|||
|
|||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" |
|||
echo \ |
|||
"#!/bin/sh |
|||
echo |
|||
echo \"Warning: Fake start-stop-daemon called, doing nothing\"" > "$TARGET/sbin/start-stop-daemon" |
|||
chmod 755 "$TARGET/sbin/start-stop-daemon" |
|||
|
|||
setup_dselect_method apt |
|||
#on_exit "in_target_nofail umount /dev/pts" |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #19 |
|||
smallyes '' | in_target_failmsg CONF_REQ_FAIL "Failure while configuring required packages." "" dpkg --configure --pending --force-configure-any --force-depends |
|||
p 10; progress $baseprog $bases INSTCORE "Installing core packages" #29 |
|||
|
|||
info INSTCORE "Installing base packages..." |
|||
|
|||
p; progress $baseprog $bases INSTCORE "Installing core packages" #30 |
|||
smallyes '' | repeat 5 in_target_failmsg INST_BASE_FAIL_FIVE "Failure while installing base packages. This will be re-attempted up to five times." "" dpkg --force-auto-select --force-overwrite --force-confold --skip-same-version --unpack $(debfor $base) |
|||
|
|||
smallyes '' | repeat 5 in_target_failmsg CONF_BASE_FAIL_FIVE "Failure while configuring base packages. This will be attempted 5 times." "" dpkg --force-confold --skip-same-version --configure -a |
|||
|
|||
p 9; progress $baseprog $bases INSTCORE "Installing core packages" #39 |
|||
|
|||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" |
|||
|
|||
progress $bases $bases INSTCORE "Installing core packages" #40 |
|||
info BASESUCCESS "Base system installed successfully." |
|||
} |
@ -0,0 +1,209 @@ |
|||
#include <stdio.h> |
|||
#include <stdlib.h> |
|||
#include <string.h> |
|||
#include <ctype.h> |
|||
|
|||
#define MAX_LINE 1000 |
|||
#define MAX_PKGS 100 |
|||
|
|||
static char *fieldcpy(char *dst, char *fld) { |
|||
while (*fld && *fld != ':') |
|||
fld++; |
|||
if (!*(fld++)) |
|||
return NULL; |
|||
while (isspace(*fld)) fld++; |
|||
return strcpy(dst, fld); |
|||
} |
|||
|
|||
static void dogetdeps(char *pkgsfile, char **in_pkgs, int pkgc) { |
|||
char buf[MAX_LINE]; |
|||
char cur_pkg[MAX_LINE]; |
|||
char cur_deps[MAX_LINE]; |
|||
char *pkgs[MAX_PKGS]; |
|||
int i; |
|||
int skip; |
|||
FILE *f; |
|||
|
|||
cur_pkg[0] = cur_deps[0] = '\0'; |
|||
|
|||
for (i = 0; i < pkgc; i++) pkgs[i] = in_pkgs[i]; |
|||
|
|||
f = fopen(pkgsfile, "r"); |
|||
if (f == NULL) { |
|||
perror(pkgsfile); |
|||
exit(1); |
|||
} |
|||
|
|||
skip = 1; |
|||
while (fgets(buf, sizeof(buf), f)) { |
|||
if (*buf && buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; |
|||
if (strncasecmp(buf, "Package:", 8) == 0) { |
|||
skip = 1; |
|||
fieldcpy(cur_pkg, buf); |
|||
int any = 0; |
|||
for (i = 0; i < pkgc; i++) { |
|||
if (!pkgs[i]) continue; |
|||
any = 1; |
|||
if (strcmp(cur_pkg, pkgs[i]) == 0) { |
|||
skip = 0; |
|||
pkgs[i] = NULL; |
|||
break; |
|||
} |
|||
} |
|||
if (!any) break; |
|||
} else if (!skip && |
|||
(strncasecmp(buf, "Depends:", 8) == 0 || |
|||
strncasecmp(buf, "Pre-Depends:", 12) == 0)) |
|||
{ |
|||
char *pch; |
|||
fieldcpy(cur_deps, buf); |
|||
pch = cur_deps; |
|||
while (1) { |
|||
while (isspace(*pch)) pch++; |
|||
if (!*pch) break; |
|||
|
|||
while (*pch && *pch != '(' && *pch != '|' && *pch != ',' |
|||
&& !isspace(*pch)) |
|||
{ |
|||
fputc(*pch++, stdout); |
|||
} |
|||
fputc('\n', stdout); |
|||
while (*pch && *pch++ != ',') (void)NULL; |
|||
} |
|||
} |
|||
} |
|||
fclose(f); |
|||
} |
|||
|
|||
static void dopkgmirrorpkgs(int uniq, char *mirror, char *pkgsfile, |
|||
char *fieldname, char **in_pkgs, int pkgc) |
|||
{ |
|||
char buf[MAX_LINE]; |
|||
char cur_field[MAX_LINE]; |
|||
char cur_pkg[MAX_LINE]; |
|||
char cur_ver[MAX_LINE]; |
|||
char cur_arch[MAX_LINE]; |
|||
char cur_size[MAX_LINE]; |
|||
char cur_md5[MAX_LINE]; |
|||
char cur_filename[MAX_LINE]; |
|||
char *pkgs[MAX_PKGS]; |
|||
int i; |
|||
FILE *f; |
|||
|
|||
cur_pkg[0] = cur_ver[0] = cur_arch[0] = cur_filename[0] = '\0'; |
|||
|
|||
for (i = 0; i < pkgc; i++) pkgs[i] = in_pkgs[i]; |
|||
|
|||
f = fopen(pkgsfile, "r"); |
|||
if (f == NULL) { |
|||
perror(pkgsfile); |
|||
exit(1); |
|||
} |
|||
while (fgets(buf, sizeof(buf), f)) { |
|||
if (*buf && buf[strlen(buf)-1] == '\n') buf[strlen(buf)-1] = '\0'; |
|||
if (strncasecmp(buf, fieldname, strlen(fieldname)) == 0) { |
|||
fieldcpy(cur_field, buf); |
|||
} |
|||
if (strncasecmp(buf, "Package:", 8) == 0) { |
|||
fieldcpy(cur_pkg, buf); |
|||
} else if (strncasecmp(buf, "Version:", 8) == 0) { |
|||
fieldcpy(cur_ver, buf); |
|||
} else if (strncasecmp(buf, "Architecture:", 13) == 0) { |
|||
fieldcpy(cur_arch, buf); |
|||
} else if (strncasecmp(buf, "Size:", 5) == 0) { |
|||
fieldcpy(cur_size, buf); |
|||
} else if (strncasecmp(buf, "MD5sum:", 7) == 0) { |
|||
fieldcpy(cur_md5, buf); |
|||
} else if (strncasecmp(buf, "Filename:", 9) == 0) { |
|||
fieldcpy(cur_filename, buf); |
|||
} else if (!*buf) { |
|||
int any = 0; |
|||
for (i = 0; i < pkgc; i++) { |
|||
if (!pkgs[i]) continue; |
|||
any = 1; |
|||
if (strcmp(cur_field, pkgs[i]) == 0) { |
|||
printf("%s %s %s %s %s %s %s\n", cur_pkg, cur_ver, cur_arch, mirror, cur_filename, cur_md5, cur_size); |
|||
if (uniq) pkgs[i] = NULL; |
|||
break; |
|||
} |
|||
} |
|||
if (!any) break; |
|||
} |
|||
} |
|||
fclose(f); |
|||
|
|||
/* any that weren't found are returned as "pkg -" */ |
|||
if (uniq) { |
|||
for (i = 0; i < pkgc; i++) { |
|||
if (pkgs[i]) { |
|||
printf("%s -\n", pkgs[i]); |
|||
} |
|||
} |
|||
} |
|||
} |
|||
|
|||
static int dotranslatewgetpercent(int low, int high, int end, char *str) { |
|||
int ch; |
|||
int val, lastval; |
|||
|
|||
/* print out anything that looks like a % on its own line, appropriately
|
|||
* scaled */ |
|||
|
|||
lastval = val = 0; |
|||
while ( (ch = getchar()) != EOF ) { |
|||
if (isdigit(ch)) { |
|||
val *= 10; val += ch - '0'; |
|||
} else if (ch == '%') { |
|||
float f = (float) val / 100.0 * (high - low) + low; |
|||
if (str) { |
|||
printf("P: %d %d %s\n", (int) f, end, str); |
|||
} else { |
|||
printf("P: %d %d\n", (int) f, end); |
|||
} |
|||
lastval = val; |
|||
} else { |
|||
val = 0; |
|||
} |
|||
} |
|||
return lastval == 100; |
|||
} |
|||
|
|||
int main(int argc, char *argv[]) { |
|||
if ((argc == 6 || argc == 5) && strcmp(argv[1], "WGET%") == 0) { |
|||
if (dotranslatewgetpercent(atoi(argv[2]), atoi(argv[3]), |
|||
atoi(argv[4]), argc == 6 ? argv[5] : NULL)) |
|||
{ |
|||
exit(0); |
|||
} else { |
|||
exit(1); |
|||
} |
|||
} else if (argc >= 4 && strcmp(argv[1], "GETDEPS") == 0) { |
|||
int i; |
|||
for (i = 3; argc - i > MAX_PKGS; i += MAX_PKGS) { |
|||
dogetdeps(argv[2], argv+i, MAX_PKGS); |
|||
} |
|||
dogetdeps(argv[2], argv+i, argc-i); |
|||
exit(0); |
|||
} else if (argc >= 5 && strcmp(argv[1], "PKGS") == 0) { |
|||
int i; |
|||
for (i = 4; argc - i > MAX_PKGS; i += MAX_PKGS) { |
|||
dopkgmirrorpkgs(1, argv[2], argv[3], "Package:", argv+i, MAX_PKGS); |
|||
} |
|||
dopkgmirrorpkgs(1, argv[2], argv[3], "Package:", argv+i, argc-i); |
|||
exit(0); |
|||
} else if (argc >= 6 && strcmp(argv[1], "FIELD") == 0) { |
|||
int i; |
|||
for (i = 5; argc - i > MAX_PKGS; i += MAX_PKGS) { |
|||
dopkgmirrorpkgs(0, argv[3], argv[4], argv[2], argv+i, MAX_PKGS); |
|||
} |
|||
dopkgmirrorpkgs(0, argv[3], argv[4], argv[2], argv+i, argc-i); |
|||
exit(0); |
|||
} else { |
|||
fprintf(stderr, "usage: %s PKGS mirror packagesfile pkgs..\n", argv[0]); |
|||
fprintf(stderr, " or: %s FIELD field mirror packagesfile pkgs..\n", |
|||
argv[0]); |
|||
fprintf(stderr, " or: %s GETDEPS packagesfile pkgs..\n", argv[0]); |
|||
fprintf(stderr, " or: %s WGET%% low high end reason\n", argv[0]); |
|||
exit(1); |
|||
} |
|||
} |
@ -0,0 +1,50 @@ |
|||
|
|||
# info |
|||
|
|||
msgid "Base system installed successfully." |
|||
msgid "Configuring required packages..." |
|||
msgid "Extracting %s..." |
|||
msgid "Installing base packages..." |
|||
msgid "Installing core packages..." |
|||
msgid "Retrieving %s" |
|||
msgid "Unpacking required packages..." |
|||
msgid "Validating %s" |
|||
|
|||
msgid "usage: [OPTION]... <suite> <target> [<mirror> [<script>]]" |
|||
msgid "Try \`${0##*/} --help' for more information." |
|||
|
|||
# warnings |
|||
|
|||
msgid "%s was corrupt" |
|||
msgid "Retrying failed download of %s" |
|||
|
|||
msgid "Failure trying to run: %s" |
|||
msgid "Failure while configuring base packages. This will be attempted 5 times." |
|||
msgid "Failure while configuring required packages." |
|||
msgid "Failure while installing base packages. This will be re-attempted up to five times." |
|||
msgid "Failure while unpacking required packages. This will be attempted up to five times." |
|||
|
|||
# errors |
|||
|
|||
msgid "%s was not pre-downloaded" |
|||
msgid "%s: No such file or directory" |
|||
msgid "Can only use one of --boot-floppies and --debian-installer" |
|||
msgid "Couldn't download %s" |
|||
msgid "Couldn't work out current architecture" |
|||
msgid "Failed getting release file %s" |
|||
msgid "If running debootstrap by hand, don't use --boot-floppies" |
|||
msgid "If running debootstrap by hand, don't use --debian-installer" |
|||
msgid "Interrupt caught ... exiting" |
|||
msgid "Invalid Release file, no entry for %s" |
|||
msgid "Invalid Release file, no valid components" |
|||
msgid "No such script: %s" |
|||
msgid "Tarball must be given a complete path" |
|||
msgid "Unknown tarball: must be either .tar or .tgz" |
|||
msgid "You must specify a suite and a target." |
|||
msgid "debootstrap can only run as root" |
|||
msgid "no %s. cannot create devices" |
|||
msgid "option requires an argument %s" |
|||
msgid "unknown download style" |
|||
msgid "unknown dselect method" |
|||
msgid "unknown location %s" |
|||
msgid "unknown mirror style" |
@ -0,0 +1,105 @@ |
|||
mirror_style release |
|||
download_style apt var-state |
|||
|
|||
work_out_debs () { |
|||
required="base-files base-passwd bash bsdutils debconf-tiny debianutils diff dpkg e2fsprogs fileutils findutils grep gzip hostname ldso libc6 libdb2 libgdbmg1 libncurses5 libnewt0 libpam-modules libpam-runtime libpam0g libpopt0 libreadline4 libstdc++2.10 login makedev mawk modutils mount ncurses-base ncurses-bin passwd perl-5.005-base perl-base procps sed shellutils slang1 sysklogd sysvinit tar textutils update util-linux whiptail" |
|||
|
|||
base="adduser ae apt base-config elvis-tiny fbset fdutils gettext-base console-data console-tools console-tools-libs libdb2 libwrap0 locales modconf netbase ftp ppp pppconfig pump tasksel tcpd textutils telnet xviddetect" |
|||
|
|||
without_package () { |
|||
echo "$2" | tr ' ' '\n' | grep -v "^$1$" | tr '\n' ' ' |
|||
} |
|||
|
|||
LIBC6=libc6 |
|||
|
|||
case $ARCH in |
|||
"alpha") |
|||
required="$(without_package "libc6" "$required") libc6.1" |
|||
LIBC6="libc6.1" |
|||
;; |
|||
"i386") |
|||
base="$base fdflush isapnptools lilo mbr pciutils pcmcia-cs psmisc setserial syslinux" |
|||
;; |
|||
*) |
|||
# other arches may have special needs not yet represented here |
|||
# oh well, Potato is old |
|||
esac |
|||
} |
|||
|
|||
first_stage_install () { |
|||
extract $required |
|||
|
|||
:> "$TARGET/var/lib/dpkg/status" |
|||
echo > "$TARGET/var/lib/dpkg/available" |
|||
|
|||
setup_etc |
|||
echo '# UNCONFIGURED FSTAB FOR BASE SYSTEM' > "$TARGET/etc/fstab" |
|||
chown 0.0 "$TARGET/etc/fstab"; chmod 644 "$TARGET/etc/fstab" |
|||
|
|||
setup_devices |
|||
|
|||
x_feign_install () { |
|||
local pkg=$1 |
|||
local deb="$(debfor $pkg)" |
|||
local ver="$( |
|||
ar -p $TARGET/$deb control.tar.gz | zcat | |
|||
tar -O -xf - control ./control 2>/dev/null | |
|||
sed -ne 's/^Version: *//Ip' | head -n 1 |
|||
)" |
|||
|
|||
mkdir -p "$TARGET/var/lib/dpkg/info" |
|||
|
|||
echo \ |
|||
"Package: $pkg |
|||
Version: $ver |
|||
Status: install ok installed" >> "$TARGET/var/lib/dpkg/status" |
|||
|
|||
touch "$TARGET/var/lib/dpkg/info/${pkg}.list" |
|||
} |
|||
|
|||
x_feign_install dpkg |
|||
|
|||
if [ -e "$TARGET/usr/bin/perl-5.005.dist" ]; then |
|||
mv "$TARGET/usr/bin/perl-5.005.dist" "$TARGET/usr/bin/perl-5.005" |
|||
fi |
|||
if [ ! -e "$TARGET/usr/bin/perl" ]; then |
|||
ln -sf perl-5.005 "$TARGET/usr/bin/perl" |
|||
fi |
|||
} |
|||
|
|||
second_stage_install () { |
|||
x_core_install () { |
|||
in_target dpkg --force-depends --install $(debfor "$@") |
|||
} |
|||
|
|||
export DEBIAN_FRONTEND=Noninteractive |
|||
|
|||
setup_proc |
|||
ln "$TARGET/sbin/ldconfig.new" "$TARGET/sbin/ldconfig" |
|||
in_target /sbin/ldconfig |
|||
|
|||
x_core_install base-files base-passwd ldso |
|||
x_core_install dpkg |
|||
|
|||
ln -sf /usr/share/zoneinfo/UTC "$TARGET/etc/localtime" |
|||
x_core_install $LIBC6 |
|||
|
|||
smallyes '' | x_core_install perl-5.005-base |
|||
x_core_install mawk |
|||
x_core_install debconf-tiny |
|||
|
|||
in_target dpkg-preconfigure $(debfor $required $base) |
|||
|
|||
repeat 5 in_target dpkg --force-depends --unpack $(debfor $required) |
|||
|
|||
mv "$TARGET/sbin/start-stop-daemon" "$TARGET/sbin/start-stop-daemon.REAL" |
|||
cp "$TARGET/bin/true" "$TARGET/sbin/start-stop-daemon" |
|||
|
|||
setup_dselect_method apt |
|||
|
|||
in_target dpkg --configure --pending --force-configure-any --force-depends |
|||
|
|||
smallyes '' | repeat 5 in_target dpkg --force-auto-select --force-overwrite --skip-same-version --install $(debfor $base) |
|||
|
|||
mv "$TARGET/sbin/start-stop-daemon.REAL" "$TARGET/sbin/start-stop-daemon" |
|||
} |
< |