summaryrefslogtreecommitdiff
path: root/scripts/build/bootstrap_debootstrap
diff options
context:
space:
mode:
authorDaniel Baumann <mail@daniel-baumann.ch>2013-04-06 13:25:45 +0200
committerDaniel Baumann <mail@daniel-baumann.ch>2013-05-06 14:50:08 +0200
commit73c892d11424f945bb42992601c1d38a669232b6 (patch)
tree15c601f55cfbe903f75b77c1ca9e32d838bf5d73 /scripts/build/bootstrap_debootstrap
parent61e5e53eef0ff22a162e628aa777a522e00dcb53 (diff)
downloadvyos-live-build-73c892d11424f945bb42992601c1d38a669232b6.tar.gz
vyos-live-build-73c892d11424f945bb42992601c1d38a669232b6.zip
Switching argument and configuration handling order in Python stubs.
Diffstat (limited to 'scripts/build/bootstrap_debootstrap')
-rwxr-xr-xscripts/build/bootstrap_debootstrap39
1 files changed, 22 insertions, 17 deletions
diff --git a/scripts/build/bootstrap_debootstrap b/scripts/build/bootstrap_debootstrap
index 7cfc8695a..262a7d5c2 100755
--- a/scripts/build/bootstrap_debootstrap
+++ b/scripts/build/bootstrap_debootstrap
@@ -8,8 +8,8 @@
## under certain conditions; see COPYING for details.
-import configparser
import argparse
+import configparser
import os
import sys
import shutil
@@ -22,28 +22,13 @@ import subprocess
# - debootstrap-options from config
def main():
- ## Parsing Configuration
- config = configparser.ConfigParser()
-
- config.read('config/build')
-
- try:
- architecture = config.get('Image', 'Architecture')
- archive_areas = config.get('Image', 'Parent-Archive-Areas')
- distribution = config.get('Image', 'Parent-Distribution')
- mirror_bootstrap = config.get('Image', 'Parent-Mirror-Bootstrap')
- except:
- archive_areas = config.get('Image', 'Archive-Areas')
- distribution = config.get('Image', 'Distribution')
- mirror_bootstrap = config.get('Image', 'Mirror-Bootstrap')
-
## Parsing Arguments
arguments = argparse.ArgumentParser(
prog = 'lb bootstrap_debootstrap',
usage = '%(prog)s [arguments]',
description = '''live-build contains the programs to build a live system from a configuration directory.
The lb bootstrap_debootstrap program bootstraps the chroot system with debootstrap.''',
- epilog = 'live-build was written by Daniel Baumann <mail@daniel-baumann.ch>.',
+ epilog = 'See \'man lb_bootstrap_debootstrap\' for more information.',
version = 'live-build 4.0',
formatter_class = argparse.ArgumentDefaultsHelpFormatter
)
@@ -53,6 +38,26 @@ def main():
args = arguments.parse_args()
+ ## Parsing Configuration
+ if not os.path.isfile('config/build'):
+ print('E: config/build - no such file')
+
+ sys.exit(1)
+
+ config = configparser.ConfigParser()
+
+ config.read('config/build')
+
+ try:
+ architecture = config.get('Image', 'Architecture')
+ archive_areas = config.get('Image', 'Parent-Archive-Areas')
+ distribution = config.get('Image', 'Parent-Distribution')
+ mirror_bootstrap = config.get('Image', 'Parent-Mirror-Bootstrap')
+ except:
+ archive_areas = config.get('Image', 'Archive-Areas')
+ distribution = config.get('Image', 'Distribution')
+ mirror_bootstrap = config.get('Image', 'Mirror-Bootstrap')
+
# --verbose
verbose = args.verbose