conmon

OCI container runtime monitor

runtime dependencies systemd (System tools)
cni-plugins
make dependencies git (Development tools)
mkdir /data/buildroot/package/conmon
cat > /data/buildroot/package/conmon/Config.in<< 'EOF'
config BR2_PACKAGE_CONMON
        bool "crun"
        depends on BR2_PACKAGE_GLIBC
        depends on BR2_PACKAGE_GLIB2
        depends on BR2_PACKAGE_SYSTEMD
        depends on BR2_PACKAGE_CNI_PLUGINS
        help
          OCI container runtime monitor
EOF

cat > /data/buildroot/package/conmon/conmon.mk<< 'EOF'
#############################################################
#
# conmon
#
#############################################################
CONMON_VERSION = 2.1.0
CONMON_SOURCE = v$(CONMON_VERSION).tar.gz
CONMON_SITE = https://github.com/containers/conmon/archive/refs/tags

CONMON_DEPENDENCIES = glibc glib2 systemd cni-plugins
CONMON_INSTALL_STAGING = YES

define CONMON_CONFIGURE_CMDS
  cd $(@D)/ && \
  wget https://github.com/archlinux/svntogit-community/blob/packages/containers-common/trunk/mounts.conf && \
  git clone https://github.com/containers/image.git && \
  git clone https://github.com/containers/common.git && \
  git clone https://github.com/containers/storage.git && \
  git clone https://github.com/containers/shortnames.git
endef

define CONMON_BUILD_CMDS
  cd $(@D)/ && \
  make PREFIX=/usr LIBEXECDIR=/usr/lib DESTDIR="${TARGET_DIR}"
endef

define CONMON_INSTALL_STAGING_CMDS
  install -Dm755 $(@D)/conmon/bin/conmon "${STAGING_DIR}/usr/bin/conmon"
endef

define CONMON_INSTALL_TARGET_CMDS
  install -Dm755 $(@D)/conmon/bin/conmon "${TARGET_DIR}/usr/bin/conmon"
  install -vdm 755 "${TARGET_DIR}/etc/containers/oci/hooks.d/"
  install -vdm 755 "${TARGET_DIR}/etc/containers/registries.conf.d/"
  install -vdm 755 "${TARGET_DIR}/usr/share/containers/oci/hooks.d/"
  install -vdm 755 "${TARGET_DIR}/var/lib/containers/"
  install -vDm 644 $(@D)/mounts.conf -t "${TARGET_DIR}/etc/containers/"
  install -vDm 644 $(@D)/image/registries.conf -t "${TARGET_DIR}/etc/containers/"
  install -vDm 644 $(@D)/shortnames/shortnames.conf "${TARGET_DIR}/etc/containers/registries.conf.d/00-shortnames.conf"
  install -vDm 644 $(@D)/storage/storage.conf -t "${TARGET_DIR}/etc/containers/"
  install -vDm 644 $(@D)/storage/storage.conf -t "${TARGET_DIR}/usr/share/containers/"
endef

$(eval $(generic-package))
EOF

sed -i '/menu "Custom packages"/a source "package/conmon/Config.in' /data/buildroot/package/Config.in