mirror of
https://git.launchpad.net/ubuntu-dev-tools
synced 2025-03-13 08:01:09 +00:00
Merge improvements to mk-sbuild, fixing typo in manpage
This commit is contained in:
commit
328def15a2
16
debian/changelog
vendored
16
debian/changelog
vendored
@ -1,3 +1,19 @@
|
||||
ubuntu-dev-tools (0.124) UNRELEASED; urgency=low
|
||||
|
||||
* mk-sbuild:
|
||||
- Disable daemons with a policy-rc.d script (like pbuilder does)
|
||||
- Move package installation after option parsing.
|
||||
- Exit 0 when showing help, and support -h.
|
||||
- Determine distribution from release name (via distro-info).
|
||||
- Reformat manpage.
|
||||
- Install qemu-user-static instead of qemu-kvm-extras-static.
|
||||
- Put schroot configuration in chroot.d/sbuild-$chroot (LP: #736808)
|
||||
- Understand Debian distribution synonyms, and store the chroot under the
|
||||
code name.
|
||||
- Support Debian experimental.
|
||||
|
||||
-- Stefano Rivera <stefanor@debian.org> Sun, 24 Apr 2011 20:35:51 +0200
|
||||
|
||||
ubuntu-dev-tools (0.122) unstable; urgency=low
|
||||
|
||||
[ Ted Gould ]
|
||||
|
124
doc/mk-sbuild.1
124
doc/mk-sbuild.1
@ -4,10 +4,7 @@
|
||||
mk\-sbuild \- creates chroots via schroot and sbuild
|
||||
|
||||
.SH SYNOPSIS
|
||||
\fBmk\-sbuild\fR [\fB\-\-arch=ARCH\fR] [\fB\-\-name=NAME\fR]
|
||||
[\fB\-\-personality=PERSONALITY\fR] [\fB\-\-debug\fR] [\fB\-\-source\-template=FILE\fR]
|
||||
[\fB\-\-debootstrap\-mirror=URL\fR] [\fB\-\-distro=DISTRO\fR]
|
||||
[\fB\-\-vg=VOLUME_GROUP\fR] [\fB\-\-type=SCHROOT_TYPE\fR] <\fBRelease\fR>
|
||||
\fBmk\-sbuild\fR [\fIoptions\fR...] <\fIrelease\fR>
|
||||
|
||||
.SH DESCRIPTION
|
||||
\fBmk\-sbuild\fR creates chroots via schroot and sbuild.
|
||||
@ -15,49 +12,54 @@ mk\-sbuild \- creates chroots via schroot and sbuild
|
||||
.SH OPTIONS
|
||||
Listed below are the command line options for mk\-sbuild:
|
||||
.TP
|
||||
.B \-\-arch=ARCH
|
||||
.B \-\-arch\fR=\fIARCH
|
||||
What architecture to select (defaults to the native architecture).
|
||||
.TP
|
||||
.B \-\-name=NAME
|
||||
.B \-\-name\fR=\fINAME
|
||||
Base name for the schroot (arch is appended).
|
||||
.TP
|
||||
.B \-\-personality=PERSONALITY
|
||||
What personality to use (defaults to match \-\-arch).
|
||||
.B \-\-personality\fR=\fIPERSONALITY
|
||||
What personality to use (defaults to match \fB\-\-arch\fR).
|
||||
.TP
|
||||
.B \-\-debug
|
||||
Turn on script debugging.
|
||||
.TP
|
||||
.B \-\-skip\-updates
|
||||
Do not include the \-updates pocket in the installed sources.list.
|
||||
Do not include the \fB\-updates\fR pocket in the installed
|
||||
\fBsources.list\fR.
|
||||
.TP
|
||||
.B \-\-source\-template=FILE
|
||||
Use FILE as the sources.list template (defaults to $HOME/.mk\-sbuild.sources).
|
||||
.B \-\-source\-template\fR=\fIFILE
|
||||
Use \fIFILE\fR as the \fBsources.list\fR template (defaults to
|
||||
\fI$HOME\fB/.mk\-sbuild.sources\fR).
|
||||
.TP
|
||||
.B \-\-debootstrap\-mirror=URL
|
||||
Use URL as the debootstrap source (defaults to http://ports.ubuntu.com for lpia,
|
||||
official Ubuntu repositories for the supported architectures).
|
||||
.B \-\-debootstrap\-mirror\fR=\fIURL
|
||||
Use \fIURL\fR as the debootstrap source (defaults to
|
||||
\fBhttp://ports.ubuntu.com\fR where appropriate, official Ubuntu
|
||||
repositories for the supported architectures).
|
||||
.TP
|
||||
.B \-\-debootstrap\-include=alpha,beta
|
||||
Pass along a comma separated list of packages to debootstrap's \-\-include
|
||||
argument. See debootstrap (8) for more details.
|
||||
.B \-\-debootstrap\-include\fR=\fIalpha,beta
|
||||
Pass along a comma separated list of packages to debootstrap's
|
||||
\fB\-\-include\fR argument. See \fBdebootstrap\fR (8) for more details.
|
||||
.TP
|
||||
.B \-\-debootstrap\-exclude=alpha,beta
|
||||
Pass along a comma separated list of packages to debootstrap's \-\-exclude
|
||||
argument. WARNING: be careful using this option as you can end up
|
||||
excluding essential package. See debootstrap (8) for more details.
|
||||
.B \-\-debootstrap\-exclude\fR=\fIalpha,beta
|
||||
Pass along a comma separated list of packages to debootstrap's
|
||||
\fB\-\-exclude\fR argument.
|
||||
\fBWARNING:\fR be careful using this option as you can end up
|
||||
excluding essential package. See \fBdebootstrap \fR(8) for more details.
|
||||
.TP
|
||||
.B \-\-distro=DISTRO
|
||||
Enable distro-specific logic. Currently known distros: "ubuntu" (default)
|
||||
and "debian".
|
||||
.B \-\-distro\fR=\fIDISTRO
|
||||
Enable distro-specific logic.
|
||||
When not provided, the distribution is determined from \fIrelease\fR.
|
||||
Currently known distros: "\fBdebian\fR" and "\fBubuntu\fR".
|
||||
.TP
|
||||
.B \-\-vg=VOLUME_GROUP
|
||||
Specify a volume group, and subsequently use a default SCHROOT_TYPE of
|
||||
"lvm-snapshot" rather than "directory" (via aufs) mounts.
|
||||
.B \-\-vg\fR=\fIVOLUME_GROUP
|
||||
Specify a volume group, and subsequently use a default \fBSCHROOT_TYPE\fR of
|
||||
"\fBlvm-snapshot\fR" rather than "\fBdirectory\fR" (via aufs) mounts.
|
||||
.TP
|
||||
.B \-\-type=SHROOT_TYPE
|
||||
Specify a SCHROOT_TYPE. Supported values are "directory" (default if
|
||||
\-\-vg not specified), "lvm-snapshot" (default if \-\-vg specified),
|
||||
"btrfs-snapshot", and "file".
|
||||
.B \-\-type\fR=\fISHROOT_TYPE
|
||||
Specify a \fBSCHROOT_TYPE\fR. Supported values are "\fBdirectory\fR"
|
||||
(default if \fB\-\-vg\fR not specified), "\fBlvm-snapshot\fR" (default
|
||||
if \fB\-\-vg\fR specified), "\fBbtrfs-snapshot\fR", and "\fBfile\fR".
|
||||
|
||||
.SH ENVIRONMENT VARIABLES
|
||||
.TP
|
||||
@ -71,61 +73,67 @@ Size of snapshot LVs (defaults to 4G).
|
||||
Lines to append to schroot entries.
|
||||
.TP
|
||||
.B SKIP_UPDATES
|
||||
Do not include the \-updates pocket in the installed sources.list.
|
||||
Do not include the \fB\-updates\fR pocket (same as
|
||||
\fB\-\-skip\-updates\fR)
|
||||
.TP
|
||||
.B DEBOOTSTRAP_MIRROR
|
||||
Mirror location (same as \-\-debootstrap-mirror)
|
||||
Mirror location (same as \fB\-\-debootstrap-mirror\fR)
|
||||
.TP
|
||||
.B DEBOOTSTRAP_INCLUDE
|
||||
Comma separated list of packages to include when bootstrapping (same as \-\-debootstrap-include)
|
||||
Comma separated list of packages to include when bootstrapping (same as
|
||||
\fB\-\-debootstrap-include\fR)
|
||||
.TP
|
||||
.B DEBOOTSTRAP_EXCLUDE
|
||||
Comma separated list of packages to exclude when bootstrapping (same as \-\-debootstrap-exclude; see warning above)
|
||||
Comma separated list of packages to exclude when bootstrapping (same as
|
||||
\fB\-\-debootstrap-exclude\fR; see warning above)
|
||||
.TP
|
||||
.B SOURCE_CHROOTS_DIR
|
||||
use SOURCE_CHROOTS_DIR as home of schroot source directories. (default
|
||||
/var/lib/schroot/chroots)
|
||||
Use \fBSOURCE_CHROOTS_DIR\fR as home of schroot source directories.
|
||||
(default \fB/var/lib/schroot/chroots\fR)
|
||||
.TP
|
||||
.B SOURCE_CHROOTS_TGZ
|
||||
use SOURCE_CHROOTS_TGZ as home of schroot source tarballs. (default
|
||||
/var/lib/schroot/tarballs)
|
||||
Use \fBSOURCE_CHROOTS_TGZ\fR as home of schroot source tarballs.
|
||||
(default \fB/var/lib/schroot/tarballs\fR)
|
||||
.TP
|
||||
.B CHROOT_SNAPSHOT_DIR
|
||||
use CHROOT_SNAPSHOT_DIR as home of mounted btrfs snapshots (default
|
||||
/var/lib/schroot/snapshots)
|
||||
Use \fBCHROOT_SNAPSHOT_DIR\fR as home of mounted btrfs snapshots.
|
||||
(default \fB/var/lib/schroot/snapshots\fR)
|
||||
|
||||
|
||||
.SH FILES
|
||||
.TP
|
||||
.B $HOME/.mk\-sbuild.rc
|
||||
.IB $HOME /.mk\-sbuild.rc
|
||||
Sourced for environment variables (defined above).
|
||||
.TP
|
||||
.B $HOME/.mk\-sbuild.sources[.$DISTRO]
|
||||
Can contain a customized sources.list.
|
||||
.IB $HOME /.mk\-sbuild.sources\fR[\fB. $DISTRO\fR]
|
||||
Can contain a customized \fBsources.list\fR.
|
||||
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.
|
||||
If a file with "\fB.ubuntu\fR" or "\fB.debian\fR" is found (as
|
||||
appropriate) it will use used instead.
|
||||
See \fBsources.list\fR (5) for more details on the format.
|
||||
.TP
|
||||
.B $HOME/.mk\-sbuild.schroot.conf[.$SCHROOT_TYPE]
|
||||
.IB $HOME /.mk\-sbuild.schroot.conf\fR[\fB. $SCHROOT_TYPE\fR]
|
||||
Can contain a customized configuration section to be inserted into
|
||||
/etc/schroot/schroot.conf.
|
||||
If a file with ".lvm-snapshot", ".directory", or ".file" is found (based on the
|
||||
values of the \-\-vg and \-\-type arguments) that file will use used instead.
|
||||
See schroot.conf(5) for more details on the format.
|
||||
\fB/etc/schroot/schroot.conf\fR.
|
||||
If a file with "\fB.lvm-snapshot\fR", "\fB.directory\fR", "\fB.file\fR",
|
||||
or "\fBbtrfs-snapshot\fR" is found (as appropriate) that file will use used instead.
|
||||
See \fBschroot.conf\fR (5) for more details on the format.
|
||||
.SH USING THE CHROOTS
|
||||
.TP
|
||||
To CHANGE the golden image: \fBsudo schroot \-c ${CHROOT_NAME}\-source \-u root\fR
|
||||
To CHANGE the golden image: \fBsudo schroot \-c \fI${SCHROOT_NAME}\fB\-source \-u root\fR
|
||||
.TP
|
||||
To ENTER an image snapshot: \fBschroot \-c ${CHROOT_NAME}\fR
|
||||
To ENTER an image snapshot: \fBschroot \-c \fI$SCHROOT_NAME\fR
|
||||
.TP
|
||||
To BUILD within a snapshot: \fBsbuild \-A \-d ${SCHROOT_NAME} PACKAGE*.dsc\fR
|
||||
To BUILD within a snapshot: \fBsbuild \-A \-d \fI$SCHROOT_NAME $PACKAGE\fB*.dsc\fR
|
||||
.TP
|
||||
for example, to update the packages in a golden image: \fBschroot \-c ${CHROOT_NAME}\-source \-u root -- sh \-c "apt-get \-qq update && apt-get \-qy upgrade && apt-get clean" </dev/null\fR
|
||||
for example, to update the packages in a \fBsid\-amd64\fR golden image:
|
||||
\fBschroot \-c sid\-amd64\-source \-u root -- sh \-c "apt-get \-qq update && apt-get \-qy upgrade && apt-get clean" </dev/null\fR
|
||||
|
||||
.SH SEE ALSO
|
||||
sbuild\-setup (7), sources.list (5), schroot.conf (5),
|
||||
https://help.ubuntu.com/community/SbuildLVMHowto
|
||||
.BR sbuild\-setup (7),
|
||||
.BR sources.list (5),
|
||||
.BR schroot.conf (5),
|
||||
.B https://help.ubuntu.com/community/SbuildLVMHowto
|
||||
|
||||
.SH AUTHOR
|
||||
\fBmk\-sbuild\fR was written by Kees Cook <kees@ubuntu.com>.
|
||||
|
340
mk-sbuild
340
mk-sbuild
@ -5,6 +5,7 @@
|
||||
# Kees Cook <kees@ubuntu.com>
|
||||
# Emmet Hikory <persia@ubuntu.com>
|
||||
# Scott Moser <smoser@ubuntu.com>
|
||||
# Stefano Rivera <stefanor@ubuntu.com>
|
||||
#
|
||||
# ##################################################################
|
||||
#
|
||||
@ -30,6 +31,131 @@
|
||||
# It will deal with sbuild having not be installed and configured before.
|
||||
set -e
|
||||
|
||||
# Set up configurable defaults (loaded after option processing)
|
||||
LV_SIZE="5G"
|
||||
SNAPSHOT_SIZE="4G"
|
||||
SOURCE_CHROOTS_DIR="/var/lib/schroot/chroots"
|
||||
SOURCE_CHROOTS_TGZ="/var/lib/schroot/tarballs"
|
||||
CHROOT_SNAPSHOT_DIR="/var/lib/schroot/snapshots"
|
||||
|
||||
function usage()
|
||||
{
|
||||
echo "Usage: $0 [OPTIONS] Release" >&2
|
||||
echo "Options:"
|
||||
echo " --arch=ARCH What architecture to select"
|
||||
echo " --name=NAME Base name for the schroot (arch is appended)"
|
||||
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 " --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 " --debootstrap-include=list Comma separated list of packages to include"
|
||||
echo " --debootstrap-exclude=list Comma separated list of packages to exclude"
|
||||
echo " --distro=DISTRO Install specific distro:"
|
||||
echo " 'ubuntu' or 'debian' "
|
||||
echo " (defaults to determining from release name)"
|
||||
echo " --type=SCHROOT_TYPE Define the schroot type:"
|
||||
echo " 'directory'(default), 'file', or 'btrfs-snapshot'"
|
||||
echo " 'lvm-snapshot' is selected via --vg"
|
||||
echo ""
|
||||
echo "Configuration (via ~/.mk-sbuild.rc)"
|
||||
echo " LV_SIZE Size of source LVs (default ${LV_SIZE})"
|
||||
echo " SNAPSHOT_SIZE Size of snapshot LVs (default ${SNAPSHOT_SIZE})"
|
||||
echo " SOURCE_CHROOTS_DIR Directory to store directory source chroots"
|
||||
echo " SOURCE_CHROOTS_TGZ Directory to store file source chroots"
|
||||
echo " CHROOT_SNAPSHOT_DIR Directory to mount open btrfs snaphshot chroots (default ${CHROOT_SNAPSHOT_DIR})"
|
||||
echo " SCHROOT_CONF_SUFFIX Lines to append to schroot.conf entries"
|
||||
echo " SKIP_UPDATES Enable --skip-updates"
|
||||
echo " DEBOOTSTRAP_MIRROR Mirror location (same as --debootstrap-mirror)"
|
||||
echo " DEBOOTSTRAP_INCLUDE Included packages (same as --debootstrap-include)"
|
||||
echo " DEBOOTSTRAP_EXCLUDE Excluded packages (same as --debootstrap-exclude)"
|
||||
echo " TEMPLATE_SOURCES A template for sources.list"
|
||||
echo " TEMPLATE_SCHROOTCONF A template for schroot.conf stanza"
|
||||
if [ -z "$1" ]; then
|
||||
exit 1
|
||||
fi
|
||||
exit $1
|
||||
}
|
||||
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
usage
|
||||
fi
|
||||
OPTS=`getopt -o 'h' --long "help,debug,skip-updates,arch:,name:,source-template:,debootstrap-mirror:,debootstrap-include:,debootstrap-exclude:,personality:,distro:,vg:,type:" -- "$@"`
|
||||
eval set -- "$OPTS"
|
||||
|
||||
VG=""
|
||||
DISTRO=""
|
||||
name=""
|
||||
while :; do
|
||||
case "$1" in
|
||||
--debug)
|
||||
set -x
|
||||
shift
|
||||
;;
|
||||
--arch)
|
||||
CHROOT_ARCH="$2"
|
||||
if [ "$2" = "i386" ] || [ "$2" = "lpia" ] && [ -z "$personality" ];
|
||||
then
|
||||
personality="linux32"
|
||||
fi
|
||||
shift 2
|
||||
;;
|
||||
--personality)
|
||||
personality="$2"
|
||||
shift 2
|
||||
;;
|
||||
--skip-updates)
|
||||
SKIP_UPDATES="1"
|
||||
shift
|
||||
;;
|
||||
--name)
|
||||
name="$2"
|
||||
shift 2
|
||||
;;
|
||||
--source-template)
|
||||
TEMPLATE_SOURCES="$2"
|
||||
shift 2
|
||||
if [ ! -r $TEMPLATE_SOURCES ]; then
|
||||
echo "W: Template file $TEMPLATE_SOURCES is not readable"
|
||||
echo "W: Continuing with default sources!"
|
||||
fi
|
||||
;;
|
||||
--debootstrap-mirror)
|
||||
DEBOOTSTRAP_MIRROR="$2"
|
||||
shift 2
|
||||
;;
|
||||
--debootstrap-include)
|
||||
DEBOOTSTRAP_INCLUDE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--debootstrap-exclude)
|
||||
DEBOOTSTRAP_EXCLUDE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--distro)
|
||||
DISTRO="$2"
|
||||
shift 2
|
||||
;;
|
||||
--vg)
|
||||
VG="$2"
|
||||
shift 2
|
||||
;;
|
||||
--type)
|
||||
SCHROOT_TYPE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
-h|--help|*)
|
||||
usage 0
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# For when schroot enters the chroot, we cannot be in a directory that
|
||||
# will not exist in the chroot.
|
||||
cd /
|
||||
@ -94,136 +220,60 @@ if ! id | fgrep -q '(sbuild)'; then
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# Set up configurable defaults (loaded after option processing)
|
||||
LV_SIZE="5G"
|
||||
SNAPSHOT_SIZE="4G"
|
||||
SOURCE_CHROOTS_DIR="/var/lib/schroot/chroots"
|
||||
SOURCE_CHROOTS_TGZ="/var/lib/schroot/tarballs"
|
||||
CHROOT_SNAPSHOT_DIR="/var/lib/schroot/snapshots"
|
||||
|
||||
function usage()
|
||||
{
|
||||
echo "Usage: $0 [OPTIONS] Release" >&2
|
||||
echo "Options:"
|
||||
echo " --arch=ARCH What architecture to select"
|
||||
echo " --name=NAME Base name for the schroot (arch is appended)"
|
||||
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 " --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 " --debootstrap-include=list Comma separated list of packages to include"
|
||||
echo " --debootstrap-exclude=list Comma separated list of packages to exclude"
|
||||
echo " --distro=DISTRO Install specific distro:"
|
||||
echo " 'ubuntu'(default), or 'debian'"
|
||||
echo " --type=SCHROOT_TYPE Define the schroot type:"
|
||||
echo " 'directory'(default), 'file', or 'btrfs-snapshot'"
|
||||
echo " 'lvm-snapshot' is selected via --vg"
|
||||
echo ""
|
||||
echo "Configuration (via ~/.mk-sbuild.rc)"
|
||||
echo " LV_SIZE Size of source LVs (default ${LV_SIZE})"
|
||||
echo " SNAPSHOT_SIZE Size of snapshot LVs (default ${SNAPSHOT_SIZE})"
|
||||
echo " SOURCE_CHROOTS_DIR Directory to store directory source chroots"
|
||||
echo " SOURCE_CHROOTS_TGZ Directory to store file source chroots"
|
||||
echo " CHROOT_SNAPSHOT_DIR Directory to mount open btrfs snaphshot chroots (default ${CHROOT_SNAPSHOT_DIR})"
|
||||
echo " SCHROOT_CONF_SUFFIX Lines to append to schroot.conf entries"
|
||||
echo " SKIP_UPDATES Enable --skip-updates"
|
||||
echo " DEBOOTSTRAP_MIRROR Mirror location (same as --debootstrap-mirror)"
|
||||
echo " DEBOOTSTRAP_INCLUDE Included packages (same as --debootstrap-include)"
|
||||
echo " DEBOOTSTRAP_EXCLUDE Excluded packages (same as --debootstrap-exclude)"
|
||||
echo " TEMPLATE_SOURCES A template for sources.list"
|
||||
echo " TEMPLATE_SCHROOTCONF A template for schroot.conf stanza"
|
||||
exit 1
|
||||
}
|
||||
|
||||
|
||||
if [ -z "$1" ]; then
|
||||
usage
|
||||
fi
|
||||
OPTS=`getopt -o '' --long "help,debug,skip-updates,arch:,name:,source-template:,debootstrap-mirror:,debootstrap-include:,debootstrap-exclude:,personality:,distro:,vg:,type:" -- "$@"`
|
||||
eval set -- "$OPTS"
|
||||
|
||||
VG=""
|
||||
DISTRO="ubuntu"
|
||||
name=""
|
||||
while :; do
|
||||
case "$1" in
|
||||
--debug)
|
||||
set -x
|
||||
shift
|
||||
;;
|
||||
--arch)
|
||||
CHROOT_ARCH="$2"
|
||||
if [ "$2" = "i386" ] || [ "$2" = "lpia" ] && [ -z "$personality" ];
|
||||
then
|
||||
personality="linux32"
|
||||
fi
|
||||
shift 2
|
||||
;;
|
||||
--personality)
|
||||
personality="$2"
|
||||
shift 2
|
||||
;;
|
||||
--skip-updates)
|
||||
SKIP_UPDATES="1"
|
||||
shift
|
||||
;;
|
||||
--name)
|
||||
name="$2"
|
||||
shift 2
|
||||
;;
|
||||
--source-template)
|
||||
TEMPLATE_SOURCES="$2"
|
||||
shift 2
|
||||
if [ ! -r $TEMPLATE_SOURCES ]; then
|
||||
echo "W: Template file $TEMPLATE_SOURCES is not readable"
|
||||
echo "W: Continuing with default sources!"
|
||||
fi
|
||||
;;
|
||||
--debootstrap-mirror)
|
||||
DEBOOTSTRAP_MIRROR="$2"
|
||||
shift 2
|
||||
;;
|
||||
--debootstrap-include)
|
||||
DEBOOTSTRAP_INCLUDE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--debootstrap-exclude)
|
||||
DEBOOTSTRAP_EXCLUDE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--distro)
|
||||
DISTRO="$2"
|
||||
shift 2
|
||||
;;
|
||||
--vg)
|
||||
VG="$2"
|
||||
shift 2
|
||||
;;
|
||||
--type)
|
||||
SCHROOT_TYPE="$2"
|
||||
shift 2
|
||||
;;
|
||||
--)
|
||||
shift
|
||||
break
|
||||
;;
|
||||
--help|*)
|
||||
usage
|
||||
;;
|
||||
esac
|
||||
done
|
||||
|
||||
# To build the chroot, we need to know which release of Ubuntu to debootstrap
|
||||
RELEASE="$1"
|
||||
if [ -z "$RELEASE" ]; then
|
||||
usage
|
||||
fi
|
||||
|
||||
# Determine distribution and possible synonyms
|
||||
synonym=""
|
||||
EXPERIMENTAL=0
|
||||
if debian-distro-info --all | grep -Fqx "$RELEASE"; then
|
||||
DISTRO="${DISTRO:-debian}"
|
||||
if [ "$RELEASE" = $(debian-distro-info --devel) ]; then
|
||||
synonym=unstable
|
||||
elif [ "$RELEASE" = $(debian-distro-info --testing) ]; then
|
||||
synonym=testing
|
||||
elif [ "$RELEASE" = $(debian-distro-info --stable) ]; then
|
||||
synonym=stable
|
||||
elif [ "$RELEASE" = $(debian-distro-info --old) ]; then
|
||||
synonym=oldstable
|
||||
fi
|
||||
elif ubuntu-distro-info --all | grep -Fqx "$RELEASE"; then
|
||||
DISTRO="${DISTRO:-ubuntu}"
|
||||
elif [ "$RELEASE" = "unstable" ]; then
|
||||
DISTRO="${DISTRO:-debian}"
|
||||
synonym="$RELEASE"
|
||||
RELEASE=$(debian-distro-info --devel)
|
||||
elif [ "$RELEASE" = "testing" ]; then
|
||||
DISTRO="${DISTRO:-debian}"
|
||||
synonym="$RELEASE"
|
||||
RELEASE=$(debian-distro-info --testing)
|
||||
elif [ "$RELEASE" = "stable" ]; then
|
||||
DISTRO="${DISTRO:-debian}"
|
||||
synonym="$RELEASE"
|
||||
RELEASE=$(debian-distro-info --stable)
|
||||
elif [ "$RELEASE" = "oldstable" ]; then
|
||||
DISTRO="${DISTRO:-debian}"
|
||||
synonym="$RELEASE"
|
||||
RELEASE=$(debian-distro-info --old)
|
||||
elif [ "$RELEASE" = "experimental" ]; then
|
||||
DISTRO="${DISTRO:-debian}"
|
||||
EXPERIMENTAL=1
|
||||
name="${name:-experimental}"
|
||||
RELEASE=$(debian-distro-info --devel)
|
||||
elif [ -z "$DISTRO" ]; then
|
||||
echo "Unable to determine distribution, please provide --distro" >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
# By default, name the schroot the same as the release
|
||||
if [ -z "$name" ]; then
|
||||
name="$RELEASE"
|
||||
else
|
||||
# Disable synonym when a custom name is used:
|
||||
synonym=""
|
||||
fi
|
||||
|
||||
# By default, use the native architecture.
|
||||
@ -234,6 +284,12 @@ fi
|
||||
|
||||
CHROOT_NAME="${name}-${CHROOT_ARCH}"
|
||||
|
||||
if [ -z "$synonym" ]; then
|
||||
CHROOT_SYNONYM=""
|
||||
else
|
||||
CHROOT_SYNONYM="${synonym}-${CHROOT_ARCH}"
|
||||
fi
|
||||
|
||||
# Load customizations
|
||||
if [ -r ~/.mk-sbuild.rc ]; then
|
||||
. ~/.mk-sbuild.rc
|
||||
@ -406,7 +462,7 @@ if [ "$CHROOT_ARCH" != "$HOST_ARCH" ] ; then
|
||||
*)
|
||||
DEBOOTSTRAP_COMMAND=qemu-debootstrap
|
||||
if ! which "$DEBOOTSTRAP_COMMAND"; then
|
||||
sudo apt-get install qemu-kvm-extras-static
|
||||
sudo apt-get install qemu-user-static
|
||||
fi
|
||||
;;
|
||||
esac
|
||||
@ -460,6 +516,12 @@ else
|
||||
deb ${DEBOOTSTRAP_MIRROR} RELEASE ${COMPONENTS}
|
||||
deb-src ${DEBOOTSTRAP_MIRROR} RELEASE ${COMPONENTS}
|
||||
EOM
|
||||
if [ "$EXPERIMENTAL" -eq 1 ]; then
|
||||
cat >> "$TEMP_SOURCES" <<EOM
|
||||
deb ${DEBOOTSTRAP_MIRROR} experimental ${COMPONENTS}
|
||||
deb-src ${DEBOOTSTRAP_MIRROR} experimental ${COMPONENTS}
|
||||
EOM
|
||||
fi
|
||||
if [ -z "$SKIP_UPDATES" ]; then
|
||||
cat >> "$TEMP_SOURCES" <<EOM
|
||||
deb ${DEBOOTSTRAP_MIRROR} RELEASE-updates ${COMPONENTS}
|
||||
@ -476,6 +538,12 @@ fi
|
||||
cat "$TEMP_SOURCES" | sed -e "s|RELEASE|$RELEASE|g" | \
|
||||
sudo bash -c "cat > $MNT/etc/apt/sources.list"
|
||||
rm -f "$TEMP_SOURCES"
|
||||
|
||||
if [ "$EXPERIMENTAL" -eq 1 ]; then
|
||||
echo 'APT::Default-Release "experimental";' \
|
||||
| sudo tee "$MNT"/etc/apt/apt.conf.d/15sbuild > /dev/null
|
||||
fi
|
||||
|
||||
# Copy the timezone (comment this out if you want to leave the chroot at UTC)
|
||||
sudo cp /etc/localtime /etc/timezone "$MNT"/etc/
|
||||
# Create a schroot entry for this chroot
|
||||
@ -492,7 +560,6 @@ else
|
||||
# it helps keep the schroot stanzas separated in the main
|
||||
# /etc/schroot/schroot.conf file.
|
||||
cat > "$TEMP_SCHROOTCONF" <<EOM
|
||||
|
||||
[CHROOT_NAME]
|
||||
description=CHROOT_NAME
|
||||
groups=sbuild,root,admin
|
||||
@ -528,18 +595,35 @@ fi
|
||||
if [ ! -z "$personality" ]; then
|
||||
echo "personality=$personality" >> "$TEMP_SCHROOTCONF"
|
||||
fi
|
||||
if [ ! -z "$CHROOT_SYNONYM" ]; then
|
||||
echo "aliases=$CHROOT_SYNONYM" >> "$TEMP_SCHROOTCONF"
|
||||
fi
|
||||
if [ ! -z "$SCHROOT_CONF_SUFFIX" ]; then
|
||||
echo "$SCHROOT_CONF_SUFFIX" >> "$TEMP_SCHROOTCONF"
|
||||
fi
|
||||
cat "$TEMP_SCHROOTCONF" | sed \
|
||||
-e "s|CHROOT_NAME|$CHROOT_NAME|g" \
|
||||
sed -e "s|CHROOT_NAME|$CHROOT_NAME|g" \
|
||||
-e "s|CHROOT_PATH|$CHROOT_PATH|g" \
|
||||
-e "s|SNAPSHOT_SIZE|$SNAPSHOT_SIZE|g" \
|
||||
-e "s|SCHROOT_TYPE|$SCHROOT_TYPE|g" \
|
||||
-e "s|CHROOT_SNAPSHOT_DIR|$CHROOT_SNAPSHOT_DIR|g" \
|
||||
| \
|
||||
sudo bash -c "cat >> /etc/schroot/schroot.conf"
|
||||
"$TEMP_SCHROOTCONF" \
|
||||
| sudo tee "/etc/schroot/chroot.d/sbuild-$CHROOT_NAME" > /dev/null
|
||||
rm -f "$TEMP_SCHROOTCONF"
|
||||
|
||||
# Disable daemons in chroot:
|
||||
sudo bash -c "cat >> $MNT/usr/sbin/policy-rc.d" <<EOM
|
||||
#!/bin/sh
|
||||
while true; do
|
||||
case "\$1" in
|
||||
-*) shift ;;
|
||||
makedev) exit 0;;
|
||||
x11-common) exit 0;;
|
||||
*) exit 101;;
|
||||
esac
|
||||
done
|
||||
EOM
|
||||
sudo chmod a+x "$MNT"/usr/sbin/policy-rc.d
|
||||
|
||||
# Create image finalization script
|
||||
sudo bash -c "cat >> $MNT/finish.sh" <<EOM
|
||||
#!/bin/bash
|
||||
@ -593,3 +677,5 @@ echo " To CHANGE the golden image: sudo schroot -c ${CHROOT_NAME}-source -u root
|
||||
echo " To ENTER an image snapshot: schroot -c ${CHROOT_NAME}"
|
||||
echo " To BUILD within a snapshot: sbuild -A -d ${CHROOT_NAME} PACKAGE*.dsc"
|
||||
echo ""
|
||||
|
||||
# vi: set et:
|
||||
|
@ -32,7 +32,6 @@ BLACKLIST = {
|
||||
'grep-merges': 'No Help',
|
||||
'lp-project-upload': 'Returns non-zero after help. '
|
||||
'Leaving u-d-t in LP: #524680',
|
||||
'mk-sbuild': 'Fires up apt-get before showing help',
|
||||
'pbuilder-dist-simple': 'No Help',
|
||||
'setup-packaging-environment': 'Throws Error',
|
||||
'submittodebian': 'No Help',
|
||||
|
Loading…
x
Reference in New Issue
Block a user