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