Skip to content

Commit

Permalink
new package: incus
Browse files Browse the repository at this point in the history
  • Loading branch information
dkwo committed Dec 31, 2023
1 parent 1b14965 commit 82c6e64
Show file tree
Hide file tree
Showing 6 changed files with 87 additions and 0 deletions.
1 change: 1 addition & 0 deletions srcpkgs/incus-client
1 change: 1 addition & 0 deletions srcpkgs/incus-tools
2 changes: 2 additions & 0 deletions srcpkgs/incus/files/incus-user/check
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/sh
incus config show >/dev/null 2>&1
4 changes: 4 additions & 0 deletions srcpkgs/incus/files/incus-user/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
#!/bin/sh
exec 2>&1
export PATH=/usr/libexec/incus:${PATH}
exec /usr/libexec/incus/incus-user --group incus
13 changes: 13 additions & 0 deletions srcpkgs/incus/files/incus/run
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
#!/bin/sh
exec 2>&1
_systemd_cgrp="/sys/fs/cgroup/systemd"
if [ ! -d ${_systemd_cgrp} ]; then
mkdir ${_systemd_cgrp}
fi
if ! mountpoint -q "${_systemd_cgrp}"; then
mount -t cgroup -o none,name=systemd cgroup ${_systemd_cgrp}
fi

[ -r conf ] && . ./conf
export PATH=/usr/libexec/incus:${PATH}
exec /usr/libexec/incus/incusd --group incus-admin --syslog ${OPTS:- --verbose}
66 changes: 66 additions & 0 deletions srcpkgs/incus/template
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
# Template file for 'incus'
pkgname=incus
version=0.4.0
revision=1
build_style=go
go_import_path=github.com/lxc/incus
go_build_tags=libsqlite3
go_package="${go_import_path}/cmd/incus
${go_import_path}/cmd/fuidshift
${go_import_path}/cmd/lxc-to-incus
${go_import_path}/cmd/incus-benchmark
${go_import_path}/cmd/incusd
${go_import_path}/cmd/incus-user"
hostmakedepends="pkg-config"
makedepends="lxc-devel acl-devel cowsql-devel raft-devel eudev-libudev-devel"
depends="lxc acl acl-progs rsync squashfs-tools xz dnsmasq iptables attr-progs"
short_desc="Powerful system container and virtual machine manager"
maintainer="dkwo <npiazza@disroot.org>"
license="Apache-2.0"
homepage="https://linuxcontainers.org/incus"
distfiles="https://github.com/lxc/incus/archive/refs/tags/v${version}.tar.gz"
checksum=1195d8aecaf838806b88580dfc8b48302dcbb4612addcb6d6bfa480f14d97a0d
system_groups="incus-admin incus"

export CGO_LDFLAGS_ALLOW="(-Wl,-wrap,pthread_create)|(-Wl,-z,now)"
export GOFLAGS="-buildmode=pie"

post_build() {
CGO_LDFLAGS="-static" go install -p "${XBPS_MAKEJOBS}" -v -tags netgo -ldflags "${go_ldflags}" "${go_import_path}/cmd/incus-migrate"
CGO_LDFLAGS="-static" go install -p "${XBPS_MAKEJOBS}" -v -tags agent,netgo -ldflags "${go_ldflags}" "${go_import_path}/cmd/incus-agent"
cd cmd/lxd-to-incus && go install -v ./
}

do_check() {
go test -v -tags libsqlite3 -skip TestConvertNetworkConfig ./...
}

pre_install() {
vmkdir usr/libexec/incus
for f in ${GOPATH}/bin/{incusd,incus-user,incus-agent}; do
vinstall "$f" 0700 usr/libexec/incus && rm "$f"
done
}

post_install() {
vsv incus
}

incus-client_package() {
short_desc+=" - client"
depends="${sourcepkg}>=${version}_${revision}"
pkg_install() {
vmove usr/bin/incus
vsv incus-user
vcompletion scripts/bash/incus bash
}
}

incus-tools_package() {
short_desc+=" - tools"
pkg_install() {
for _tool in fuidshift lxc-to-incus lxd-to-incus incus-benchmark incus-migrate; do
vmove usr/bin/${_tool}
done
}
}

0 comments on commit 82c6e64

Please sign in to comment.