Skip to content

Commit a3bcd9f

Browse files
basic support of OCI image command environment, entrypoint and command line (#796)
1 parent 9f88553 commit a3bcd9f

File tree

1 file changed

+17
-0
lines changed

1 file changed

+17
-0
lines changed

sudoexec/jcreate

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -428,6 +428,23 @@ if [ -n "${from}" ]; then
428428

429429
. ${temprcconf}
430430

431+
if [ -n "$from_md5" -a -n "${BUILDAH_CMD}" ]; then
432+
JQ_CMD=$( which jq )
433+
434+
${BUILDAH_CMD} --root ${workdir}/basejail/buildah images -n | while read _path _tag _image_id _rest; do
435+
_md5_ver=$(${miscdir}/cbsd_md5 "${_path}:${_tag}")
436+
_md5_nover=$(${miscdir}/cbsd_md5 "${_path}")
437+
if [ "${from_md5}" = "${_md5_ver}" -o "${from_md5}" = "${_md5_nover}" ]; then
438+
_exec_start=$(${BUILDAH_CMD} --root ${workdir}/basejail/buildah inspect ${_image_id} \
439+
| ${JQ_CMD} -r '.OCIv1.config | (.Env + .Entrypoint + .Cmd) | map("\"" + . + "\"") | join(" ")' \
440+
)
441+
442+
jset jname=${jname} exec_start="/bin/env ${_exec_start}" exec_stop="/bin/kill -TERM 1"
443+
break
444+
fi
445+
done
446+
fi
447+
431448
for i in ${MYOPTARG}; do
432449
case "${i}" in
433450
jname|from|removejconf)

0 commit comments

Comments
 (0)