swmodd: 2.1.23

This commit is contained in:
vdutta 2023-03-08 21:49:00 +05:30
parent 86a553c697
commit 5b7a4d13ca
5 changed files with 27 additions and 27 deletions

View file

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

View file

@ -48,17 +48,17 @@ 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}"
fi
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}"
fi
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}"
fi
@ -106,17 +106,17 @@ configure_crun_container() {
if [ "${BOOT}" -eq "1" ]; then
if [ "${autostart}" -eq 1 ]; then
${RUNNER} -U -b "${BUNDLE}" -n "${name}"
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}"
fi
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}"
fi
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}"
fi
@ -139,17 +139,17 @@ configure_crun_container() {
crun resume "${name}"
else
${RUNNER} -U -b "${BUNDLE}" -n "${name}"
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}"
fi
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}"
fi
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}"
fi

View file

@ -35,12 +35,12 @@ mount_cgroup()
fi
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
cd /sys/fs/cgroup || return 1
cd /sys/fs/cgroup
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
mkdir -p "${sys}"
if ! mountpoint -q "${sys}"; then
if ! mount -n -t cgroup -o "${sys}" cgroup "${sys}"; then
rm -f "${sys}" || true
mkdir -p $sys
if ! mountpoint -q $sys; then
if ! mount -n -t cgroup -o $sys cgroup $sys; then
rm -f $sys || true
fi
fi
done

View file

@ -92,11 +92,11 @@ run_container() {
update_network_ns() {
local type
json_select "${2}"
json_select $2
json_get_var type type
if [ "${type}" = "network" ]; then
json_add_string path "/var/run/netns/${NAME}"
return;
break;
fi
json_select ..
}
@ -121,7 +121,7 @@ update_config_json() {
log "jshn.sh missing in the system"
exit 1;
fi
cd "${BUNDLE}/${NAME}" || exit 1;
cd "${BUNDLE}/${NAME}"
if cat config.json |jq '.linux.namespaces[] |select (.type == "network") |.path' |grep -q ${NAME}; then
exit 0;
fi
@ -157,20 +157,20 @@ pull_image_from_registry() {
exit 1
fi
cd "${temp}" || exit 1;
cd "${temp}"
OPTS=""
INSPECT_OPT=""
if [ "${#LOGIN}" -gt 3 ]; then
OPTS="--src-creds ${LOGIN}"
INSPECT_OPT="--creds ${LOGIN}"
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
if ! umoci unpack --image "${NAME}"_tmp:latest "${NAME}" >/dev/null 2>&1; then
if ! umoci unpack --image ${NAME}_tmp:latest ${NAME} >/dev/null 2>&1; then
log "Failed to unpack image"
cd -
rm -rf "${temp}"
@ -185,8 +185,8 @@ pull_image_from_registry() {
fi
# Check disk available space before copy
disksize=$(df -P -k "${BUNDLE}" |tail -n +2 |awk '{print $4}')
exsize=$(du -s "${temp}" |awk '{print $1}')
disksize=$(df -P -k ${BUNDLE} |tail -n +2 |awk '{print $4}')
exsize=$(du -s ${temp} |awk '{print $1}')
if [ "${disksize}" -lt "${exsize}" ]; then
log "Disk space ${disksize} less than required ${exsize}"
cd -
@ -194,12 +194,12 @@ pull_image_from_registry() {
exit 1
fi
mv "${NAME}" "${BUNDLE}"/
mv ${NAME} ${BUNDLE}/
if [ "$?" -ne 0 ]; then
log "Failed ${name} move in ${BUNDLE}"
cd -
rm -rf "${temp}"
rm -rf "${BUNDLE}"/"${NAME}"
rm -rf ${BUNDLE}/${NAME}
exit 1
fi

View file

@ -20,7 +20,7 @@ if [ -n "${lxc_bundle}" ]; then
echo "lxc.lxcpath = ${lxc_bundle}" > /etc/lxc/lxc.conf
elif [ -n "${lxc}" ]; then
# if lxc_bundle_root not define in swmodd, update it with lxc path
uci_set swmodd globals lxc_bundle_root "${lxc}"
uci_set swmodd globals lxc_bundle_root ${lxc}
uci_commit
else
mkdir -p /etc/lxc
@ -35,7 +35,7 @@ if [ -z "${oci_bundle}" ] && [ -n "${lxc_bundle}" ]; then
uci_commit
elif [ -z "${oci_bundle}" ] && [ -n "${lxc}" ]; then
# if oci_bundle_root not defined in swmodd, update it with lxc path
uci_set swmodd globals oci_bundle_root "${lxc}"
uci_set swmodd globals oci_bundle_root ${lxc}
uci_commit
elif [ -z "${oci_bundle}" ]; then
uci_set swmodd globals oci_bundle_root "/srv/"