Merge pull request 'feat: add incus' (#28) from neoloc/incus into master
Reviewed-on: https://git.query.consul/unkin/rpmbuilder/pulls/28
This commit is contained in:
commit
f508b1ea7f
1
rpms/incus/6.10.1/release
Normal file
1
rpms/incus/6.10.1/release
Normal file
@ -0,0 +1 @@
|
||||
1
|
||||
55
rpms/incus/Dockerfile
Normal file
55
rpms/incus/Dockerfile
Normal file
@ -0,0 +1,55 @@
|
||||
# Start with the AlmaLinux 8.10 base image
|
||||
FROM git.query.consul/unkin/almalinux9-rpmbuilder:latest
|
||||
|
||||
# Create output directory for RPMs
|
||||
RUN mkdir -p /app/dist
|
||||
|
||||
# Set working directory
|
||||
WORKDIR /app
|
||||
|
||||
ARG PACKAGE_RELEASE
|
||||
ENV PACKAGE_RELEASE=${PACKAGE_RELEASE}
|
||||
ARG PACKAGE_VERSION
|
||||
ENV PACKAGE_VERSION=${PACKAGE_VERSION}
|
||||
|
||||
COPY scripts /app/scripts
|
||||
COPY resources /app/resources
|
||||
|
||||
# Download the required files
|
||||
RUN dnf install -y \
|
||||
unzip \
|
||||
libtool \
|
||||
autoconf \
|
||||
automake \
|
||||
gcc \
|
||||
make \
|
||||
git \
|
||||
go \
|
||||
cowsql-devel \
|
||||
libacl-devel \
|
||||
libcap-devel \
|
||||
libseccomp-devel \
|
||||
libuv-devel \
|
||||
raft-devel \
|
||||
libudev-devel \
|
||||
lxc-devel \
|
||||
libsqlite3x-devel \
|
||||
sqlite-devel \
|
||||
systemd-rpm-macros \
|
||||
bash-completion \
|
||||
gettext \
|
||||
help2man \
|
||||
wget && \
|
||||
wget -O /app/incus.tar.gz https://github.com/lxc/incus/archive/refs/tags/v${PACKAGE_VERSION}.tar.gz && tar -C /app -xf incus.tar.gz && \
|
||||
wget https://go.dev/dl/go1.24.1.linux-amd64.tar.gz && rm -rf /usr/local/go && tar -C /usr/local -xzf go1.24.1.linux-amd64.tar.gz && \
|
||||
export PATH=/usr/local/go/bin:$PATH && \
|
||||
pushd /app/incus-${PACKAGE_VERSION} && \
|
||||
make deps && \
|
||||
export CGO_CFLAGS="-I/root/go/deps/raft/include/ -I/root/go/deps/cowsql/include/" && \
|
||||
export CGO_LDFLAGS="-L/root/go/deps/raft/.libs -L/root/go/deps/cowsql/.libs/" && \
|
||||
export LD_LIBRARY_PATH="/root/go/deps/raft/.libs/:/root/go/deps/cowsql/.libs/" && \
|
||||
export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)" && \
|
||||
make build
|
||||
|
||||
# Default command to build RPMs
|
||||
CMD /app/scripts/build-packages.sh
|
||||
15
rpms/incus/resources/incus-startup.service
Normal file
15
rpms/incus/resources/incus-startup.service
Normal file
@ -0,0 +1,15 @@
|
||||
[Unit]
|
||||
Description=Incus - Instance startup
|
||||
After=incus.socket incus.service
|
||||
Requires=incus.socket
|
||||
|
||||
[Service]
|
||||
Type=oneshot
|
||||
ExecStart=/usr/libexec/incus/incusd activateifneeded
|
||||
ExecStop=/usr/libexec/incus/shutdown
|
||||
TimeoutStartSec=600s
|
||||
TimeoutStopSec=600s
|
||||
RemainAfterExit=yes
|
||||
|
||||
[Install]
|
||||
WantedBy=multi-user.target
|
||||
11
rpms/incus/resources/incus-user.service
Normal file
11
rpms/incus/resources/incus-user.service
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Incus - User daemon
|
||||
After=incus-user.socket incus.service
|
||||
Requires=incus-user.socket
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/libexec/incus/incus-user --group incus
|
||||
Restart=on-failure
|
||||
|
||||
[Install]
|
||||
Also=incus-user.socket
|
||||
11
rpms/incus/resources/incus-user.socket
Normal file
11
rpms/incus/resources/incus-user.socket
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Incus - Daemon (user unix socket)
|
||||
|
||||
[Socket]
|
||||
ListenStream=/run/incus/unix.socket.user
|
||||
SocketGroup=incus
|
||||
SocketMode=0660
|
||||
Service=incus-user.service
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
21
rpms/incus/resources/incus.service
Normal file
21
rpms/incus/resources/incus.service
Normal file
@ -0,0 +1,21 @@
|
||||
[Unit]
|
||||
Description=Incus - Daemon
|
||||
After=network-online.target openvswitch-switch.service lxcfs.service incus.socket
|
||||
Requires=network-online.target lxcfs.service incus.socket
|
||||
|
||||
[Service]
|
||||
Environment=INCUS_OVMF_PATH=/usr/share/edk2/ovmf
|
||||
Environment=INCUS_SOCKET=/run/incus/unix.socket
|
||||
ExecStart=/usr/libexec/incus/incusd --group incus-admin
|
||||
ExecStartPost=/usr/libexec/incus/incusd waitready --timeout=600
|
||||
KillMode=process
|
||||
TimeoutStartSec=600s
|
||||
TimeoutStopSec=30s
|
||||
Restart=on-failure
|
||||
Delegate=yes
|
||||
LimitNOFILE=1048576
|
||||
LimitNPROC=infinity
|
||||
TasksMax=infinity
|
||||
|
||||
[Install]
|
||||
Also=incus-startup.service incus.socket
|
||||
11
rpms/incus/resources/incus.socket
Normal file
11
rpms/incus/resources/incus.socket
Normal file
@ -0,0 +1,11 @@
|
||||
[Unit]
|
||||
Description=Incus - Daemon (unix socket)
|
||||
|
||||
[Socket]
|
||||
ListenStream=/run/incus/unix.socket
|
||||
SocketGroup=incus-admin
|
||||
SocketMode=0660
|
||||
Service=incus.service
|
||||
|
||||
[Install]
|
||||
WantedBy=sockets.target
|
||||
38
rpms/incus/resources/nfpm_incus-client.yaml
Normal file
38
rpms/incus/resources/nfpm_incus-client.yaml
Normal file
@ -0,0 +1,38 @@
|
||||
# nfpm_incus-client.yaml
|
||||
|
||||
name: incus-client
|
||||
version: ${PACKAGE_VERSION}
|
||||
release: ${PACKAGE_RELEASE}
|
||||
arch: amd64
|
||||
platform: linux
|
||||
section: default
|
||||
priority: extra
|
||||
description: "Powerful system container and virtual machine manager."
|
||||
|
||||
maintainer: Incus
|
||||
homepage: https://github.com/lxc/incus
|
||||
license: Apache-2.0
|
||||
|
||||
disable_globbing: false
|
||||
|
||||
replaces:
|
||||
- incus-client
|
||||
|
||||
recommends:
|
||||
- incus-tools
|
||||
|
||||
# Files to include in the package
|
||||
contents:
|
||||
- src: /root/go/bin/incus
|
||||
dst: /usr/bin/incus
|
||||
file_info:
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
# Scripts to run during installation/removal (optional)
|
||||
# scripts:
|
||||
# postinstall: ./scripts/postinstall.sh
|
||||
# postremove: ./scripts/postremove.sh
|
||||
# preinstall: ./scripts/preinstall.sh
|
||||
# preremove: ./scripts/preremove.sh
|
||||
59
rpms/incus/resources/nfpm_incus-tools.yaml
Normal file
59
rpms/incus/resources/nfpm_incus-tools.yaml
Normal file
@ -0,0 +1,59 @@
|
||||
# nfpm_incus-tools.yaml
|
||||
|
||||
name: incus-tools
|
||||
version: ${PACKAGE_VERSION}
|
||||
release: ${PACKAGE_RELEASE}
|
||||
arch: amd64
|
||||
platform: linux
|
||||
section: default
|
||||
priority: extra
|
||||
description: "Powerful system container and virtual machine manager."
|
||||
|
||||
maintainer: Incus
|
||||
homepage: https://github.com/lxc/incus
|
||||
license: Apache-2.0
|
||||
|
||||
disable_globbing: false
|
||||
|
||||
replaces:
|
||||
- incus-tools
|
||||
|
||||
# Files to include in the package
|
||||
contents:
|
||||
- src: /root/go/bin/incus-benchmark
|
||||
dst: /usr/bin/incus-benchmark
|
||||
file_info:
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
- src: /root/go/bin/incus-migrate
|
||||
dst: /usr/bin/incus-migrate
|
||||
file_info:
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
- src: /root/go/bin/incus-agent
|
||||
dst: /usr/bin/incus-agent
|
||||
file_info:
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
- src: /root/go/bin/lxc-to-incus
|
||||
dst: /usr/bin/lxc-to-incus
|
||||
file_info:
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
- src: /root/go/bin/lxd-to-incus
|
||||
dst: /usr/bin/lxd-to-incus
|
||||
file_info:
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
# Scripts to run during installation/removal (optional)
|
||||
# scripts:
|
||||
# postinstall: ./scripts/postinstall.sh
|
||||
# postremove: ./scripts/postremove.sh
|
||||
# preinstall: ./scripts/preinstall.sh
|
||||
# preremove: ./scripts/preremove.sh
|
||||
98
rpms/incus/resources/nfpm_incus.yaml
Normal file
98
rpms/incus/resources/nfpm_incus.yaml
Normal file
@ -0,0 +1,98 @@
|
||||
# nfpm_incus.yaml
|
||||
|
||||
name: incus
|
||||
version: ${PACKAGE_VERSION}
|
||||
release: ${PACKAGE_RELEASE}
|
||||
arch: amd64
|
||||
platform: linux
|
||||
section: default
|
||||
priority: extra
|
||||
description: "Powerful system container and virtual machine manager."
|
||||
|
||||
maintainer: Incus
|
||||
homepage: https://github.com/lxc/incus
|
||||
license: Apache-2.0
|
||||
|
||||
disable_globbing: false
|
||||
|
||||
replaces:
|
||||
- incus
|
||||
|
||||
depends:
|
||||
- incus-client
|
||||
- lxcfs
|
||||
- cowsql
|
||||
- raft
|
||||
|
||||
recommends:
|
||||
- incus-tools
|
||||
|
||||
# Files to include in the package
|
||||
contents:
|
||||
- src: /root/go/bin/incusd
|
||||
dst: /usr/libexec/incus/incusd
|
||||
file_info:
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
- src: /root/go/bin/incus-user
|
||||
dst: /usr/libexec/incus/incus-user
|
||||
file_info:
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
- src: /app/resources/shutdown
|
||||
dst: /usr/libexec/incus/shutdown
|
||||
file_info:
|
||||
mode: 0755
|
||||
owner: root
|
||||
group: root
|
||||
- src: /app/resources/incus.service
|
||||
dst: /usr/lib/systemd/system/incus.service
|
||||
file_info:
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
- src: /app/resources/incus.socket
|
||||
dst: /usr/lib/systemd/system/incus.socket
|
||||
file_info:
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
- src: /app/resources/incus-user.service
|
||||
dst: /usr/lib/systemd/system/incus-user.service
|
||||
file_info:
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
- src: /app/resources/incus-user.socket
|
||||
dst: /usr/lib/systemd/system/incus-user.socket
|
||||
file_info:
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
- src: /app/resources/incus-startup.service
|
||||
dst: /usr/lib/systemd/system/incus-startup.service
|
||||
file_info:
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
- src: /app/resources/sysusers.d.incus.conf
|
||||
dst: /usr/lib/sysusers.d/incus.conf
|
||||
file_info:
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
- src: /app/resources/tmpfiles.d.incus.conf
|
||||
dst: /usr/lib/tmpfiles.d/incus.conf
|
||||
file_info:
|
||||
mode: 0644
|
||||
owner: root
|
||||
group: root
|
||||
|
||||
# Scripts to run during installation/removal (optional)
|
||||
scripts:
|
||||
postinstall: ./scripts/postinstall.sh
|
||||
preremove: ./scripts/preremove.sh
|
||||
postremove: ./scripts/postremove.sh
|
||||
preinstall: ./scripts/preinstall.sh
|
||||
7
rpms/incus/resources/shutdown
Normal file
7
rpms/incus/resources/shutdown
Normal file
@ -0,0 +1,7 @@
|
||||
#!/usr/bin/sh
|
||||
|
||||
if ! systemctl -q is-active incus.service; then
|
||||
exit 0
|
||||
fi
|
||||
|
||||
exec /usr/lib/incus/incusd shutdown
|
||||
2
rpms/incus/resources/sysusers.d.incus.conf
Normal file
2
rpms/incus/resources/sysusers.d.incus.conf
Normal file
@ -0,0 +1,2 @@
|
||||
g incus-admin -
|
||||
g incus -
|
||||
4
rpms/incus/resources/tmpfiles.d.incus.conf
Normal file
4
rpms/incus/resources/tmpfiles.d.incus.conf
Normal file
@ -0,0 +1,4 @@
|
||||
d /var/cache/incus 0700 root root - -
|
||||
d /var/log/incus 0700 root root - -
|
||||
d /var/lib/incus 0711 root root - -
|
||||
d /run/incus 0711 root root - -
|
||||
4
rpms/incus/scripts/build-packages.sh
Executable file
4
rpms/incus/scripts/build-packages.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/bash
|
||||
nfpm pkg --config /app/resources/nfpm_incus.yaml --target /app/dist --packager rpm && \
|
||||
nfpm pkg --config /app/resources/nfpm_incus-client.yaml --target /app/dist --packager rpm && \
|
||||
nfpm pkg --config /app/resources/nfpm_incus-tools.yaml --target /app/dist --packager rpm
|
||||
2
rpms/incus/scripts/postinstall.sh
Executable file
2
rpms/incus/scripts/postinstall.sh
Executable file
@ -0,0 +1,2 @@
|
||||
#!/usr/bin/env bash
|
||||
systemctl daemon-reload
|
||||
5
rpms/incus/scripts/postremove.sh
Executable file
5
rpms/incus/scripts/postremove.sh
Executable file
@ -0,0 +1,5 @@
|
||||
#!/usr/bin/env bash
|
||||
systemctl daemon-reload
|
||||
rm -rf /usr/libexec/incus
|
||||
groupdel incus-admin
|
||||
groupdel incus
|
||||
4
rpms/incus/scripts/preinstall.sh
Executable file
4
rpms/incus/scripts/preinstall.sh
Executable file
@ -0,0 +1,4 @@
|
||||
#!/usr/bin/env bash
|
||||
mkdir -p /usr/libexec/incus/
|
||||
groupadd --system incus-admin
|
||||
groupadd --system incus
|
||||
6
rpms/incus/scripts/preremove.sh
Executable file
6
rpms/incus/scripts/preremove.sh
Executable file
@ -0,0 +1,6 @@
|
||||
#!/usr/bin/env bash
|
||||
systemctl stop incus.service
|
||||
systemctl stop incus.socket
|
||||
systemctl stop incus-user.service
|
||||
systemctl stop incus-user.socket
|
||||
systemctl stop incus-startup.service
|
||||
Loading…
Reference in New Issue
Block a user