diff --git a/Makefile b/Makefile index 64e44db9..6d57a3cd 100644 --- a/Makefile +++ b/Makefile @@ -9,6 +9,7 @@ QMDIR=/usr/lib/qm SPECFILE=rpm/qm.spec SPECFILE_SUBPACKAGE_KVM=rpm/kvm/qm-kvm.spec SPECFILE_SUBPACKAGE_SOUND=rpm/sound/sound.spec +SPECFILE_SUBPACKAGE_VIDEO=rpm/video/video.spec SPECFILE_SUBPACKAGE_ROS2_ROLLING=rpm/ros2/rolling/ros2_rolling.spec RPM_TOPDIR ?= $(PWD)/rpmbuild VERSION ?= $(shell cat VERSION) @@ -117,6 +118,16 @@ sound_subpackage: clean dist ## - Creates a local RPM package, usefu --define="version ${VERSION}" \ ${SPECFILE_SUBPACKAGE_SOUND} +.PHONY: video_subpackage +video_subpackage: clean dist ## - Creates a local RPM package, useful for development + mkdir -p ${RPM_TOPDIR}/{RPMS,SRPMS,BUILD,SOURCES} + tools/version-update -v ${VERSION} + cp ./rpm/v${VERSION}.tar.gz ${RPM_TOPDIR}/SOURCES + rpmbuild -ba \ + --define="_topdir ${RPM_TOPDIR}" \ + --define="version ${VERSION}" \ + ${SPECFILE_SUBPACKAGE_VIDEO} + # ostree target is a helper for everything required for ostree .PHONY: ostree @@ -137,11 +148,6 @@ qm_dropin_mount_bind_ttyUSB0: ## - QM RPM sub-package to mount bind /dev/tty sed -i 's/%define enable_qm_mount_bind_ttyUSB0 0/%define enable_qm_mount_bind_ttyUSB0 1/' ${SPECFILE} $(MAKE) VERSION=${VERSION} rpm -.PHONY: qm_dropin_mount_bind_video0 -qm_dropin_mount_bind_video0: ## - QM RPM sub-package to mount bind /dev/video0 in the nested containers - sed -i 's/%define enable_qm_mount_bind_video 0/%define enable_qm_mount_bind_video 1/' ${SPECFILE} - $(MAKE) VERSION=${VERSION} rpm - .PHONY: qm_dropin_mount_bind_tty7 qm_dropin_mount_bind_tty7: ## - QM RPM sub-package to mount bind /dev/tty7 in the nested containers sed -i 's/%define enable_qm_mount_bind_tty7 0/%define enable_qm_mount_bind_tty7 1/' ${SPECFILE} diff --git a/rpm/qm.spec b/rpm/qm.spec index dcdf2a63..b063934e 100644 --- a/rpm/qm.spec +++ b/rpm/qm.spec @@ -40,11 +40,6 @@ ########################################### %define enable_qm_mount_bind_ttyUSB0 0 -########################################### -# subpackage QM - mount bind /dev/video # -########################################### -%define enable_qm_mount_bind_video 0 - ########################################### # subpackage QM - input devices # ########################################### @@ -216,25 +211,6 @@ install -d %{buildroot}%{_sysconfdir}/containers/containers.conf.d # END - qm dropin sub-package - mount ttyUSB0 # ######################################################## -######################################################## -# START - qm dropin sub-package - mount video # -######################################################## -%if %{enable_qm_mount_bind_video} - mkdir -p %{buildroot}/%{rootfs_qm}/%{_sysconfdir}/containers/systemd/ - # first step - add drop-in file in /etc/containers/containers.d.conf/qm_dropin_mount_bind_video.conf - # to QM container mount video - install -m 644 %{_builddir}/qm-%{version}/etc/qm/containers/containers.conf.d/qm_dropin_mount_bind_video.conf %{buildroot}%{_sysconfdir}/containers/containers.conf.d/qm_dropin_mount_bind_video.conf - - # second step - add drop-in file in /etc/qm/containers/containers.d.conf/qm_dropin/mount_bind_video.conf - # to nested containers in QM env mount bind video - install -m 644 %{_builddir}/qm-%{version}/etc/qm/containers/containers.conf.d/qm_dropin_mount_bind_video.conf %{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_mount_bind_video.conf - - install -m 644 %{_builddir}/qm-%{version}/etc/containers/systemd/rear-camera.container %{buildroot}/%{rootfs_qm}/%{_sysconfdir}/containers/systemd/rear-camera.container -%endif -######################################################## -# END - qm dropin sub-package - mount video # -######################################################## - ######################################################## # START - qm dropin sub-package - mount input # ######################################################## @@ -406,7 +382,6 @@ additional drop-in configurations. %package windowmanager Summary: Optional Window Manager deployed in QM environment (Experimental) Requires: qm_mount_bind_input -Requires: qm_mount_bind_sound %description windowmanager The optional window manager deployed in QM environment as nested container. @@ -453,26 +428,6 @@ done podman exec qm systemctl daemon-reload &> /dev/null %endif -####################################### -# sub-package QM Mount Bind /dev/video# -####################################### -%if %{enable_qm_mount_bind_video} -%package -n qm_mount_bind_video -Summary: Drop-in configuration for QM containers to mount bind /dev/video -Requires: %{name} = %{version}-%{release} -BuildArch: noarch - -%description -n qm_mount_bind_video -This sub-package installs a drop-in configurations for the QM. -It creates the `/etc/qm/containers/containers.conf.d/` directory for adding -additional drop-in configurations. - -%files -n qm_mount_bind_video -%{_sysconfdir}/containers/containers.conf.d/qm_dropin_mount_bind_video.conf -%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_mount_bind_video.conf -%{rootfs_qm}/%{_sysconfdir}/containers/systemd/rear-camera.container -%endif - %changelog %if %{defined autochangelog} %autochangelog diff --git a/rpm/video/video.spec b/rpm/video/video.spec new file mode 100644 index 00000000..42f46b43 --- /dev/null +++ b/rpm/video/video.spec @@ -0,0 +1,36 @@ +Name: qm-mount-bind-video +Version: 0.6.8 +Release: 1%{?dist} +Summary: Drop-in configuration for QM containers to mount bind /dev/video +License: GPL-2.0-only +URL: https://github.com/containers/qm +Source0: %{url}/archive/v%{version}.tar.gz + +BuildArch: noarch +Requires: qm = %{version}-%{release} + +%description +This subpackage installs a drop-in configuration for QM containers to mount bind `/dev/video`. + +%prep +%autosetup -Sgit -n qm-%{version} + +%build +# No build required for configuration files + +%install +install -d %{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d +install -d %{buildroot}%{_sysconfdir}/containers/systemd/ +install -m 644 etc/qm/containers/containers.conf.d/qm_dropin_mount_bind_video.conf \ + %{buildroot}%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_mount_bind_video.conf +install -m 644 etc/containers/systemd/rear-camera.container \ + %{buildroot}%{_sysconfdir}/containers/systemd/rear-camera.container + +%files +%{_sysconfdir}/qm/containers/containers.conf.d/qm_dropin_mount_bind_video.conf +%{_sysconfdir}/containers/systemd/rear-camera.container + +%changelog +* Fri Jul 21 2023 RH Container Bot +- Added video mount bind drop-in configuration. + diff --git a/tools/version-update b/tools/version-update index 3bb6c5f8..2a11e3a0 100755 --- a/tools/version-update +++ b/tools/version-update @@ -59,11 +59,13 @@ sed -i "s/Version: ${PREV_VERSION}$/Version: ${VERSION}/g" "${BASEDIR}/rpm/qm.sp sed -i "s/Version: ${PREV_VERSION}$/Version: ${VERSION}/g" "${BASEDIR}/rpm/kvm/qm-kvm.spec" sed -i "s/Version: ${PREV_VERSION}$/Version: ${VERSION}/g" "${BASEDIR}/rpm/ros2/rolling/ros2_rolling.spec" sed -i "s/Version: ${PREV_VERSION}$/Version: ${VERSION}/g" "${BASEDIR}/rpm/sound/sound.spec" +sed -i "s/Version: ${PREV_VERSION}$/Version: ${VERSION}/g" "${BASEDIR}/rpm/video/video.spec" # Otherwise, set the new version. sed -i "s/Version: 0$/Version: ${VERSION}/g" "${BASEDIR}/rpm/qm.spec" sed -i "s/Version: 0$/Version: ${VERSION}/g" "${BASEDIR}/rpm/kvm/qm-kvm.spec" sed -i "s/Version: 0$/Version: ${VERSION}/g" "${BASEDIR}/rpm/ros2/rolling/ros2_rolling.spec" sed -i "s/Version: 0$/Version: ${VERSION}/g" "${BASEDIR}/rpm/sound/sound.spec" +sed -i "s/Version: 0$/Version: ${VERSION}/g" "${BASEDIR}/rpm/video/video.spec" # Execute the changes on the rest of the files. for file in "${FILES[@]}"; do sed -i "s/${PREV_VERSION}/${VERSION}/g" "${BASEDIR}/${file}"