mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
swmodd: 2.5.11
Update default bundle root to '/container', swmodd only starts if '/container' mounted and accessible. Mounting of persistent storage to '/container' is out of scope of swmodd.
This commit is contained in:
parent
72e4b4f0cb
commit
90dfcd0ad3
6 changed files with 30 additions and 29 deletions
|
|
@ -5,7 +5,7 @@
|
|||
include $(TOPDIR)/rules.mk
|
||||
|
||||
PKG_NAME:=swmodd
|
||||
PKG_VERSION:=2.5.10
|
||||
PKG_VERSION:=2.5.11
|
||||
|
||||
LOCAL_DEV:=0
|
||||
ifneq ($(LOCAL_DEV),1)
|
||||
|
|
|
|||
|
|
@ -3,3 +3,4 @@ config globals 'globals'
|
|||
option debug '1'
|
||||
option log_level '3'
|
||||
option lan_bridge 'br-lan'
|
||||
option root '/container'
|
||||
|
|
|
|||
|
|
@ -241,7 +241,7 @@ start_service() {
|
|||
|
||||
env=$(uci -q get swmodd.@execenv[0].name)
|
||||
if [ -z "${root}" ] || [ -z "${bridge}" ]; then
|
||||
log "Base bundle root[$root] or bridge[$bridge] not defined"
|
||||
log "# Base bundle root[$root] or bridge[$bridge] not defined"
|
||||
return 0;
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -91,13 +91,8 @@ start_service() {
|
|||
[ ! -d "/run" ] && ln -fs /var/run /run
|
||||
|
||||
if [ ! -d "${root}" ]; then
|
||||
log "# root [${root}] not present, creating ..."
|
||||
if [ -n "${root}" ]; then
|
||||
mkdir -p "${root}"
|
||||
else
|
||||
log "# Not starting, root [${root}] not defined"
|
||||
return 1
|
||||
fi
|
||||
log "# Not starting, Base root [${root}] not accessible/defined"
|
||||
return 1
|
||||
fi
|
||||
|
||||
# Currently only one execenv supported
|
||||
|
|
|
|||
|
|
@ -74,7 +74,7 @@ setup_container_network() {
|
|||
}
|
||||
|
||||
run_container() {
|
||||
local bundle name bridge
|
||||
local bundle name bridge network
|
||||
|
||||
bundle="${1}"
|
||||
name="${2}"
|
||||
|
|
@ -85,7 +85,13 @@ run_container() {
|
|||
return 1
|
||||
fi
|
||||
|
||||
setup_container_network "${name}" "${bridge}"
|
||||
# Only do the network setup if defined in config
|
||||
network="$(cat ${BUNDLE}/${NAME}/config.json |jq '.linux.namespaces[] |select (.type == "network")')"
|
||||
if [ -n "${network}" ] ; then
|
||||
setup_container_network "${name}" "${bridge}"
|
||||
else
|
||||
log "Network not defined in config, using host network..."
|
||||
fi
|
||||
|
||||
script -q -c "crun run -b ${bundle}/${name} ${name}" /dev/null
|
||||
}
|
||||
|
|
|
|||
|
|
@ -10,32 +10,31 @@ configure_ee_path() {
|
|||
config_get oci_bundle globals oci_bundle_root ""
|
||||
|
||||
mkdir -p /etc/lxc
|
||||
if [ -n "${lxc_bundle}" ]; then
|
||||
# if lxc_bundle_root define in swmodd, then remove it
|
||||
name=$(echo ${lxc_bundle##/*/})
|
||||
root=$(echo ${lxc_bundle%/$name})
|
||||
echo "lxc.lxcpath = ${lxc_bundle}" > /etc/lxc/lxc.conf
|
||||
uci_set swmodd globals lxc_bundle_root ""
|
||||
fi
|
||||
|
||||
if [ -n "${oci_bundle}" ]; then
|
||||
# if oci_bundle_root define in swmodd, then remove it
|
||||
name=$(echo ${oci_bundle##/*/})
|
||||
root=$(echo ${oci_bundle%/$name})
|
||||
echo "lxc.lxcpath = ${oci_bundle}" > /etc/lxc/lxc.conf
|
||||
elif [ -n "${lxc_bundle}" ]; then
|
||||
# if lxc_bundle_root define in swmodd, then remove it
|
||||
name=$(echo ${lxc_bundle##/*/})
|
||||
root=$(echo ${lxc_bundle%/$name})
|
||||
echo "lxc.lxcpath = ${lxc_bundle}" > /etc/lxc/lxc.conf
|
||||
elif [ -f /etc/lxc/lxc.conf ]; then
|
||||
bundle_path=$(cat /etc/lxc/lxc.conf | grep "lxc.lxcpath" | cut -d "=" -f 2 | sed 's/[[:blank:]]//g')
|
||||
name=$(echo ${bundle_path##/*/})
|
||||
root=$(echo ${bundle_path%/$name})
|
||||
else
|
||||
name="lxc"
|
||||
root="/srv"
|
||||
echo "lxc.lxcpath = /srv/lxc" > /etc/lxc/lxc.conf
|
||||
uci_set swmodd globals oci_bundle_root ""
|
||||
fi
|
||||
|
||||
uci_set swmodd globals oci_bundle_root ""
|
||||
uci_set swmodd globals lxc_bundle_root ""
|
||||
|
||||
# configure root in globals section
|
||||
if ! uci_get swmodd globals root >/dev/null; then
|
||||
uci_set swmodd globals root ${root}
|
||||
if [ -n "${root}" ]; then
|
||||
if ! uci_get swmodd globals root >/dev/null; then
|
||||
uci_set swmodd globals root ${root}
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -z "${name}" ]; then
|
||||
name="oci"
|
||||
fi
|
||||
|
||||
# configure execenv in swmodd
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue