summaryrefslogtreecommitdiff
path: root/bin/debvm-create
diff options
context:
space:
mode:
authorHelmut Grohne <helmutg@debian.org>2023-01-15 21:24:40 +0000
committerHelmut Grohne <helmutg@debian.org>2023-01-15 21:24:40 +0000
commitaab98c9fd43c3d9a8b14184cfb79b80bd1e2d97c (patch)
tree45dae9261423c5d243a32d89367d82a665c86a3b /bin/debvm-create
parente0b948d626e744c9b8a53cacbd09167b61e5da47 (diff)
parentda8e17075d74c79822cb47a5be56f04109c50e94 (diff)
downloaddebvm-aab98c9fd43c3d9a8b14184cfb79b80bd1e2d97c.tar.gz
Merge branch 'drop_mirror' into 'main'
Drop mirror option See merge request helmutg/debvm!24
Diffstat (limited to 'bin/debvm-create')
-rwxr-xr-xbin/debvm-create27
1 files changed, 9 insertions, 18 deletions
diff --git a/bin/debvm-create b/bin/debvm-create
index b34399b..09ee897 100755
--- a/bin/debvm-create
+++ b/bin/debvm-create
@@ -11,7 +11,7 @@ debvm-create - Create a VM image for various Debian releases and architectures
=head1 SYNOPSIS
-B<debvm-create> [B<-a> I<architecture>] [B<-h> I<hostname>] [B<-k> F<sshkey>] [B<-m> I<mirror>] [B<-o> F<output>] [B<-r> I<release>] [B<-s> <task>] [B<-z> I<size_in_GB>] [B<--> I<mmdebstrap options>]
+B<debvm-create> [B<-a> I<architecture>] [B<-h> I<hostname>] [B<-k> F<sshkey>] [B<-o> F<output>] [B<-r> I<release>] [B<-s> <task>] [B<-z> I<size_in_GB>] [B<--> I<mmdebstrap options>]
=head1 DESCRIPTION
@@ -44,11 +44,6 @@ This option also causes the ssh server to be installed.
By default, no key or server is installed.
To connect to the vm, pass a port number to B<debvm-run> with the B<-s> option.
-=item B<-m> I<mirror>, B<--mirror>=I<mirror>
-
-Specify the Debian mirror to be used for downloading packages and to be configured inside the virtual machine image.
-By default, L<http://deb.debian.org/debian> is being used.
-
=item B<-o> F<output>, B<--output>=F<output>
Specify the file name of the resulting virtual machine image.
@@ -99,9 +94,10 @@ The default is 1 GB.
=item B<--> I<mmdebstrap options>
-All options beyond a double dash are passed to B<mmdebstrap> before the suite, target and mirror specification.
+All options beyond a double dash are passed to B<mmdebstrap> after the suite and target specification.
This can be used to provide additional hooks for image customization.
You can also request additional packages to be installed into the image using B<mmdebstrap>'s B<--include> option.
+Any positional arguments passed here will be treated as mirror specifications by B<mmdebstrap>.
=back
@@ -117,7 +113,6 @@ set -u
ARCHITECTURE=$(dpkg --print-architecture)
IMAGE=rootfs.ext4
INCLUDE_PACKAGES=init
-MIRROR="http://deb.debian.org/debian"
SIZE=$((1024*1024*1024))
SKIP=,
SSHKEY=
@@ -136,7 +131,7 @@ die() {
exit 1
}
usage() {
- die "usage: $0 [-a architecture] [-h hostname] [-k sshkey] [-m mirror] [-o output] [-r release] [-s task] [-z size_in_GB] [-- mmdebstrap options]"
+ die "usage: $0 [-a architecture] [-h hostname] [-k sshkey] [-o output] [-r release] [-s task] [-z size_in_GB] [-- mmdebstrap options]"
}
usage_error() {
echo "error: $*" 1>&2
@@ -149,9 +144,6 @@ opt_architecture() {
opt_hostname() {
VMNAME=$1
}
-opt_mirror() {
- MIRROR=$1
-}
opt_skip() {
SKIP="$SKIP$1,"
}
@@ -160,6 +152,7 @@ opt_sshkey() {
}
opt_output() {
IMAGE=$1
+ test "${IMAGE#-}" = "$IMAGE" || IMAGE="./$IMAGE"
}
opt_release() {
SUITE=$1
@@ -168,12 +161,11 @@ opt_size() {
SIZE=$(($1*1024*1024*1024))
}
-while getopts :a:h:k:m:o:r:s:z:-: OPTCHAR; do
+while getopts :a:h:k:o:r:s:z:-: OPTCHAR; do
case "$OPTCHAR" in
a) opt_architecture "$OPTARG" ;;
h) opt_hostname "$OPTARG" ;;
k) opt_sshkey "$OPTARG" ;;
- m) opt_mirror "$OPTARG" ;;
o) opt_output "$OPTARG" ;;
r) opt_release "$OPTARG" ;;
s) opt_skip "$OPTARG" ;;
@@ -183,12 +175,12 @@ while getopts :a:h:k:m:o:r:s:z:-: OPTCHAR; do
help)
usage
;;
- architecture|hostname|mirror|output|release|size|skip|sshkey)
+ architecture|hostname|output|release|size|skip|sshkey)
test "$OPTIND" -gt "$#" && usage_error "missing argument for --$OPTARG"
"opt_$OPTARG" "$(nth_arg "$OPTIND" "$@")"
OPTIND=$((OPTIND+1))
;;
- architecture=*|hostname=*|mirror=*|output=*|release=*|size=*|skip=*|sshkey=*)
+ architecture=*|hostname=*|output=*|release=*|size=*|skip=*|sshkey=*)
"opt_${OPTARG%%=*}" "${OPTARG#*=}"
;;
*)
@@ -341,8 +333,7 @@ fi
set -- "--customize-hook=$SHARE_DIR/customize-autologin.sh" "$@"
-# suite target mirror
-set -- "$@" "$SUITE" "$IMAGE" "deb $MIRROR $SUITE main"
+set -- "$SUITE" "$IMAGE" "$@"
set -ex