diff options
Diffstat (limited to 'scripts/build-vyos-image')
-rwxr-xr-x | scripts/build-vyos-image | 31 |
1 files changed, 15 insertions, 16 deletions
diff --git a/scripts/build-vyos-image b/scripts/build-vyos-image index 1406aec9..f09791d9 100755 --- a/scripts/build-vyos-image +++ b/scripts/build-vyos-image @@ -71,7 +71,7 @@ def merge_dicts(source, destination): if key not in tmp: tmp[key] = value elif isinstance(source[key], dict): - tmp[key] = dict_merge(source[key], tmp[key]) + tmp[key] = merge_dicts(source[key], tmp[key]) elif isinstance(source[key], list): tmp[key] = source[key] + tmp[key] else: @@ -164,9 +164,9 @@ if __name__ == "__main__": parser.add_argument('--dry-run', help='Check build configuration and exit', action='store_true') # Custom APT entry and APT key options can be used multiple times - parser.add_argument('--custom-apt-entry', help="Custom APT entry", action='append') - parser.add_argument('--custom-apt-key', help="Custom APT key file", action='append') - parser.add_argument('--custom-package', help="Custom package to install from repositories", action='append') + parser.add_argument('--custom-apt-entry', help="Custom APT entry", action='append', default=[]) + parser.add_argument('--custom-apt-key', help="Custom APT key file", action='append', default=[]) + parser.add_argument('--custom-package', help="Custom package to install from repositories", action='append', default=[]) # Build flavor is a positional argument parser.add_argument('build_flavor', help='Build flavor', nargs='?', action='store') @@ -206,29 +206,25 @@ if __name__ == "__main__": print("Use --build-type=release option if you want to set version number") sys.exit(1) - if not args['custom_apt_entry']: - args['custom_apt_entry'] = [] - args['custom_apt_entry'] = args['custom_apt_entry'] + build_defaults['additional_repositories'] - ## Inject some useful hardcoded options args['build_dir'] = defaults.BUILD_DIR args['pbuilder_config'] = os.path.join(defaults.BUILD_DIR, defaults.PBUILDER_CONFIG) ## Combine the arguments with non-configurable defaults - build_config = merge_dicts(build_defaults, args) + build_config = merge_dicts(args, build_defaults) ## Load the flavor file and mix-ins with open(make_toml_path(defaults.BUILD_TYPES_DIR, build_config["build_type"]), 'r') as f: build_type_config = toml.load(f) - build_config = merge_dicts(build_config, build_type_config) + build_config = merge_dicts(build_type_config, build_config) with open(make_toml_path(defaults.BUILD_ARCHES_DIR, build_config["architecture"]), 'r') as f: build_arch_config = toml.load(f) - build_config = merge_dicts(build_config, build_arch_config) + build_config = merge_dicts(build_arch_config, build_config) with open(make_toml_path(defaults.BUILD_FLAVORS_DIR, build_config["build_flavor"]), 'r') as f: flavor_config = toml.load(f) - build_config = merge_dicts(build_config, flavor_config) + build_config = merge_dicts(flavor_config, build_config) ## Rename and merge some fields for simplicity ## E.g. --custom-packages is for the user, but internally @@ -385,7 +381,10 @@ if __name__ == "__main__": f.write(vyos_repo_entry) # Add custom APT entries - if build_config['custom_apt_entry']: + if build_config.get('additional_repositories', False): + build_config['custom_apt_entry'] += build_config['additional_repositories'] + + if build_config.get('custom_apt_entry', False): custom_apt_file = defaults.CUSTOM_REPO_FILE entries = "\n".join(build_config['custom_apt_entry']) if debug: @@ -397,7 +396,7 @@ if __name__ == "__main__": # Add custom APT keys if has_nonempty_key(build_config, 'custom_apt_key'): - key_dir = ARCHIVES_DIR + key_dir = defaults.ARCHIVES_DIR for k in build_config['custom_apt_key']: dst_name = '{0}.key.chroot'.format(os.path.basename(k)) shutil.copy(k, os.path.join(key_dir, dst_name)) @@ -412,7 +411,7 @@ if __name__ == "__main__": ## Create includes if has_nonempty_key(build_config, "includes_chroot"): for i in build_config["includes_chroot"]: - file_path = os.path.join(includes_chroot_dir, i["path"]) + file_path = os.path.join(chroot_includes_dir, i["path"]) os.makedirs(os.path.dirname(file_path), exist_ok=True) with open(file_path, 'w') as f: f.write(i["data"]) @@ -426,7 +425,7 @@ if __name__ == "__main__": --bootappend-live-failsafe "live components memtest noapic noapm nodma nomce nolapic nomodeset nosmp nosplash vga=normal console=ttyS0,115200 console=tty0 net.ifnames=0 biosdevname=0" \ --linux-flavours {{kernel_flavor}} \ --linux-packages linux-image-{{kernel_version}} \ - --bootloader syslinux,grub-efi \ + --bootloader {{ bootloaders }} \ --binary-images iso-hybrid \ --checksums 'sha256 md5' \ --debian-installer none \ |