summaryrefslogtreecommitdiff
path: root/scripts/live-build-config
diff options
context:
space:
mode:
authorDaniil Baturin <daniil@baturin.org>2018-06-26 14:21:32 +0200
committerDaniil Baturin <daniil@baturin.org>2018-06-26 14:21:32 +0200
commitaa91197422cee8dda2e79cd307cfaf0194044eb4 (patch)
tree6bc1ff7ecde1c1b9d3c615aa9680ce2512ad176a /scripts/live-build-config
parent7f14d89db276262884dbb6b291fcbd396b007850 (diff)
downloadvyos-build-aa91197422cee8dda2e79cd307cfaf0194044eb4.tar.gz
vyos-build-aa91197422cee8dda2e79cd307cfaf0194044eb4.zip
T712: add configure options to simplify building images with custom packages.
Diffstat (limited to 'scripts/live-build-config')
-rwxr-xr-xscripts/live-build-config25
1 files changed, 25 insertions, 0 deletions
diff --git a/scripts/live-build-config b/scripts/live-build-config
index b1a77b4c..6933a475 100755
--- a/scripts/live-build-config
+++ b/scripts/live-build-config
@@ -22,6 +22,7 @@
import sys
import os
+import shutil
import json
import pystache
@@ -79,6 +80,30 @@ with open(apt_file, 'w') as f:
f.write(vyos_repo_entry)
f.write(vyos_debian_repo_entry)
+# Add custom APT entries
+if build_config['custom_apt_entry']:
+ custom_apt_file = os.path.join(build_config['build_dir'], defaults.CUSTOM_REPO_FILE)
+ entries = "\n".join(build_config['custom_apt_entry'])
+ if debug:
+ print("Adding custom APT entries:")
+ print(entries)
+ with open(custom_apt_file, 'w') as f:
+ f.write(entries)
+
+# Add custom APT keys
+if build_config['custom_apt_key']:
+ key_dir = os.path.join(build_config['build_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))
+
+# Add custom packages
+if build_config['custom_packages']:
+ package_list_file = os.path.join(build_config['build_dir'], defaults.CUSTOM_PACKAGE_LIST_FILE)
+ packages = "\n".join(build_config['custom_packages'])
+ with open (package_list_file, 'w') as f:
+ f.write(packages)
+
# Configure live-build
lb_config_command = pystache.render(lb_config_tmpl, build_config)