Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
19 changes: 19 additions & 0 deletions scripts/image-build/build-vyos-image
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,8 @@ def build():

from utils import cmd, rc_cmd
from utils import directories
from utils import activation_hint
from utils import activation_init
Comment on lines +144 to +145
Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Two different imports: '_hint' vs '_init'


## Check if there are missing build dependencies
deps = {
Expand Down Expand Up @@ -490,6 +492,13 @@ DOCUMENTATION_URL="{build_config['documentation_url']}"
with open(os.path.join(binary_includes_dir, 'version.json'), 'w') as f:
json.dump(version_data, f)

# For initialization of activation scripts, we need to know if we
# are building with create_raw_image
if build_config["image_format"] != ["iso"]:
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For some reason I find this check aesthetically unsatisfying, although it does the job for sure and I don't see an alternative at the moment.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I agree that it is unsatisfying, and yes, we do not have a clean alternative.

raw_build_hint = os.path.join(vyos_data_dir, os.path.basename(activation_hint))
with open(raw_build_hint, 'w') as f:
pass

# For backwards compatibility with 'add system image' script from older versions
# we need a file in the old format so that script can find out the version of the image
# for upgrade
Expand Down Expand Up @@ -628,6 +637,16 @@ DOCUMENTATION_URL="{build_config['documentation_url']}"
with open(file_path, 'w') as f:
f.write(build_config["default_config"])

## Allow override of which activation scripts are enabled at boot
if has_nonempty_key(build_config, "activation_init"):
file_path = os.path.join(
chroot_includes_dir,
activation_init.lstrip(os.sep)
)
os.makedirs(os.path.dirname(file_path), exist_ok=True)
with open(file_path, 'w') as f:
f.write(build_config["activation_init"])

## Configure live-build
lb_config_tmpl = jinja2.Template("""
lb config noauto \
Expand Down
2 changes: 2 additions & 0 deletions scripts/image-build/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import vyos

from vyos.defaults import directories
from vyos.defaults import activation_hint
from vyos.defaults import activation_init


def check_build_config():
Expand Down
Loading