[packages/incus] - 6.23.0 - based on lxd.spec and Arch - feel free to improve it

witekfl witekfl at pld-linux.org
Sun Apr 19 18:35:57 CEST 2026


commit 0599c498f9f6c092f80ffb55f792adc9e40a64bd
Author: Witold Filipczyk <witekfl at poczta.onet.pl>
Date:   Sun Apr 19 18:34:16 2026 +0200

    - 6.23.0
    - based on lxd.spec and Arch
    - feel free to improve it

 incus.init      | 120 +++++++++++++++++++++++++++++++++
 incus.service   |  19 ++++++
 incus.sh        |  14 ++++
 incus.spec      | 201 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 incus.sysconfig |  11 ++++
 5 files changed, 365 insertions(+)
---
diff --git a/incus.spec b/incus.spec
new file mode 100644
index 0000000..95e66cc
--- /dev/null
+++ b/incus.spec
@@ -0,0 +1,201 @@
+# TODO: proper gid, uid, etc.
+Summary:	Fast, dense and secure container and virtual machine management
+Name:		incus
+Version:	6.23.0
+Release:	0.1
+License:	Apache v2.0
+Group:		Applications/System
+Source0:	https://github.com/lxc/incus/archive/v%{version}/%{name}-%{version}.tar.gz
+# Source0-md5:	d6a9b4c19347272013dc6892064d699a
+Source1:	%{name}.service
+Source2:	%{name}.init
+Source3:	%{name}.sysconfig
+Source4:	%{name}.sh
+URL:		http://linuxcontainers.org/
+BuildRequires:	acl-devel
+BuildRequires:	cowsql-devel >= 1.15.9
+%ifarch %{x8664} arm aarch64 ppc64
+BuildRequires:	criu-devel >= 1.7
+%endif
+BuildRequires:	golang >= 1.23
+BuildRequires:	libco-devel
+BuildRequires:	libuv-devel
+BuildRequires:	lxc-devel >= 3.0
+BuildRequires:	pkgconfig
+BuildRequires:	raft-devel >= 0.14.0
+BuildRequires:	rpmbuild(macros) >= 1.228
+BuildRequires:	udev-devel
+Requires(post,preun):	/sbin/chkconfig
+Requires(postun):	/usr/sbin/groupdel
+Requires(pre):	/usr/bin/getgid
+Requires(pre):	/usr/sbin/groupadd
+Requires:	dnsmasq
+Requires:	iproute2
+Requires:	libcgroup
+Requires:	rc-scripts >= 0.4.0.10
+Requires:	rsync
+Requires:	squashfs
+# for sqfs2tar
+Requires:	squashfs-tools-ng
+Requires:	tar
+Requires:	uidmap
+Requires:	uname(release) >= 4.1
+Requires:	xz
+Provides:	group(incus)
+ExclusiveArch:	%{ix86} %{x8664} %{arm}
+BuildRoot:	%{tmpdir}/%{name}-%{version}-root-%(id -u -n)
+
+%define		_enable_debug_packages 0
+%define		gobuild(o:) go build -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v -x %{?**};
+%define		goinstall go install -ldflags "${LDFLAGS:-} -B 0x$(head -c20 /dev/urandom|od -An -tx1|tr -d ' \\n')" -a -v
+%define		gopath		%{_libdir}/golang
+%define		import_path	github.com/lxc/incus
+%define		_libexecdir	%{_prefix}/lib
+
+%description
+incus is a next generation system container and virtual machine manager.
+
+Specifically, it is made of three components:
+- A system-wide daemon (incus)
+- A command line client (lxc)
+- An OpenStack Nova plugin (nova-compute-incus)
+
+The daemon exports a REST API both locally and if enabled, over the
+network.
+
+The command line tool is designed to be a very simple, yet very
+powerful tool to manage all your containers. It can handle connect to
+multiple container hosts and easily give you an overview of all the
+containers on your network, let you create some more where you want
+them and even move them around while they are running.
+
+The OpenStack plugin then allows you to use your incus hosts as compute
+nodes, running workloads on containers rather than virtual machines.
+
+%package agent
+Summary:	incus Agent
+
+%description agent
+This package contains incus-agent program to be used inside virtual
+machines (not containers) managed by incus.
+
+%package tools
+Summary:	incus Tools
+
+%description tools
+This package contains incus extra tools
+
+%prep
+%setup -q -n %{name}-%{version}
+
+%build
+export GOPATH=$(pwd)/_dist
+export GOBIN=$GOPATH/bin
+# flags from ArchLinux package
+export CGO_LDFLAGS_ALLOW="-Wl,-z,now"
+export GO_LDFLAGS="-compressdwarf=false -linkmode external"
+
+# linux agents
+CGO_ENABLED=0 go build -o bin/ -tags=agent,netgo ./cmd/incus-agent/...
+
+export GOFLAGS="-buildmode=pie -modcacherw"
+go build -v -ldflags "${GO_LDFLAGS}" -tags "netgo" -o bin/ ./cmd/incus-migrate/...
+for tool in fuidshift incus lxc-to-incus lxd-to-incus incusd incus-benchmark incus-simplestreams incus-user; do
+  go build -v -ldflags "${GO_LDFLAGS}" -tags "libsqlite3" -o bin/ ./cmd/$tool
+done
+
+%install
+rm -rf $RPM_BUILD_ROOT
+install -d $RPM_BUILD_ROOT{%{_bindir},%{_sbindir},%{_mandir}/man1,/etc/{rc.d/init.d,sysconfig},%{systemdunitdir}} \
+	$RPM_BUILD_ROOT%{_libexecdir} \
+	$RPM_BUILD_ROOT%{bash_compdir} \
+	$RPM_BUILD_ROOT/var/lib/%{name}/{containers,devices,devincus,images,security,shmounts,snapshots} \
+	$RPM_BUILD_ROOT/var/log/%{name}
+
+install -d $RPM_BUILD_ROOT%{_libdir}/%{name}/rootfs
+
+for tool in incus lxd-to-incus incus-migrate incus-user incusd; do
+	install -p -Dm755 "bin/$tool" "$RPM_BUILD_ROOT%{_bindir}/$tool"
+done
+
+# VM Agents
+for agent in bin/incus-agent*; do
+	install -p -Dm755 "${agent}" "$RPM_BUILD_ROOT%{_libexecdir}/incus/agents/${agent##*/}"
+done
+
+# tools
+for tool in fuidshift lxc-to-incus incus-benchmark incus-simplestreams; do
+	install -p -Dm755 "bin/$tool" "$RPM_BUILD_ROOT%{_bindir}/$tool"
+done
+
+# shell completions
+./bin/incus completion bash | install -Dm644 /dev/stdin "$RPM_BUILD_ROOT/usr/share/bash-completion/completions/incus"
+./bin/incus completion zsh | install -Dm644 /dev/stdin "$RPM_BUILD_ROOT/usr/share/zsh/site-functions/_incus"
+./bin/incus completion fish | install -Dm644 /dev/stdin "$RPM_BUILD_ROOT/usr/share/fish/vendor_completions.d/incus.fish"
+
+cp -p %{SOURCE1} $RPM_BUILD_ROOT%{systemdunitdir}
+install -p %{SOURCE2} $RPM_BUILD_ROOT/etc/rc.d/init.d/%{name}
+cp -p %{SOURCE3} $RPM_BUILD_ROOT/etc/sysconfig/%{name}
+
+install -p %{SOURCE4} $RPM_BUILD_ROOT%{_libexecdir}/incus-wrapper
+
+%pre
+%groupadd -g 273 %{name}
+
+%post
+/sbin/chkconfig --add %{name}
+%service -n %{name} restart
+%systemd_post %{name}.service
+
+
+%preun
+if [ "$1" = "0" ]; then
+	%service -q %{name} stop
+	/sbin/chkconfig --del %{name}
+fi
+%systemd_preun %{name}.service
+
+%postun
+if [ "$1" = "0" ]; then
+	%groupremove %{name}
+fi
+%systemd_reload
+
+%clean
+rm -rf $RPM_BUILD_ROOT
+
+%files
+%defattr(644,root,root,755)
+%doc AUTHORS doc/*
+%config(noreplace) %verify(not md5 mtime size) /etc/sysconfig/%{name}
+%attr(754,root,root) /etc/rc.d/init.d/%{name}
+%attr(755,root,root) %{_bindir}/incus
+%attr(755,root,root) %{_bindir}/incusd
+%attr(755,root,root) %{_bindir}/incus-simplestreams
+%attr(755,root,root) %{_bindir}/incus-user
+%{systemdunitdir}/%{name}.service
+%dir %attr(750,root,root) %{_libdir}/%{name}
+%dir %attr(750,root,root) %{_libdir}/%{name}/rootfs
+%attr(750,root,root) %{_libexecdir}/%{name}-wrapper
+%dir %attr(750,root,logs) /var/log/%{name}
+%dir %attr(711,root,incus) /var/lib/%{name}
+%dir %attr(711,root,root) /var/lib/%{name}/containers
+%dir %attr(700,root,root) /var/lib/%{name}/devices
+%dir %attr(700,root,root) /var/lib/%{name}/devincus
+%dir %attr(700,root,root) /var/lib/%{name}/images
+%dir %attr(700,root,root) /var/lib/%{name}/security
+%dir %attr(711,root,root) /var/lib/%{name}/shmounts
+%dir %attr(700,root,root) /var/lib/%{name}/snapshots
+%{bash_compdir}/incus
+
+%files agent
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_libexecdir}/incus/agents/incus-agent*
+
+%files tools
+%defattr(644,root,root,755)
+%attr(755,root,root) %{_bindir}/fuidshift
+%attr(755,root,root) %{_bindir}/lxc-to-incus
+%attr(755,root,root) %{_bindir}/lxd-to-incus
+%attr(755,root,root) %{_bindir}/incus-benchmark
+%attr(755,root,root) %{_bindir}/incus-migrate
diff --git a/incus.init b/incus.init
new file mode 100755
index 0000000..9852681
--- /dev/null
+++ b/incus.init
@@ -0,0 +1,120 @@
+#!/bin/sh
+#
+# Container hypervisor and a new user experience for LXC
+#
+# chkconfig:	345 20 80
+#
+# processname:	incus
+# pidfile: /var/run/incus.pid
+#
+
+# Source function library
+. /etc/rc.d/init.d/functions
+
+# Get network config
+. /etc/sysconfig/network
+
+# Check that networking is up.
+if is_yes "${NETWORKING}"; then
+	if [ ! -f /var/lock/subsys/network -a "$1" != stop -a "$1" != status ]; then
+		msg_network_down "incus"
+		exit 1
+	fi
+else
+	exit 0
+fi
+
+# Get service config - may override defaults
+[ -f /etc/sysconfig/incus ] && . /etc/sysconfig/incus
+OPTIONS="$OPTIONS --group incus --logfile /var/log/incus/incus.log"
+
+pidfile="/var/run/incus.pid"
+
+start() {
+	if status --pidfile $pidfile incus incus >/dev/null; then
+		msg_already_running "incus"
+		RETVAL=1
+		return
+	fi
+                
+	msg_starting "incus"
+	daemon --fork --waitforname incus /usr/lib/incus-wrapper daemon $OPTIONS 
+	
+	# incus does not write pidfile, so create one
+	show "Checking incus daemon status"
+	busy
+	
+	if incus waitready --timeout=16 2>/dev/null; then
+	    pid=$(lxc info 2>/dev/null | awk '/server_pid:/{print $2}')
+   	    [ -n "$pid" ] && echo $pid > $pidfile
+	fi 
+
+	if [ -n "$pid" ]; then
+		touch /var/lock/subsys/incus
+		ok
+		RETVAL=0
+	else
+		fail
+		RETVAL=1
+	fi
+}
+
+stop() {
+	if [ ! -f /var/lock/subsys/incus ]; then
+		msg_not_running "incus"
+		return
+	fi
+
+	# Stop daemons.
+	msg_stopping "incus"
+	/usr/sbin/incus shutdown 
+	busy
+	sleep 1
+	if status --pidfile $pidfile incus incus >/dev/null; then
+		killproc --pidfile $pidfile incus
+	else
+		ok
+	fi
+	rm -f /var/lock/subsys/incus
+}
+
+condrestart() {
+	if [ ! -f /var/lock/subsys/incus ]; then
+		msg_not_running "incus"
+		RETVAL=$1
+		return
+	fi
+
+	stop
+	start
+}
+
+RETVAL=0
+# See how we were called.
+case "$1" in
+  start)
+	start
+	;;
+  stop)
+	stop
+	;;
+  restart)
+	stop
+	start
+	;;
+  try-restart)
+	condrestart 0
+	;;
+  force-reload)
+	condrestart 7
+	;;
+  status)
+	status --pidfile $pidfile incus incus
+	RETVAL=$?
+	;;
+  *)
+	msg_usage "$0 {start|stop|restart|try-restart|force-reload|status}"
+	exit 3
+esac
+
+exit $RETVAL
diff --git a/incus.service b/incus.service
new file mode 100644
index 0000000..ddbbfd2
--- /dev/null
+++ b/incus.service
@@ -0,0 +1,19 @@
+[Unit]
+Description=Incus Container Hypervisor
+Documentation=http://linuxcontainers.org
+After=network.target
+
+[Service]
+Type=simple
+ExecStart=/usr/bin/incusd daemon
+ExecStop=/usr/bin/incusd shutdown
+ExecReload=/bin/kill -s HUP $MAINPID
+LimitNOFILE=infinity
+LimitNPROC=infinity
+LimitCORE=infinity
+TimeoutStartSec=0
+Delegate=yes
+KillMode=process
+
+[Install]
+WantedBy=multi-user.target
diff --git a/incus.sh b/incus.sh
new file mode 100644
index 0000000..64c3cc8
--- /dev/null
+++ b/incus.sh
@@ -0,0 +1,14 @@
+#!/bin/sh
+# incus daemon wrapper 
+# regardless --logfile option incus prints some messages on stderr at start, they
+# are printed in log file as well, so just ignore stderr here 
+
+if [ "$1" != "daemon" ]; then
+    echo >&2 "This is a wrapper script for incus, executed by service scripts."
+    echo >&2 "Use /usr/bin/incus to run incus manually."
+    exit 1
+fi
+
+exec 1>>/dev/null
+exec 2>&1
+exec /usr/bin/incus "$@"
diff --git a/incus.sysconfig b/incus.sysconfig
new file mode 100644
index 0000000..b3b8f42
--- /dev/null
+++ b/incus.sysconfig
@@ -0,0 +1,11 @@
+# Customized settings for incus
+
+# Define nice level for lxd
+SERVICE_RUN_NICE_LEVEL="+0"
+
+# Setup bigger Max open files and Max processes
+SERVICE_LIMITS="-n 1048576 -u 1048576"
+
+# Modify these options if you want to change the way the lxd daemon runs
+#OPTIONS=""
+
================================================================

---- gitweb:

http://git.pld-linux.org/gitweb.cgi/packages/incus.git/commitdiff/0599c498f9f6c092f80ffb55f792adc9e40a64bd



More information about the pld-cvs-commit mailing list