diff --git a/swmodd/Config.in b/swmodd/Config.in index 18ae04489..029439616 100644 --- a/swmodd/Config.in +++ b/swmodd/Config.in @@ -1,53 +1,82 @@ -menu "Configuration" +config SWMODD_REGISTRY_PULL_SUPPORT + bool "Add support to pull images from container image registries (i.e: docker.io, quay.io)" depends on PACKAGE_swmodd + default n + select PACKAGE_skopeo + select PACKAGE_umoci - config SWMODD_LXC_SUPPORT - bool "Handles LXC based containers" - default y +config SWMODD_LXC_SUPPORT + bool "Handles LXC based containers" + depends on PACKAGE_swmodd + default y + select PACKAGE_lxc + select PACKAGE_lxc-attach + select PACKAGE_lxc-auto + select PACKAGE_lxc-cgroup + select PACKAGE_lxc-checkconfig + select PACKAGE_lxc-common + select PACKAGE_lxc-config + select PACKAGE_lxc-configs + select PACKAGE_lxc-console + select PACKAGE_lxc-create + select PACKAGE_lxc-destroy + select PACKAGE_lxc-execute + select PACKAGE_lxc-freeze + select PACKAGE_lxc-hooks + select PACKAGE_lxc-info + select PACKAGE_lxc-init + select PACKAGE_lxc-ls + select PACKAGE_lxc-start + select PACKAGE_lxc-stop + select PACKAGE_lxc-templates + select PACKAGE_lxc-top + select PACKAGE_lxc-unfreeze + select PACKAGE_lxc-unprivileged + select PACKAGE_lxc-unshare + select PACKAGE_lxc-user-nic + select PACKAGE_lxc-usernsexec + select PACKAGE_lxc-wait - config SWMODD_OCI_SUPPORT - bool "Handles OCI containers" - default y - depends on PACKAGE_swmodd - select PACKAGE_crun +config SWMODD_OCI_SUPPORT + bool "Handles OCI containers" + depends on PACKAGE_swmodd + default y + select PACKAGE_crun - config SWMODD_REGISTRY_PULL_SUPPORT - bool "Add support to pull images from container image registries (i.e: docker.io, quay.io)" - default n - depends on PACKAGE_swmodd - select PACKAGE_skopeo - select PACKAGE_umoci +config SWMODD_KERNEL_OPTIONS + bool "Enable kernel support for LXC and OCI containers" + depends on PACKAGE_swmodd + default y + select LXC_KERNEL_OPTIONS + select LXC_BUSYBOX_OPTIONS + select LXC_SECCOMP + select LXC_NETWORKING + select KERNEL_CGROUPS + select KERNEL_CGROUP_SCHED + select KERNEL_CGROUP_DEVICE + select KERNEL_CGROUP_FREEZER + select KERNEL_CGROUP_CPUACCT + select KERNEL_CGROUP_NET_PRIO + select KERNEL_NET_CLS_CGROUP + select KERNEL_NAMESPACES + select KERNEL_DEVPTS_MULTIPLE_INSTANCES + select KERNEL_POSIX_MQUEUE + select KERNEL_FAIR_GROUP_SCHED + select KERNEL_RT_GROUP_SCHED + select KERNEL_MEMCG + select KERNEL_MEMCG_KMEM + select KERNEL_CPUSETS + select PACKAGE_kmod-ikconfig + help + Select needed kernel options for LXC and CRUN related utilities. Options + include cgroups, namespaces and other miscellaneous options. These + options unfortunately can not be installed as a module. - config SWMODD_KERNEL_OPTIONS - bool "Enable kernel support for LXC and OCI containers" - default y - select KERNEL_CGROUPS - select KERNEL_CGROUP_SCHED - select KERNEL_CGROUP_DEVICE - select KERNEL_CGROUP_FREEZER - select KERNEL_CGROUP_CPUACCT - select KERNEL_CGROUP_NET_PRIO - select KERNEL_NET_CLS_CGROUP - select KERNEL_NAMESPACES - select KERNEL_DEVPTS_MULTIPLE_INSTANCES - select KERNEL_POSIX_MQUEUE - select KERNEL_FAIR_GROUP_SCHED - select KERNEL_RT_GROUP_SCHED - select KERNEL_MEMCG - select KERNEL_MEMCG_KMEM - select KERNEL_CPUSETS - select PACKAGE_kmod-ikconfig - help - Select needed kernel options for LXC and CRUN related utilities. Options - include cgroups, namespaces and other miscellaneous options. These - options unfortunately can not be installed as a module. - - config SWMODD_NETWORKING - bool "Enable networking support for LXC/OCI containers" - default y - select PACKAGE_kmod-veth - select PACKAGE_kmod-macvlan - help - Enable "veth pair device" and "macvlan" - -endmenu +config SWMODD_NETWORKING + bool "Enable networking support for LXC/OCI containers" + depends on PACKAGE_swmodd + default y + select PACKAGE_kmod-veth + select PACKAGE_kmod-macvlan + help + Enable "veth pair device" and "macvlan" diff --git a/swmodd/Makefile b/swmodd/Makefile index 5f8b6fc75..e43af2ec6 100755 --- a/swmodd/Makefile +++ b/swmodd/Makefile @@ -5,7 +5,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=swmodd -PKG_VERSION:=2.2.8 +PKG_VERSION:=2.2.9 LOCAL_DEV:=0 ifneq ($(LOCAL_DEV),1) @@ -28,6 +28,7 @@ define Package/swmodd CATEGORY:=Utilities SUBMENU:=TRx69 TITLE:= Software Modules Daemon + MENU:=1 DEPENDS:=+libuci +libubox +ubus +libuuid +opkg +libcurl \ +PACKAGE_lxc:lxc +PACKAGE_liblxc:liblxc +@BUSYBOX_CONFIG_BUSYBOX \ +@BUSYBOX_CONFIG_FEATURE_SHOW_SCRIPT +@BUSYBOX_CONFIG_SCRIPT \ @@ -54,12 +55,12 @@ TARGET_CFLAGS += \ -D_GNU_SOURCE \ -Wall -Werror -ifeq ($(CONFIG_PACKAGE_crun),y) +ifeq ($(CONFIG_SWMODD_OCI_SUPPORT),y) MAKE_FLAGS += \ SWMOD_CRUN="yes" endif -ifeq ($(CONFIG_PACKAGE_lxc),y) +ifeq ($(CONFIG_SWMODD_LXC_SUPPORT),y) MAKE_FLAGS += \ SWMOD_LXC="yes" endif diff --git a/swmodd/files/etc/init.d/swmodd b/swmodd/files/etc/init.d/swmodd index eb6b8aa9a..a838b6dea 100644 --- a/swmodd/files/etc/init.d/swmodd +++ b/swmodd/files/etc/init.d/swmodd @@ -6,6 +6,11 @@ STOP=01 USE_PROCD=1 PROG=/usr/sbin/swmodd +log() +{ + logger -t swmodd.init "$*" +} + validate_globals_section() { uci_validate_section swmodd swmodd "globals" \ @@ -70,9 +75,15 @@ start_service() { [ "${enabled}" -eq 0 ] && return 0 - # Create the bundle paths if not present - [ -n "${lxc_bundle_root}" ] && mkdir -p "${lxc_bundle_root}" - [ -n "${oci_bundle_root}" ] && mkdir -p "${oci_bundle_root}" + if [ ! -d "${lxc_bundle_root}" ]; then + log "# Not staring lxc [${lxc_bundle_root}] not present/defined" + return 1 + fi + + if [ ! -d "${oci_bundle_root}" ]; then + log "# Not staring oci [${oci_bundle_root}] not present/defined" + return 1 + fi procd_open_instance swmodd procd_set_param command ${PROG} diff --git a/swmodd/files/etc/uci-defaults/01-fix-bundle-path b/swmodd/files/etc/uci-defaults/01-fix-bundle-path index d479e4733..0539c181c 100644 --- a/swmodd/files/etc/uci-defaults/01-fix-bundle-path +++ b/swmodd/files/etc/uci-defaults/01-fix-bundle-path @@ -21,23 +21,18 @@ if [ -n "${lxc_bundle}" ]; then 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_commit else mkdir -p /etc/lxc echo "lxc.lxcpath = /srv/" > /etc/lxc/lxc.conf uci_set swmodd globals lxc_bundle_root "/srv/" - uci_commit fi if [ -z "${oci_bundle}" ] && [ -n "${lxc_bundle}" ]; then # if oci_bundle_root not defined in swmodd, update it with lxc_bundle_root if defined uci_set swmodd globals oci_bundle_root ${lxc_bundle} - 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_commit elif [ -z "${oci_bundle}" ]; then uci_set swmodd globals oci_bundle_root "/srv/" - uci_commit fi