mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
swmodd: support EnvVariables in InstallDU
This commit is contained in:
parent
c511308992
commit
8761d04533
3 changed files with 28 additions and 6 deletions
|
|
@ -5,13 +5,13 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=swmodd
|
||||
PKG_VERSION:=2.5.3.2
|
||||
PKG_VERSION:=2.5.3.4
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
PKG_SOURCE_PROTO:=git
|
||||
PKG_SOURCE_URL:=https://dev.iopsys.eu/lcm/swmodd.git
|
||||
PKG_SOURCE_VERSION:=d8cc9a7a3749975720c9b748adadb2b6c920acdc
|
||||
PKG_SOURCE_VERSION:=e5a260a007b1465784334071040113a220bee0c1
|
||||
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz
|
||||
PKG_MIRROR_HASH:=skip
|
||||
endif
|
||||
|
|
|
|||
|
|
@ -56,7 +56,7 @@ configure_lxc_container() {
|
|||
}
|
||||
|
||||
configure_crun_container() {
|
||||
local name type autostart du_status requested_state url username password capability
|
||||
local name type autostart du_status requested_state url username password capability envlist
|
||||
local BRIDGE BUNDLE BOOT PERM
|
||||
local RUNNER="/etc/swmodd/run.sh"
|
||||
|
||||
|
|
@ -74,6 +74,12 @@ configure_crun_container() {
|
|||
config_get username "${1}" username ""
|
||||
config_get password "${1}" password ""
|
||||
config_get capability "${1}" capability ""
|
||||
config_get envlist "${1}" env_var ""
|
||||
|
||||
if [ -n "${envlist}" ]; then
|
||||
envlist="${envlist// /;}"
|
||||
fi
|
||||
|
||||
if [ -n "${capability}" ]; then
|
||||
PERM="-p ${capability// /,}"
|
||||
fi
|
||||
|
|
@ -152,7 +158,7 @@ configure_crun_container() {
|
|||
|
||||
if [ "${BOOT}" -eq "1" ]; then
|
||||
if [ "${autostart}" -eq 1 ]; then
|
||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}" ${PERM}
|
||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}" -e "${envlist}" ${PERM}
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer "${1}" description "${result}"
|
||||
|
|
@ -185,7 +191,7 @@ configure_crun_container() {
|
|||
${RUNNER} -u -n "${name}" -i "${BRIDGE}" ${PERM}
|
||||
crun resume "${name}"
|
||||
else
|
||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}" ${PERM}
|
||||
${RUNNER} -U -b "${BUNDLE}" -n "${name}" -e "${envlist}" ${PERM}
|
||||
result=$(cat ${BUNDLE}/${name}/config.json |jq ".annotations.org_opencontainers_image_description")
|
||||
if [ "${result}" != "null" ]; then
|
||||
uci_set ocicontainer "${1}" description "${result}"
|
||||
|
|
|
|||
|
|
@ -144,6 +144,20 @@ update_config_json() {
|
|||
json_add_string hostname "${NAME}"
|
||||
fi
|
||||
|
||||
if [ -n "${ENVLIST}" ]; then
|
||||
json_select process
|
||||
json_get_values preenv env
|
||||
json_select env
|
||||
for i in ${ENVLIST//;/ }; do
|
||||
key="$(echo $i|cut -d= -f1)"
|
||||
if [[ "${preenv}" != *"${key}="* ]]; then
|
||||
json_add_string "" "${i}"
|
||||
fi
|
||||
done
|
||||
json_select ..
|
||||
json_select ..
|
||||
fi
|
||||
|
||||
# Update cabalities
|
||||
if [ -n "${PERM}" ]; then
|
||||
log "Updating Permission in the json ..."
|
||||
|
|
@ -264,8 +278,9 @@ clean=0
|
|||
net_update=0
|
||||
update_json=0
|
||||
PERM=""
|
||||
ENVLIST=""
|
||||
|
||||
while getopts b:n:i:r:l:t:p:cuU options
|
||||
while getopts b:n:i:r:l:t:p:e:cuU options
|
||||
do
|
||||
case "${options}" in
|
||||
b) BUNDLE=${OPTARG};;
|
||||
|
|
@ -276,6 +291,7 @@ do
|
|||
r) REGURL=${OPTARG};;
|
||||
l) LOGIN=${OPTARG};;
|
||||
t) TIMEOUT=${OPTARG};;
|
||||
e) ENVLIST=${OPTARG};;
|
||||
u) net_update=1;;
|
||||
U) update_json=1;;
|
||||
*) log "Invalid options";;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue