summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorWill Holland <william.holland@codethink.co.uk>2016-08-08 20:54:08 +0100
committerWill Holland <william.holland@codethink.co.uk>2016-08-08 20:54:08 +0100
commit509c9fa7943954285c632057b09d782b6c59a328 (patch)
tree1ee0eede7c539053f82eb2defe7c49ea95dce0e4
parent479f2395ba42813e284a15e442c38b8536155ce8 (diff)
downloadvmdebootstrap-509c9fa7943954285c632057b09d782b6c59a328.tar.gz
Allow user defined distribution releases.
Replace checking is the specified distribution is in debian or ubuntu by checking if there is a file in debootstrap scripts. This is where debootstrap gets its knowledge of distributions. This allows the user to create their own distribution.
-rwxr-xr-xbin/vmdebootstrap13
-rw-r--r--doc/overview.rst2
2 files changed, 10 insertions, 5 deletions
diff --git a/bin/vmdebootstrap b/bin/vmdebootstrap
index cb98cd4..7571e7f 100755
--- a/bin/vmdebootstrap
+++ b/bin/vmdebootstrap
@@ -137,6 +137,8 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth
self.settings.boolean(['systemd-networkd'], 'Use Predictable Network '
'Interface Names', default=True)
self.settings.boolean(['dry-run'], 'do not build, just test the options', default=False)
+ self.settings.string(['debootstrap-scripts'], 'Directory containing debootstrap scripts',
+ default='/usr/share/debootstrap/scripts')
def process_args(self, args): # pylint: disable=too-many-branches,too-many-statements
@@ -159,11 +161,12 @@ class VmDebootstrap(cliapp.Application): # pylint: disable=too-many-public-meth
if self.settings['image'] and not self.settings['size']:
raise cliapp.AppException(
'If disk image is specified, you must give image size.')
- if not distro.debian_info.valid(self.settings['distribution']):
- if not distro.ubuntu_info.valid(self.settings['distribution']):
- raise cliapp.AppException(
- '%s is not a valid Debian or Ubuntu suite or codename.'
- % self.settings['distribution'])
+ if not os.path.isfile(os.path.join(
+ self.settings['debootstrap-scripts'],
+ self.settings['distribution'])):
+ raise cliapp.AppException(
+ '%s is not a valid debootstrap codename.'
+ % self.settings['distribution'])
if self.settings['apt-mirror'] and not self.settings['configure-apt']:
raise cliapp.AppException(
'--apt-mirror requires --configure-apt as well.')
diff --git a/doc/overview.rst b/doc/overview.rst
index 5471d9a..9cea2e7 100644
--- a/doc/overview.rst
+++ b/doc/overview.rst
@@ -57,6 +57,8 @@ Options
See **debootstrap (1)** for more information. This
option replaces the ``--variant`` support in
previous versions.
+ --debootstrap-scripts=DIR
+ set the directory containing debootstrap scripts.
--package=PACKAGE install PACKAGE onto system
--custom-package=DEB install package in DEB file onto system (not
from mirror)