mirror of
https://dev.iopsys.eu/feed/iopsys.git
synced 2025-12-10 07:44:50 +01:00
swmodd: Added cgroup mount handler swmodd-cgroup pkg
This commit is contained in:
parent
35f978ed06
commit
d4f8c95dea
2 changed files with 74 additions and 4 deletions
|
|
@ -5,7 +5,7 @@
|
||||||
include $(TOPDIR)/rules.mk
|
include $(TOPDIR)/rules.mk
|
||||||
|
|
||||||
PKG_NAME:=swmodd
|
PKG_NAME:=swmodd
|
||||||
PKG_VERSION:=2.1.7
|
PKG_VERSION:=2.1.8
|
||||||
|
|
||||||
LOCAL_DEV:=0
|
LOCAL_DEV:=0
|
||||||
ifneq ($(LOCAL_DEV),1)
|
ifneq ($(LOCAL_DEV),1)
|
||||||
|
|
@ -30,15 +30,23 @@ define Package/swmodd
|
||||||
SUBMENU:=TRx69
|
SUBMENU:=TRx69
|
||||||
TITLE:= Software Modules Daemon
|
TITLE:= Software Modules Daemon
|
||||||
DEPENDS:=+libuci +libubox +ubus +libuuid +opkg +libcurl \
|
DEPENDS:=+libuci +libubox +ubus +libuuid +opkg +libcurl \
|
||||||
+PACKAGE_liblxc:liblxc +cgroupfs-mount \
|
+PACKAGE_liblxc:liblxc +@BUSYBOX_CONFIG_BUSYBOX \
|
||||||
+@BUSYBOX_CONFIG_BUSYBOX +@BUSYBOX_CONFIG_FEATURE_SHOW_SCRIPT \
|
+@BUSYBOX_CONFIG_FEATURE_SHOW_SCRIPT +@BUSYBOX_CONFIG_SCRIPT \
|
||||||
+@BUSYBOX_CONFIG_SCRIPT
|
+swmodd-cgroup
|
||||||
endef
|
endef
|
||||||
|
|
||||||
define Package/swmodd/description
|
define Package/swmodd/description
|
||||||
Software module daemon to manage software/deployment units using TR181 datamodel.
|
Software module daemon to manage software/deployment units using TR181 datamodel.
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Package/swmodd-cgroup
|
||||||
|
SECTION:=utils
|
||||||
|
CATEGORY:=Utilities
|
||||||
|
SUBMENU:=TRx69
|
||||||
|
TITLE:= Cgroup mount handler for Software modules daemon
|
||||||
|
DEPENDS:=+@CONFIG_KERNEL_CGROUPS
|
||||||
|
endef
|
||||||
|
|
||||||
TARGET_CFLAGS += \
|
TARGET_CFLAGS += \
|
||||||
-D_GNU_SOURCE \
|
-D_GNU_SOURCE \
|
||||||
-Wall -Werror
|
-Wall -Werror
|
||||||
|
|
@ -85,4 +93,10 @@ ifeq ($(CONFIG_PACKAGE_crun),y)
|
||||||
endif
|
endif
|
||||||
endef
|
endef
|
||||||
|
|
||||||
|
define Package/swmodd-cgroup/install
|
||||||
|
$(INSTALL_DIR) $(1)/etc/init.d
|
||||||
|
$(INSTALL_BIN) ./files/etc/init.d/swmodd_cgroup $(1)/etc/init.d/swmodd_cgroup
|
||||||
|
endef
|
||||||
|
|
||||||
|
$(eval $(call BuildPackage,swmodd-cgroup))
|
||||||
$(eval $(call BuildPackage,swmodd))
|
$(eval $(call BuildPackage,swmodd))
|
||||||
|
|
|
||||||
56
swmodd/files/etc/init.d/swmodd_cgroup
Normal file
56
swmodd/files/etc/init.d/swmodd_cgroup
Normal file
|
|
@ -0,0 +1,56 @@
|
||||||
|
#!/bin/sh /etc/rc.common
|
||||||
|
|
||||||
|
START=01
|
||||||
|
|
||||||
|
log() {
|
||||||
|
echo "swmodd_cgroup: ${@}" >/dev/console
|
||||||
|
}
|
||||||
|
|
||||||
|
cgroup_remounting_required()
|
||||||
|
{
|
||||||
|
if ! mount |grep -q '/sys/fs/cgroup '; then
|
||||||
|
return 1;
|
||||||
|
fi
|
||||||
|
|
||||||
|
if grep -v '^#' /etc/fstab | grep -q cgroup; then
|
||||||
|
log "fstab mounted system, remounting of cgroup not required"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ ! -d /sys/fs/cgroup ] && [ ! -e /proc/cgroups ]; then
|
||||||
|
log "cgroup fs not found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
umount /sys/fs/cgroup
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
|
||||||
|
mount_cgroup()
|
||||||
|
{
|
||||||
|
|
||||||
|
if ! cgroup_remounting_required; then
|
||||||
|
log "cgroup remounting not required"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
mount -t tmpfs -o uid=0,gid=0,mode=0755 cgroup /sys/fs/cgroup
|
||||||
|
cd /sys/fs/cgroup
|
||||||
|
for sys in $(awk '!/^#/ { if ($4 == 1) print $1 }' /proc/cgroups); do
|
||||||
|
mkdir -p $sys
|
||||||
|
if ! mountpoint -q $sys; then
|
||||||
|
if ! mount -n -t cgroup -o $sys cgroup $sys; then
|
||||||
|
rm -f $sys || true
|
||||||
|
fi
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
|
||||||
|
if [ -e /sys/fs/cgroup/memory/memory.use_hierarchy ]; then
|
||||||
|
echo 1 > /sys/fs/cgroup/memory/memory.use_hierarchy
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
boot()
|
||||||
|
{
|
||||||
|
mount_cgroup
|
||||||
|
}
|
||||||
Loading…
Add table
Reference in a new issue