yolo: attempt to preinstall apt dependencies in the initial lxc snapshot

This commit is contained in:
Alexandre Aubin 2024-01-10 21:13:08 +01:00
parent e7b47542c8
commit 94abddf58d
2 changed files with 16 additions and 0 deletions

View file

@ -49,6 +49,8 @@ LXC_CREATE () {
fi fi
set_witness_files set_witness_files
_PREINSTALL_APT_DEPS
sleep 3 sleep 3
log_info "Creating initial snapshot $LXC_NAME ..." log_info "Creating initial snapshot $LXC_NAME ..."
lxc snapshot $LXC_NAME snap0 lxc snapshot $LXC_NAME snap0

View file

@ -4,6 +4,20 @@
# "Low-level" logistic helpers # "Low-level" logistic helpers
#================================================= #=================================================
_PREINSTALL_APT_DEPS()
{
[[ -e $package_path/manifest.toml ]] || return
local apt_deps=$(python3 -c "import toml, sys; t = toml.loads(sys.stdin.read()); p = t['resources'].get('apt', {}).get('packages', ''); print(p.replace(',', ' ')) if isinstance(p, str) else print(' '.join(p));" < $package_path/manifest.toml)
log_small_title "Preinstalling apt dependencies before creating the initial snapshot..."
RUN_INSIDE_LXC apt install $apt_deps || true
# Execute the command given in argument in the container and log its results.
lxc exec $LXC_NAME -t -- /bin/bash -c "apt install $apt_deps" | tee -a "$full_log" >/dev/null
}
_RUN_YUNOHOST_CMD() { _RUN_YUNOHOST_CMD() {
log_debug "Running yunohost $1" log_debug "Running yunohost $1"