swmodd: 2.1.16

This commit is contained in:
vdutta 2022-09-16 19:53:12 +05:30
parent b29e32fcb7
commit 7babfc6995
2 changed files with 11 additions and 17 deletions

View file

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

View file

@ -101,6 +101,13 @@ update_network_ns() {
json_select ..
}
nginx_hack() {
# replace nginx user to root user
if [ -f "${BUNDLE:?}/${NAME:?}/rootfs/etc/nginx/nginx.conf" ]; then
sed -i 's/^user .*;$/user root;/' "${BUNDLE}/${NAME}/rootfs/etc/nginx/nginx.conf"
fi
}
update_config_json() {
if [ ! -f "${BUNDLE:?}/${NAME:?}/config.json" ]; then
@ -125,10 +132,12 @@ update_config_json() {
json_select linux
json_for_each_item update_network_ns namespaces
json_dump >config.json
nginx_hack
}
pull_image_from_registry() {
local temp raw blobsize disksize exsize
local temp disksize exsize
if [ -z "${BUNDLE}" -o -z "${NAME}" -o -z "${REGURL}" ]; then
log "Information missing for installation"
@ -155,21 +164,6 @@ pull_image_from_registry() {
OPTS="--src-creds ${LOGIN}"
INSPECT_OPT="--creds ${LOGIN}"
fi
# inspect and get size check system
raw=$(skopeo --command-timeout 30s inspect ${INSPECT_OPT} --raw ${REGURL})
blobsize=$(echo $raw|jq '[ .layers[].size ] | add' 2>/dev/null)
if [ -z "${blobsize}" ]; then
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}" ]; 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
log "Failed to download image"
cd -