swmodd: 2.1.15

This commit is contained in:
vdutta 2022-09-16 16:59:43 +05:30
parent e4acdd529b
commit 69d07fe12b
3 changed files with 35 additions and 14 deletions

View file

@ -5,7 +5,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=swmodd
PKG_VERSION:=2.1.14
PKG_VERSION:=2.1.15
LOCAL_DEV:=0
ifneq ($(LOCAL_DEV),1)

View file

@ -47,23 +47,20 @@ configure_crun_container() {
uci_set ocicontainer ${1} password ""
result=$(${RUNNER} -b "${BUNDLE}" -n "${name}" -r "${url}" -l "${username}:${password}")
if [ "$?" -eq 0 ]; then
result=$(cat ${BUNDLE}/${name}/config.json |jq '.annotations.org_opencontainers_image_description')
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
if [ "${result}" != "null" ]; then
uci_set ocicontainer ${1} description ${result}
uci_set ocicontainer ${1} description "${result}"
fi
log "### Description $result ##"
result=$(cat ${BUNDLE}/${name}/config.json |jq '.annotations.org_opencontainers_image_vendor')
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
if [ "${result}" != "null" ]; then
uci_set ocicontainer ${1} vendor ${result}
uci_set ocicontainer ${1} vendor "${result}"
fi
log "### vendor $result ##"
result=$(cat ${BUNDLE}/${name}/config.json |jq '.annotations.org_opencontainers_image_version')
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
if [ "${result}" != "null" ]; then
uci_set ocicontainer ${1} version ${result}
uci_set ocicontainer ${1} version "${result}"
fi
log "### version $result ##"
uci_set ocicontainer ${1} du_status Installing_success
du_status="Installed"
@ -122,6 +119,20 @@ configure_crun_container() {
fi
else
${RUNNER} -U -b "${BUNDLE}" -n "${name}"
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
if [ "${result}" != "null" ]; then
uci_set ocicontainer ${1} description "${result}"
fi
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
if [ "${result}" != "null" ]; then
uci_set ocicontainer ${1} vendor "${result}"
fi
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
if [ "${result}" != "null" ]; then
uci_set ocicontainer ${1} version "${result}"
fi
fi
procd_open_instance "${name}"

View file

@ -143,6 +143,11 @@ pull_image_from_registry() {
check_binary skopeo
check_binary umoci
temp="$(mktemp -d)"
if [ ! -d "${temp}" ]; then
log "Failed to create temp directory"
exit 1
fi
cd "${temp}"
OPTS=""
INSPECT_OPT=""
@ -154,24 +159,29 @@ pull_image_from_registry() {
raw=$(skopeo --command-timeout 30s inspect ${INSPECT_OPT} --raw ${REGURL})
blobsize=$(echo $raw|jq '[ .layers[].size ] | add' 2>/dev/null)
if [ -z "${blobsize}" ]; then
log "Failed to get image size"
blobsize=0
fi
exsize=$(( blobsize * 2 ))
# Get the available disk space
disksize=$(df -P -k ${temp} |tail -n +2 |awk '{print $4}')
if [ "${disksize}" -lt "${exsize:0}" ]; then
if [ "${disksize}" -lt "${exsize}" ]; then
log "Not enough memory ${blobsize} available ${disksize}, download aborted"
exit 1
fi
if skopeo --command-timeout 4m copy ${OPTS} ${REGURL} oci:${NAME}_tmp:latest >/dev/null 2>&1; then
if ! skopeo --command-timeout 4m copy ${OPTS} ${REGURL} oci:${NAME}_tmp:latest >/dev/null 2>&1; then
log "Failed to download image"
cd -
rm -rf "${temp}"
exit 1
fi
umoci unpack --image ${NAME}_tmp:latest ${NAME} >/dev/null 2>&1
if ! umoci unpack --image ${NAME}_tmp:latest ${NAME} >/dev/null 2>&1; then
log "Failed to unpack image"
cd -
rm -rf "${temp}"
exit 1
fi
rm -rf "${NAME}_tmp"
if [ ! -f "${NAME}/config.json" ]; then
log "Failed to pull the image config missing"