diff --git a/scripts/crun_create b/scripts/crun_create index 95882442e2548e12f0cac019227743e96fc083d9..ecdbb5ae7188ffd55ba9087c72206d9498986825 100755 --- a/scripts/crun_create +++ b/scripts/crun_create @@ -579,13 +579,22 @@ configure_busybox() copy_prereq() { + local rootfs extrapkg + rootfs="${1}" + shift + extrapkg="${@}" req_pkg="procd uci opkg ip-full curl libstdcpp6 librt" for p in ${req_pkg}; do /usr/share/swmodd/opkg_offline "${rootfs}" "${p}" done + for p in ${extrapkg}; do + /usr/share/swmodd/opkg_offline "${rootfs}" "${p}" + done + + cp /etc/preinit "${rootfs}/etc/preinit" cp /etc/diag.sh "${rootfs}/etc/diag.sh" cp /sbin/mount_root "${rootfs}/sbin/mount_root" @@ -600,9 +609,11 @@ copy_prereq() create_container() { - local name + local name extrapkg name="${1}" + shift + extrapkg="${@}" # Make sure container already not created list=$(crun list 2>&1 | tail -n +2 | grep "${name}" | awk '{print $1}') @@ -642,7 +653,7 @@ create_container() exit 1 fi - if ! copy_prereq "${rootfs}"; then + if ! copy_prereq "${rootfs}" "${extrapkg}"; then echo "ERROR: Failed to copy required binaries" 1>&2 exit 1 fi @@ -745,6 +756,6 @@ set_bundle_path if [ "$config" -eq "1" ]; then generate_config "$name" else - create_container "$name" + create_container "$name" "${@}" generate_config "${name}" fi diff --git a/templates/lxc-iopsys b/templates/lxc-iopsys index b89c2c7b63ae1cf0aba5eeea06a03576b176fa2c..a23d81dbfe9374467aca4c915b7af7e5eafdd31f 100755 --- a/templates/lxc-iopsys +++ b/templates/lxc-iopsys @@ -231,13 +231,21 @@ configure_busybox() copy_prereq() { + local rootfs pkgs + rootfs="${1}" + shift + pkgs="${@}" req_pkg="procd uci opkg ip-full curl libstdcpp6 librt" for p in ${req_pkg}; do /usr/share/swmodd/opkg_offline "${rootfs}" "${p}" done + for p in ${pkgs}; do + /usr/share/swmodd/opkg_offline "${rootfs}" "${p}" + done + cp /etc/preinit "${rootfs}/etc/preinit" cp /etc/diag.sh "${rootfs}/etc/diag.sh" cp /sbin/mount_root "${rootfs}/sbin/mount_root" @@ -360,6 +368,7 @@ do esac done +PKGS="$@" # Check that we have all variables we need if [ -z "${name}" ] || [ -z "${path}" ]; then echo "ERROR: Please pass the name and path for the container" 1>&2 @@ -406,7 +415,7 @@ if ! remap_userns "${path}"; then exit 1 fi -if ! copy_prereq "${rootfs}"; then +if ! copy_prereq "${rootfs}" "${PKGS}"; then echo "ERROR: Failed to copy required binaries" 1>&2 exit 1 fi