mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
swmodd: Replace jq with jsonfilter
This commit is contained in:
parent
15e4dd732a
commit
9a59ccc498
3 changed files with 12 additions and 12 deletions
|
|
@ -33,7 +33,7 @@ define Package/swmodd
|
||||||
DEPENDS:=+libuci +libubox +ubus +libuuid +opkg +libcurl \
|
DEPENDS:=+libuci +libubox +ubus +libuuid +opkg +libcurl \
|
||||||
+PACKAGE_lxc:lxc +PACKAGE_lxc:liblxc +@BUSYBOX_CONFIG_BUSYBOX \
|
+PACKAGE_lxc:lxc +PACKAGE_lxc:liblxc +@BUSYBOX_CONFIG_BUSYBOX \
|
||||||
+@BUSYBOX_CONFIG_FEATURE_SHOW_SCRIPT +@BUSYBOX_CONFIG_SCRIPT \
|
+@BUSYBOX_CONFIG_FEATURE_SHOW_SCRIPT +@BUSYBOX_CONFIG_SCRIPT \
|
||||||
+jq +@CONFIG_KERNEL_CGROUPS +SWMODD_LEGACY_CGROUPS:swmodd-cgroup
|
+jsonfilter +@CONFIG_KERNEL_CGROUPS +SWMODD_LEGACY_CGROUPS:swmodd-cgroup
|
||||||
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
DEPENDS+=+libbbfdm-api +libbbfdm-ubus +dm-service
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -101,17 +101,17 @@ configure_crun_container() {
|
||||||
uci_set ocicontainer "${1}" password ""
|
uci_set ocicontainer "${1}" password ""
|
||||||
result=$(${RUNNER} -b "${BUNDLE}" -n "${name}" -r "${url}" -l "${username}:${password}" -t "${TIMEOUT}")
|
result=$(${RUNNER} -b "${BUNDLE}" -n "${name}" -r "${url}" -l "${username}:${password}" -t "${TIMEOUT}")
|
||||||
if [ "$?" -eq 0 ]; then
|
if [ "$?" -eq 0 ]; then
|
||||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
|
result="$(cat ${BUNDLE}/${name}/config.json |jsonfilter -e "@.annotations.org_opencontainers_image_description")"
|
||||||
if [ "${result}" != "null" ]; then
|
if [ "${result}" != "null" ]; then
|
||||||
uci_set ocicontainer "${1}" description "${result}"
|
uci_set ocicontainer "${1}" description "${result}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
|
result="$(cat ${BUNDLE}/${name}/config.json |jsonfilter -e "@.annotations.org_opencontainers_image_vendor")"
|
||||||
if [ "${result}" != "null" ]; then
|
if [ "${result}" != "null" ]; then
|
||||||
uci_set ocicontainer "${1}" vendor "${result}"
|
uci_set ocicontainer "${1}" vendor "${result}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
|
result="$(cat ${BUNDLE}/${name}/config.json |jsonfilter -e "@.annotations.org_opencontainers_image_version")"
|
||||||
if [ "${result}" != "null" ]; then
|
if [ "${result}" != "null" ]; then
|
||||||
uci_set ocicontainer "${1}" version "${result}"
|
uci_set ocicontainer "${1}" version "${result}"
|
||||||
fi
|
fi
|
||||||
|
|
@ -159,17 +159,17 @@ configure_crun_container() {
|
||||||
if [ "${BOOT}" -eq "1" ]; then
|
if [ "${BOOT}" -eq "1" ]; then
|
||||||
if [ "${autostart}" -eq 1 ]; then
|
if [ "${autostart}" -eq 1 ]; then
|
||||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}" -e "${envlist}" ${PERM}
|
${RUNNER} -U -b "${BUNDLE}" -n "${name}" -e "${envlist}" ${PERM}
|
||||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
|
result="$(cat ${BUNDLE}/${name}/config.json |jsonfilter -e "@.annotations.org_opencontainers_image_description")"
|
||||||
if [ "${result}" != "null" ]; then
|
if [ "${result}" != "null" ]; then
|
||||||
uci_set ocicontainer "${1}" description "${result}"
|
uci_set ocicontainer "${1}" description "${result}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
|
result="$(cat ${BUNDLE}/${name}/config.json |jsonfilter -e "@.annotations.org_opencontainers_image_vendor")"
|
||||||
if [ "${result}" != "null" ]; then
|
if [ "${result}" != "null" ]; then
|
||||||
uci_set ocicontainer "${1}" vendor "${result}"
|
uci_set ocicontainer "${1}" vendor "${result}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
|
result="$(cat ${BUNDLE}/${name}/config.json |jsonfilter -e "@.annotations.org_opencontainers_image_version")"
|
||||||
if [ "${result}" != "null" ]; then
|
if [ "${result}" != "null" ]; then
|
||||||
uci_set ocicontainer "${1}" version "${result}"
|
uci_set ocicontainer "${1}" version "${result}"
|
||||||
fi
|
fi
|
||||||
|
|
@ -192,17 +192,17 @@ configure_crun_container() {
|
||||||
crun resume "${name}"
|
crun resume "${name}"
|
||||||
else
|
else
|
||||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}" -e "${envlist}" ${PERM}
|
${RUNNER} -U -b "${BUNDLE}" -n "${name}" -e "${envlist}" ${PERM}
|
||||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
|
result="$(cat ${BUNDLE}/${name}/config.json |jsonfilter -e "@.annotations.org_opencontainers_image_description")"
|
||||||
if [ "${result}" != "null" ]; then
|
if [ "${result}" != "null" ]; then
|
||||||
uci_set ocicontainer "${1}" description "${result}"
|
uci_set ocicontainer "${1}" description "${result}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_vendor")
|
result="$(cat ${BUNDLE}/${name}/config.json |jsonfilter "@.annotations.org_opencontainers_image_vendor")"
|
||||||
if [ "${result}" != "null" ]; then
|
if [ "${result}" != "null" ]; then
|
||||||
uci_set ocicontainer "${1}" vendor "${result}"
|
uci_set ocicontainer "${1}" vendor "${result}"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_version")
|
result="$(cat ${BUNDLE}/${name}/config.json |jsonfilter -e "@.annotations.org_opencontainers_image_version")"
|
||||||
if [ "${result}" != "null" ]; then
|
if [ "${result}" != "null" ]; then
|
||||||
uci_set ocicontainer "${1}" version "${result}"
|
uci_set ocicontainer "${1}" version "${result}"
|
||||||
fi
|
fi
|
||||||
|
|
|
||||||
|
|
@ -86,7 +86,7 @@ run_container() {
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Only do the network setup if defined in config
|
# Only do the network setup if defined in config
|
||||||
network="$(cat ${BUNDLE}/${NAME}/config.json |jq '.linux.namespaces[] |select (.type == "network")')"
|
network="$(cat ${BUNDLE}/${NAME}/config.json |jsonfilter -e '@.linux.namespaces[@.type="network"]')"
|
||||||
if [ -n "${network}" ] ; then
|
if [ -n "${network}" ] ; then
|
||||||
setup_container_network "${name}" "${bridge}"
|
setup_container_network "${name}" "${bridge}"
|
||||||
else
|
else
|
||||||
|
|
@ -128,7 +128,7 @@ update_config_json() {
|
||||||
exit 1;
|
exit 1;
|
||||||
fi
|
fi
|
||||||
cd "${BUNDLE}/${NAME}"
|
cd "${BUNDLE}/${NAME}"
|
||||||
if cat config.json |jq '.linux.namespaces[] |select (.type == "network") |.path' |grep -q ${NAME}; then
|
if cat config.json |jsonfilter -e '@.linux.namespaces[@.type="network"].path' |grep -q ${NAME}; then
|
||||||
# If netns already configured and no additional permission bit assigned, exit from here
|
# If netns already configured and no additional permission bit assigned, exit from here
|
||||||
if [ -z "${PERM}" ]; then
|
if [ -z "${PERM}" ]; then
|
||||||
exit 0;
|
exit 0;
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue