mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-05-09 07:51:28 +00:00
* rename mk-sbuild-lv to mk-sbuild, support union-type=aufs
* mk-sbuild: clean up and make slight adjustments to new lvm/aufs logic. * mk-sbuild.1: update documentation to reflect alternative config file names for distro and schroot type overrides.
This commit is contained in:
commit
0dc688ee7e
8
debian/changelog
vendored
8
debian/changelog
vendored
@ -1,5 +1,8 @@
|
|||||||
ubuntu-dev-tools (0.93) UNRELEASED; urgency=low
|
ubuntu-dev-tools (0.93) UNRELEASED; urgency=low
|
||||||
|
|
||||||
|
[ Scott Moser ]
|
||||||
|
* rename mk-sbuild-lv to mk-sbuild, support union-type=aufs
|
||||||
|
|
||||||
[ Emmet Hikory ]
|
[ Emmet Hikory ]
|
||||||
* Support qemu-arm-static -> qemu-kvm-extras-static transition
|
* Support qemu-arm-static -> qemu-kvm-extras-static transition
|
||||||
|
|
||||||
@ -10,8 +13,11 @@ ubuntu-dev-tools (0.93) UNRELEASED; urgency=low
|
|||||||
[ Kees Cook ]
|
[ Kees Cook ]
|
||||||
* requestsync: add -C to allow manually adding changelog when missing
|
* requestsync: add -C to allow manually adding changelog when missing
|
||||||
(LP: #518574).
|
(LP: #518574).
|
||||||
|
* mk-sbuild: clean up and make slight adjustments to new lvm/aufs logic.
|
||||||
|
* mk-sbuild.1: update documentation to reflect alternative config file
|
||||||
|
names for distro and schroot type overrides.
|
||||||
|
|
||||||
-- Kees Cook <kees@ubuntu.com> Mon, 08 Feb 2010 10:12:23 -0800
|
-- Kees Cook <kees@ubuntu.com> Tue, 09 Feb 2010 00:14:26 -0800
|
||||||
|
|
||||||
ubuntu-dev-tools (0.92) lucid; urgency=low
|
ubuntu-dev-tools (0.92) lucid; urgency=low
|
||||||
|
|
||||||
|
@ -1,18 +1,18 @@
|
|||||||
.TH MK\-SBUILD\-LV "1" "27 August 2008" "ubuntu-dev-tools"
|
.TH MK\-SBUILD "1" "09 February 2010" "ubuntu-dev-tools"
|
||||||
|
|
||||||
.SH NAME
|
.SH NAME
|
||||||
mk\-sbuild\-lv \- creates LVM snapshot chroots via schroot and sbuild
|
mk\-sbuild \- creates chroots via schroot and sbuild
|
||||||
|
|
||||||
.SH SYNOPSIS
|
.SH SYNOPSIS
|
||||||
\fBmk\-sbuild\-lv\fR [\fB\-\-arch=ARCH\fR] [\fB\-\-name=NAME\fR]
|
\fBmk\-sbuild\fR [\fB\-\-arch=ARCH\fR] [\fB\-\-name=NAME\fR]
|
||||||
[\fB\-\-personality=PERSONALITY\fR] [\fB\-\-debug\fR] [\fB\-\-source\-template=FILE\fR]
|
[\fB\-\-personality=PERSONALITY\fR] [\fB\-\-debug\fR] [\fB\-\-source\-template=FILE\fR]
|
||||||
[\fB\-\-debootstrap\-mirror=URL\fR] <\fBVG\fR> <\fBRelease\fR>
|
[\fB\-\-debootstrap\-mirror=URL\fR] <\fBRelease\fR>
|
||||||
|
|
||||||
.SH DESCRIPTION
|
.SH DESCRIPTION
|
||||||
\fBmk\-sbuild\-lv\fR creates LVM snapshot chroots via schroot and sbuild.
|
\fBmk\-sbuild\fR creates chroots via schroot and sbuild.
|
||||||
|
|
||||||
.SH OPTIONS
|
.SH OPTIONS
|
||||||
Listed below are the command line options for mk\-sbuild\-lv:
|
Listed below are the command line options for mk\-sbuild:
|
||||||
.TP
|
.TP
|
||||||
.B \-\-arch=ARCH
|
.B \-\-arch=ARCH
|
||||||
What architecture to select (defaults to the native architecture).
|
What architecture to select (defaults to the native architecture).
|
||||||
@ -30,7 +30,7 @@ Turn on script debugging.
|
|||||||
Do not include the \-updates pocket in the installed sources.list.
|
Do not include the \-updates pocket in the installed sources.list.
|
||||||
.TP
|
.TP
|
||||||
.B \-\-source\-template=FILE
|
.B \-\-source\-template=FILE
|
||||||
Use FILE as the sources.list template (defaults to $HOME/.mk\-sbuild\-lv.sources).
|
Use FILE as the sources.list template (defaults to $HOME/.mk\-sbuild.sources).
|
||||||
.TP
|
.TP
|
||||||
.B \-\-debootstrap\-mirror=URL
|
.B \-\-debootstrap\-mirror=URL
|
||||||
Use URL as the debootstrap source (defaults to http://ports.ubuntu.com for lpia,
|
Use URL as the debootstrap source (defaults to http://ports.ubuntu.com for lpia,
|
||||||
@ -39,6 +39,10 @@ official Ubuntu repositories for the supported architectures).
|
|||||||
.B \-\-distro
|
.B \-\-distro
|
||||||
Enable distro-specific logic. Currently known distros: "ubuntu" (default)
|
Enable distro-specific logic. Currently known distros: "ubuntu" (default)
|
||||||
and "debian".
|
and "debian".
|
||||||
|
.TP
|
||||||
|
.B \-\-vg
|
||||||
|
Specify a volume group, and subsequently use SCHROOT_TYPE of "lvm-snapshot"
|
||||||
|
rather than "directory" (via aufs) mounts.
|
||||||
|
|
||||||
.SH ENVIRONMENT VARIABLES
|
.SH ENVIRONMENT VARIABLES
|
||||||
.TP
|
.TP
|
||||||
@ -53,24 +57,32 @@ Lines to append to schroot entries.
|
|||||||
.TP
|
.TP
|
||||||
.B SKIP_UPDATES
|
.B SKIP_UPDATES
|
||||||
Do not include the \-updates pocket in the installed sources.list.
|
Do not include the \-updates pocket in the installed sources.list.
|
||||||
|
.TP
|
||||||
|
.B SOURCE_CHROOTS_DIR
|
||||||
|
use SOURCE_CHROOTS_DIR as home of schroot source directories. (default
|
||||||
|
/var/lib/schroot/chroots)
|
||||||
|
|
||||||
.SH FILES
|
.SH FILES
|
||||||
.TP
|
.TP
|
||||||
.B $HOME/.mk\-sbuild\-lv.rc
|
.B $HOME/.mk\-sbuild.rc
|
||||||
Sourced for environment variables (defined above).
|
Sourced for environment variables (defined above).
|
||||||
.TP
|
.TP
|
||||||
.B $HOME/.mk\-sbuild\-lv.sources
|
.B $HOME/.mk\-sbuild.sources[.$DISTRO]
|
||||||
Can contain a customized sources.list.
|
Can contain a customized sources.list.
|
||||||
It will be read when creating the schroot.
|
It will be read when creating the schroot.
|
||||||
|
If a file with ".ubuntu" or ".debian" is found (based on the \-\-distro
|
||||||
|
argument) that file will use used instead.
|
||||||
See sources.list(5) for more details on the format.
|
See sources.list(5) for more details on the format.
|
||||||
.TP
|
.TP
|
||||||
.B $HOME/.mk\-sbuild\-lv.schroot.conf
|
.B $HOME/.mk\-sbuild.schroot.conf[.$SCHROOT_TYPE]
|
||||||
Can contain a customized configuration section to be inserted into
|
Can contain a customized configuration section to be inserted into
|
||||||
/etc/schroot/schroot.conf.
|
/etc/schroot/schroot.conf.
|
||||||
|
If a file with ".lvm-snapshot" or ".directory" is found (based on the presence
|
||||||
|
of the \-\-vg argument) that file will use used instead.
|
||||||
See schroot.conf(5) for more details on the format.
|
See schroot.conf(5) for more details on the format.
|
||||||
.SH USING THE CHROOTS
|
.SH USING THE CHROOTS
|
||||||
.TP
|
.TP
|
||||||
To CHANGE the golden image: \fBschroot \-c ${CHROOT_NAME}\-source \-u root\fR
|
To CHANGE the golden image: \fBsudo schroot \-c ${CHROOT_NAME}\-source \-u root\fR
|
||||||
.TP
|
.TP
|
||||||
To ENTER an image snapshot: \fBschroot \-c ${CHROOT_NAME}\fR
|
To ENTER an image snapshot: \fBschroot \-c ${CHROOT_NAME}\fR
|
||||||
.TP
|
.TP
|
||||||
@ -83,6 +95,6 @@ sbuild\-setup (7), sources.list (5), schroot.conf (5),
|
|||||||
https://help.ubuntu.com/community/SbuildLVMHowto
|
https://help.ubuntu.com/community/SbuildLVMHowto
|
||||||
|
|
||||||
.SH AUTHOR
|
.SH AUTHOR
|
||||||
\fBmk\-sbuild\-lv\fR was written by Kees Cook <kees@ubuntu.com>.
|
\fBmk\-sbuild\fR was written by Kees Cook <kees@ubuntu.com>.
|
||||||
This man page was written by Ryan Kavanagh <ryanakca@kubuntu.org>.
|
This man page was written by Ryan Kavanagh <ryanakca@kubuntu.org>.
|
||||||
Both are released under the GNU General Public License, version 3 or later.
|
Both are released under the GNU General Public License, version 3 or later.
|
@ -1,6 +1,6 @@
|
|||||||
#!/bin/bash
|
#!/bin/bash
|
||||||
#
|
#
|
||||||
# Copyright 2006-2009 (C) Canonical Ltd.
|
# Copyright 2006-2010 (C) Canonical Ltd.
|
||||||
# Author: Kees Cook <kees@ubuntu.com>
|
# Author: Kees Cook <kees@ubuntu.com>
|
||||||
#
|
#
|
||||||
# ##################################################################
|
# ##################################################################
|
||||||
@ -19,7 +19,8 @@
|
|||||||
#
|
#
|
||||||
# ##################################################################
|
# ##################################################################
|
||||||
#
|
#
|
||||||
# This script creates LVM snapshot chroots via schroot and sbuild.
|
# This script creates chroots designed to be used in a snapshot mode
|
||||||
|
# (either with LVM or aufs) with schroot and sbuild.
|
||||||
# Much love to "man sbuild-setup", https://wiki.ubuntu.com/PbuilderHowto,
|
# Much love to "man sbuild-setup", https://wiki.ubuntu.com/PbuilderHowto,
|
||||||
# and https://help.ubuntu.com/community/SbuildLVMHowto.
|
# and https://help.ubuntu.com/community/SbuildLVMHowto.
|
||||||
#
|
#
|
||||||
@ -40,11 +41,6 @@ fi
|
|||||||
if [ ! -w /var/lib/sbuild ]; then
|
if [ ! -w /var/lib/sbuild ]; then
|
||||||
# Load all the packages you'll need to do work
|
# Load all the packages you'll need to do work
|
||||||
sudo apt-get install sbuild schroot debootstrap lvm2
|
sudo apt-get install sbuild schroot debootstrap lvm2
|
||||||
# Make sure LVM tools that operate on the snapshots have needed module
|
|
||||||
if ! sudo dmsetup targets | grep -q ^snapshot; then
|
|
||||||
sudo modprobe dm_snapshot
|
|
||||||
echo dm_snapshot | sudo tee -a /etc/modules >/dev/null
|
|
||||||
fi
|
|
||||||
# Add self to the sbuild group
|
# Add self to the sbuild group
|
||||||
sudo adduser "$USER" sbuild
|
sudo adduser "$USER" sbuild
|
||||||
|
|
||||||
@ -98,23 +94,27 @@ fi
|
|||||||
# Set up configurable defaults (loaded after option processing)
|
# Set up configurable defaults (loaded after option processing)
|
||||||
LV_SIZE="5G"
|
LV_SIZE="5G"
|
||||||
SNAPSHOT_SIZE="4G"
|
SNAPSHOT_SIZE="4G"
|
||||||
|
SOURCE_CHROOTS_DIR="/var/lib/schroot/chroots"
|
||||||
|
|
||||||
function usage()
|
function usage()
|
||||||
{
|
{
|
||||||
echo "Usage: $0 [OPTIONS] VG Release" >&2
|
echo "Usage: $0 [OPTIONS] Release" >&2
|
||||||
echo "Options:"
|
echo "Options:"
|
||||||
echo " --arch=ARCH What architecture to select"
|
echo " --arch=ARCH What architecture to select"
|
||||||
echo " --name=NAME Base name for the schroot (arch is appended)"
|
echo " --name=NAME Base name for the schroot (arch is appended)"
|
||||||
echo " --personality=PERSONALITY What personality to use (defaults to match --arch)"
|
echo " --personality=PERSONALITY What personality to use (defaults to match --arch)"
|
||||||
|
echo " --vg=VG use LVM snapshots, with group VG"
|
||||||
echo " --debug Turn on script debugging"
|
echo " --debug Turn on script debugging"
|
||||||
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 " --distro=DISTRO Install specific distro (defaults to 'ubuntu')"
|
echo " --distro=DISTRO Install specific distro:"
|
||||||
|
echo " 'ubuntu'(default), or 'debian'"
|
||||||
echo ""
|
echo ""
|
||||||
echo "Configuration (via ~/.mk-sbuild-lv.rc)"
|
echo "Configuration (via ~/.mk-sbuild.rc)"
|
||||||
echo " LV_SIZE Size of source LVs (default ${LV_SIZE})"
|
echo " LV_SIZE Size of source LVs (default ${LV_SIZE})"
|
||||||
echo " SNAPSHOT_SIZE Size of snapshot LVs (default ${SNAPSHOT_SIZE})"
|
echo " SNAPSHOT_SIZE Size of snapshot LVs (default ${SNAPSHOT_SIZE})"
|
||||||
|
echo " SOURCE_CHROOTS_DIR Directory to put aufs source chroots into"
|
||||||
echo " SCHROOT_CONF_SUFFIX Lines to append to schroot.conf entries"
|
echo " SCHROOT_CONF_SUFFIX Lines to append to schroot.conf entries"
|
||||||
echo " SKIP_UPDATES Enable --skip-updates"
|
echo " SKIP_UPDATES Enable --skip-updates"
|
||||||
echo " TEMPLATE_SOURCES A template for sources.list"
|
echo " TEMPLATE_SOURCES A template for sources.list"
|
||||||
@ -126,9 +126,10 @@ 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:,distro:" -- "$@"`
|
OPTS=`getopt -o '' --long "help,debug,skip-updates,arch:,name:,source-template:,debootstrap-mirror:,personality:,distro:,volume-group:,vg:" -- "$@"`
|
||||||
eval set -- "$OPTS"
|
eval set -- "$OPTS"
|
||||||
|
|
||||||
|
VG=""
|
||||||
DISTRO="ubuntu"
|
DISTRO="ubuntu"
|
||||||
name=""
|
name=""
|
||||||
while :; do
|
while :; do
|
||||||
@ -176,6 +177,10 @@ while :; do
|
|||||||
DISTRO="$2"
|
DISTRO="$2"
|
||||||
shift 2
|
shift 2
|
||||||
;;
|
;;
|
||||||
|
--volume-group|--vg)
|
||||||
|
VG="$2"
|
||||||
|
shift 2
|
||||||
|
;;
|
||||||
--)
|
--)
|
||||||
shift
|
shift
|
||||||
break
|
break
|
||||||
@ -186,11 +191,9 @@ while :; do
|
|||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
# To build the LV, we need to know which volume group to use, and which
|
# We need to know the release to debootstrap
|
||||||
# release of Ubuntu to debootstrap
|
RELEASE="$1"
|
||||||
VG="$1"
|
if [ -z "$RELEASE" ]; then
|
||||||
RELEASE="$2"
|
|
||||||
if [ -z "$VG" ] || [ -z "$RELEASE" ]; then
|
|
||||||
usage
|
usage
|
||||||
fi
|
fi
|
||||||
|
|
||||||
@ -199,9 +202,6 @@ if [ -z "$name" ]; then
|
|||||||
name="$RELEASE"
|
name="$RELEASE"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Set up some variables for use in the paths and names
|
|
||||||
CHROOT_LV="${name}_chroot${arch_suffix}"
|
|
||||||
CHROOT_PATH="/dev/$VG/$CHROOT_LV"
|
|
||||||
CHROOT_NAME="${name}${arch_suffix}"
|
CHROOT_NAME="${name}${arch_suffix}"
|
||||||
|
|
||||||
HOST_ARCH=$(dpkg --print-architecture)
|
HOST_ARCH=$(dpkg --print-architecture)
|
||||||
@ -210,21 +210,50 @@ if [ -z "$CHROOT_ARCH" ]; then
|
|||||||
fi
|
fi
|
||||||
|
|
||||||
# Load customizations
|
# Load customizations
|
||||||
if [ -r ~/.mk-sbuild-lv.rc ]; then
|
if [ -r ~/.mk-sbuild.rc ]; then
|
||||||
. ~/.mk-sbuild-lv.rc
|
. ~/.mk-sbuild.rc
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Does the specified VG exist? (vgdisplay doesn't set error codes...)
|
SRC_TYPE="union"
|
||||||
if [ `sudo vgdisplay -c "$VG" | wc -l` -eq 0 ]; then
|
SCHROOT_CONF_TYPE="directory"
|
||||||
exit 1
|
# To build the LV, we need to know which volume group to use
|
||||||
|
if [ -n "${VG}" ]; then
|
||||||
|
SRC_TYPE="lvm"
|
||||||
|
SCHROOT_CONF_TYPE="lvm-snapshot"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case "$SRC_TYPE" in
|
||||||
|
"lvm")
|
||||||
|
# Make sure LVM tools that operate on the snapshots have needed module
|
||||||
|
if ! sudo dmsetup targets | grep -q ^snapshot; then
|
||||||
|
sudo modprobe dm_snapshot
|
||||||
|
echo dm_snapshot | sudo tee -a /etc/modules >/dev/null
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Set up some variables for use in the paths and names
|
||||||
|
CHROOT_LV="${name}_chroot${arch_suffix}"
|
||||||
|
CHROOT_PATH="/dev/$VG/$CHROOT_LV"
|
||||||
|
# Does the specified VG exist? (vgdisplay doesn't set error codes...)
|
||||||
|
if [ `sudo vgdisplay -c "$VG" | wc -l` -eq 0 ]; then
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
"union")
|
||||||
|
if [ ! -d "${SOURCE_CHROOTS_DIR}" ]; then
|
||||||
|
sudo mkdir -p "${SOURCE_CHROOTS_DIR}"
|
||||||
|
fi
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo 'unknown source type!?' >&2
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# Is the specified release known to debootstrap?
|
# Is the specified release known to debootstrap?
|
||||||
|
variant_opt="--variant=buildd"
|
||||||
if [ ! -r "/usr/share/debootstrap/scripts/$RELEASE" ]; then
|
if [ ! -r "/usr/share/debootstrap/scripts/$RELEASE" ]; then
|
||||||
echo "Specified release not known to debootstrap" >&2
|
echo "Specified release not known to debootstrap" >&2
|
||||||
exit 1
|
exit 1
|
||||||
else
|
|
||||||
variant_opt="--variant=buildd"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BUILD_PKGS="build-essential fakeroot devscripts apt-utils"
|
BUILD_PKGS="build-essential fakeroot devscripts apt-utils"
|
||||||
@ -305,30 +334,45 @@ debian)
|
|||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
# Allocate the "golden" chroot LV
|
|
||||||
sudo lvcreate -n "$CHROOT_LV" -L "$LV_SIZE" "$VG"
|
|
||||||
sudo mkfs -t ext4 "$CHROOT_PATH"
|
|
||||||
|
|
||||||
# Mount and debootstrap the chroot
|
|
||||||
MNT=`mktemp -d -t schroot-XXXXXX`
|
|
||||||
sudo mount "$CHROOT_PATH" "$MNT"
|
|
||||||
|
|
||||||
DEBOOTSTRAP_COMMAND=debootstrap
|
DEBOOTSTRAP_COMMAND=debootstrap
|
||||||
# Use qemu-arm-static / build-arm-chroot for foreign armel chroots
|
# Use qemu-arm-static / build-arm-chroot for foreign armel chroots
|
||||||
if [ "$CHROOT_ARCH" = 'armel' ] && [ ! "$HOST_ARCH" = 'armel' ] ; then
|
if [ "$CHROOT_ARCH" = 'armel' ] && [ ! "$HOST_ARCH" = 'armel' ] ; then
|
||||||
if [ -f "/usr/bin/build-arm-chroot" ]; then
|
if [ -f "/usr/bin/build-arm-chroot" ]; then
|
||||||
DEBOOTSTRAP_COMMAND=build-arm-chroot
|
DEBOOTSTRAP_COMMAND=build-arm-chroot
|
||||||
else
|
else
|
||||||
echo Please install qemu-arm-static to use foreign armel chroots
|
echo 'Please install qemu-arm-static to use foreign armel chroots' >&2
|
||||||
|
exit 1
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
case "$SRC_TYPE" in
|
||||||
|
"lvm")
|
||||||
|
# Allocate the "golden" chroot LV
|
||||||
|
sudo lvcreate -n "$CHROOT_LV" -L "$LV_SIZE" "$VG"
|
||||||
|
sudo mkfs -t ext4 "$CHROOT_PATH"
|
||||||
|
|
||||||
|
# Mount
|
||||||
|
MNT=`mktemp -d -t schroot-XXXXXX`
|
||||||
|
sudo mount "$CHROOT_PATH" "$MNT"
|
||||||
|
;;
|
||||||
|
"union")
|
||||||
|
CHROOT_PATH="${SOURCE_CHROOTS_DIR}/${CHROOT_NAME}"
|
||||||
|
MNT="${CHROOT_PATH}"
|
||||||
|
if [ -d "${MNT}" ]; then
|
||||||
|
echo "E: ${MNT} already exists; aborting" >&2
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
sudo mkdir -p "${MNT}"
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
# debootstrap the chroot
|
||||||
sudo $DEBOOTSTRAP_COMMAND $arch_opt $variant_opt "$RELEASE" "$MNT" "${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu}"
|
sudo $DEBOOTSTRAP_COMMAND $arch_opt $variant_opt "$RELEASE" "$MNT" "${DEBOOTSTRAP_MIRROR:-http://archive.ubuntu.com/ubuntu}"
|
||||||
|
|
||||||
# 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
|
||||||
TEMPLATE_SOURCES=~/.mk-sbuild-lv.sources
|
TEMPLATE_SOURCES=~/.mk-sbuild.sources
|
||||||
fi
|
fi
|
||||||
if [ -r "$TEMPLATE_SOURCES" ]; then
|
if [ -r "$TEMPLATE_SOURCES" ]; then
|
||||||
cat "$TEMPLATE_SOURCES" > "$TEMP_SOURCES"
|
cat "$TEMPLATE_SOURCES" > "$TEMP_SOURCES"
|
||||||
@ -355,28 +399,41 @@ cat "$TEMP_SOURCES" | sed -e "s|RELEASE|$RELEASE|g" | \
|
|||||||
rm -f "$TEMP_SOURCES"
|
rm -f "$TEMP_SOURCES"
|
||||||
# Copy the timezone (comment this out if you want to leave the chroot at UTC)
|
# Copy the timezone (comment this out if you want to leave the chroot at UTC)
|
||||||
sudo cp /etc/localtime /etc/timezone "$MNT"/etc/
|
sudo cp /etc/localtime /etc/timezone "$MNT"/etc/
|
||||||
# Create an LVM-snapshot-based schroot entry for this LV
|
# Create a schroot entry for this chroot
|
||||||
TEMP_SCHROOTCONF=`mktemp -t schrootconf-XXXXXX`
|
TEMP_SCHROOTCONF=`mktemp -t schrootconf-XXXXXX`
|
||||||
TEMPLATE_SCHROOTCONF=~/.mk-sbuild-lv.schroot.conf
|
TEMPLATE_SCHROOTCONF=~/.mk-sbuild.schroot.conf
|
||||||
if [ -r "$TEMPLATE_SCHROOTCONF" ]; then
|
TYPED_TEMPLATE_SCHROOTCONF="${TEMPLATE_SCHROOTCONF}.${SCHROOT_CONF_TYPE}"
|
||||||
|
|
||||||
|
if [ -r "${TYPED_TEMPLATE_SCHROOTCONF}" ]; then
|
||||||
|
cat "${TYPED_TEMPLATE_SCHROOTCONF}" > "$TEMP_SCHROOTCONF"
|
||||||
|
elif [ -r "${TEMPLATE_SCHROOT}" ]; then
|
||||||
cat "$TEMPLATE_SCHROOTCONF" > "$TEMP_SCHROOTCONF"
|
cat "$TEMPLATE_SCHROOTCONF" > "$TEMP_SCHROOTCONF"
|
||||||
else
|
else
|
||||||
cat > "$TEMP_SCHROOTCONF" <<EOM
|
cat > "$TEMP_SCHROOTCONF" <<EOM
|
||||||
|
|
||||||
[CHROOT_NAME]
|
[CHROOT_NAME]
|
||||||
type=lvm-snapshot
|
|
||||||
description=CHROOT_NAME
|
description=CHROOT_NAME
|
||||||
priority=3
|
priority=3
|
||||||
groups=sbuild,root,admin
|
groups=sbuild,root,admin
|
||||||
root-groups=root,sbuild,admin
|
root-groups=root,sbuild,admin
|
||||||
device=CHROOT_PATH
|
|
||||||
mount-options=-o noatime
|
|
||||||
lvm-snapshot-options=--size SNAPSHOT_SIZE
|
|
||||||
# Uncomment these lines to allow "sbuild" and "admin" users to access
|
# Uncomment these lines to allow "sbuild" and "admin" users to access
|
||||||
# the -source chroots directly (useful for automated updates, etc).
|
# the -source chroots directly (useful for automated updates, etc).
|
||||||
#source-root-users=root,sbuild,admin
|
#source-root-users=root,sbuild,admin
|
||||||
#source-root-groups=root,sbuild,admin
|
#source-root-groups=root,sbuild,admin
|
||||||
|
type=SCHROOT_CONF_TYPE
|
||||||
EOM
|
EOM
|
||||||
|
if [ "${SRC_TYPE}" = "lvm" ]; then
|
||||||
|
cat >> "$TEMP_SCHROOTCONF" <<EOM
|
||||||
|
device=CHROOT_PATH
|
||||||
|
mount-options=-o noatime
|
||||||
|
lvm-snapshot-options=--size SNAPSHOT_SIZE
|
||||||
|
EOM
|
||||||
|
elif [ "${SRC_TYPE}" = "union" ]; then
|
||||||
|
cat >> "${TEMP_SCHROOTCONF}" <<EOM
|
||||||
|
union-type=aufs
|
||||||
|
directory=CHROOT_PATH
|
||||||
|
EOM
|
||||||
|
fi
|
||||||
fi
|
fi
|
||||||
if [ ! -z "$personality" ]; then
|
if [ ! -z "$personality" ]; then
|
||||||
echo "personality=$personality" >> "$TEMP_SCHROOTCONF"
|
echo "personality=$personality" >> "$TEMP_SCHROOTCONF"
|
||||||
@ -388,6 +445,7 @@ cat "$TEMP_SCHROOTCONF" | sed \
|
|||||||
-e "s|CHROOT_NAME|$CHROOT_NAME|g" \
|
-e "s|CHROOT_NAME|$CHROOT_NAME|g" \
|
||||||
-e "s|CHROOT_PATH|$CHROOT_PATH|g" \
|
-e "s|CHROOT_PATH|$CHROOT_PATH|g" \
|
||||||
-e "s|SNAPSHOT_SIZE|$SNAPSHOT_SIZE|g" \
|
-e "s|SNAPSHOT_SIZE|$SNAPSHOT_SIZE|g" \
|
||||||
|
-e "s|SCHROOT_CONF_TYPE|$SCHROOT_CONF_TYPE|g" \
|
||||||
| \
|
| \
|
||||||
sudo bash -c "cat >> /etc/schroot/schroot.conf"
|
sudo bash -c "cat >> /etc/schroot/schroot.conf"
|
||||||
rm -f "$TEMP_SCHROOTCONF"
|
rm -f "$TEMP_SCHROOTCONF"
|
||||||
@ -416,9 +474,12 @@ 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 chmod +x "$MNT"/finish.sh
|
sudo chmod a+x "$MNT"/finish.sh
|
||||||
sudo umount "$MNT"
|
|
||||||
rmdir "$MNT"
|
if [ "$SRC_TYPE" = "lvm" ]; then
|
||||||
|
sudo umount "$MNT"
|
||||||
|
rmdir "$MNT"
|
||||||
|
fi
|
||||||
# Run finalization script on the "golden" copy via schroot.
|
# Run finalization script on the "golden" copy via schroot.
|
||||||
sudo schroot -c "$CHROOT_NAME"-source -u root /finish.sh
|
sudo schroot -c "$CHROOT_NAME"-source -u root /finish.sh
|
||||||
|
|
2
setup.py
2
setup.py
@ -29,7 +29,7 @@ setup(name='ubuntu-dev-tools',
|
|||||||
'lp-shell',
|
'lp-shell',
|
||||||
'manage-credentials',
|
'manage-credentials',
|
||||||
'massfile',
|
'massfile',
|
||||||
'mk-sbuild-lv',
|
'mk-sbuild',
|
||||||
'pbuilder-dist',
|
'pbuilder-dist',
|
||||||
'pbuilder-dist-simple',
|
'pbuilder-dist-simple',
|
||||||
'pull-debian-debdiff',
|
'pull-debian-debdiff',
|
||||||
|
Loading…
x
Reference in New Issue
Block a user