revert Debian-specific changes -- this is supported via ~/.mk-sbuild-lv.sources, and should not have Debian-specific logic. especially should not change out which tool is being used to build the chroot

This commit is contained in:
Kees Cook 2009-03-30 12:06:04 -07:00
parent a0f1b047a7
commit cadae8c549

View File

@ -2,7 +2,6 @@
#
# Copyright 2006-2007 (C) Canonical Ltd.
# Created by Kees Cook <kees@ubuntu.com>
# Copyright 2009 (C) Ryan Kavanagh <ryanakca@kubuntu.org>
#
# ##################################################################
#
@ -117,7 +116,6 @@ function usage()
echo " --skip-updates Do not include -updates pocket in sources.list"
echo " --source-template=FILE Use FILE as the sources.list template"
echo " --debootstrap-mirror=URL Use URL as the debootstrap source"
echo " --debian Make a Debian schroot environment"
echo ""
echo "Configuration (via ~/.mk-sbuild-lv.rc)"
echo " LV_SIZE Size of source LVs (default ${LV_SIZE})"
@ -131,7 +129,7 @@ function usage()
if [ -z "$1" ]; then
usage
fi
OPTS=`getopt -o '' --long "help,debug,skip-updates,arch:,name:,source-template:,debootstrap-mirror:,personality:,debian" -- "$@"`
OPTS=`getopt -o '' --long "help,debug,skip-updates,arch:,name:,source-template:,debootstrap-mirror:,personality:" -- "$@"`
eval set -- "$OPTS"
name=""
@ -175,10 +173,6 @@ while :; do
DEBOOTSTRAP_MIRROR="$2"
shift 2
;;
--debian)
DEBIAN=True
shift
;;
--)
shift
break
@ -232,7 +226,7 @@ else
fi
# are we doing an lpia build?
if [ -z "$DEBOOTSTRAP_MIRROR" ] && [ "$arch_opt" = "--arch lpia" ] && [ ! $DEBIAN ]; then
if [ -z "$DEBOOTSTRAP_MIRROR" ] && [ "$arch_opt" = "--arch lpia" ]; then
DEBOOTSTRAP_MIRROR="http://ports.ubuntu.com/"
fi
@ -243,11 +237,7 @@ sudo mkfs -t ext3 "$CHROOT_PATH"
# Mount and debootstrap the chroot
MNT=`mktemp -d -t schroot-XXXXXX`
sudo mount "$CHROOT_PATH" "$MNT"
if [ $DEBIAN ]; then
sudo cdebootstrap -f build $arch_opt $variant_opt "$RELEASE" "$MNT" "${DEBOOTSTRAP_MIRROR:-http://ftp.debian.org/debian}"
else
sudo debootstrap --variant=buildd $arch_opt $variant_opt "$RELEASE" "$MNT" "${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu}"
fi
sudo debootstrap $arch_opt $variant_opt "$RELEASE" "$MNT" "${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu}"
# Update the package sources
TEMP_SOURCES=`mktemp -t sources-XXXXXX`
if [ -z "$TEMPLATE_SOURCES" ]; then
@ -256,21 +246,6 @@ fi
if [ -r "$TEMPLATE_SOURCES" ]; then
cat "$TEMPLATE_SOURCES" > "$TEMP_SOURCES"
else
# Start DEBIAN
if [ $DEBIAN ]; then
cat > "$TEMP_SOURCES" << EOM
deb ${DEBOOTSTRAP_MIRROR:-http://ftp.debian.org/debian} RELEASE main non-free contrib
deb-src ${DEBOOTSTRAP_MIRROR:-http://ftp.debian.org/debian} RELEASE main non-free contrib
EOM
if [ "$RELEASE" != "sid" ]; then
cat >> "$TEMP_SOURCES" << EOM
deb http://security.debian.org/ ${RELEASE}/updates main
deb-src http://security.debian.org/ ${RELEASE}/updates main
EOM
fi
# End Debian
else
# Start Ubuntu
cat > "$TEMP_SOURCES" <<EOM
deb ${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu} RELEASE main restricted universe multiverse
deb-src ${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu} RELEASE main restricted universe multiverse
@ -285,8 +260,6 @@ EOM
deb http://security.ubuntu.com/ubuntu RELEASE-security main restricted universe multiverse
deb-src http://security.ubuntu.com/ubuntu RELEASE-security main restricted universe multiverse
EOM
# End Ubuntu
fi
fi
cat "$TEMP_SOURCES" | sed -e "s|RELEASE|$RELEASE|g" | \
sudo bash -c "cat > $MNT/etc/apt/sources.list"
@ -335,11 +308,7 @@ BUILD_PKGS="build-essential fakeroot devscripts apt-utils"
if [ "$RELEASE" != "breezy" ] && [ "$RELEASE" != "dapper" ]; then
# Disable recommends for a smaller chroot (gutsy and later only)
# Add buildd tools
# No need to do this for debian, --flavour=build in cdebootstrap
# takes care of it.
if [ ! $DEBIAN ]; then
BUILD_PKGS="--no-install-recommends $BUILD_PKGS"
fi
BUILD_PKGS="--no-install-recommends $BUILD_PKGS pkg-create-dbgsym pkgbinarymangler"
fi
sudo bash -c "cat >> $MNT/finish.sh" <<EOM
#!/bin/bash
@ -348,11 +317,7 @@ set -e
# Reload package lists
apt-get update || true
# Pull down signature requirements
if [ ! DEBIAN_BOOL ]; then
# This will only be run in Ubuntu chroots. Not required with debian because
# cdebootstrap pulls gnupg and debian-archive-keyring.
apt-get -y --force-yes install gnupg ubuntu-keyring
fi
# Reload package lists
apt-get update || true
# Disable debconf questions so that automated builds won't prompt
@ -368,7 +333,6 @@ if [ ! -r /dev/stderr ]; then ln -s /proc/self/fd/2 /dev/stderr; fi
apt-get clean
rm /finish.sh
EOM
sudo sed -i -e "s|DEBIAN_BOOL|$DEBIAN|g" "${MNT}"/finish.sh
sudo chmod +x "$MNT"/finish.sh
sudo umount "$MNT"
rmdir "$MNT"