aboutsummaryrefslogtreecommitdiff
path: root/system/incus
diff options
context:
space:
mode:
authorChristoph Willing <chris.willing@linux.com>2024-09-08 17:03:23 +0700
committerWilly Sudiarto Raharjo <willysr@slackbuilds.org>2024-09-09 06:36:15 +0700
commitbfe59f8fbf7011b38196073cc53f0675c68c2338 (patch)
treea3b865987a717b623cc34658961e7e325798956d /system/incus
parenta6e8fcb598b08df13bb3388add1aece029567793 (diff)
system/incus: Added (system container).
Signed-off-by: Willy Sudiarto Raharjo <willysr@slackbuilds.org>
Diffstat (limited to 'system/incus')
-rw-r--r--system/incus/README42
-rw-r--r--system/incus/doinst.sh32
-rw-r--r--system/incus/incus.SlackBuild118
-rw-r--r--system/incus/incus.info10
-rwxr-xr-xsystem/incus/rc.incusd.new47
-rw-r--r--system/incus/slack-desc19
6 files changed, 268 insertions, 0 deletions
diff --git a/system/incus/README b/system/incus/README
new file mode 100644
index 0000000000000..630ef12e690b5
--- /dev/null
+++ b/system/incus/README
@@ -0,0 +1,42 @@
+Incus is a next generation system container and virtual
+machine manager.
+
+Incus, which is named after the Cumulonimbus incus or anvil
+cloud started as community fork of Canonical's LXD following
+Canonical's takeover of the LXD project from the Linux Containers
+community.
+
+The project was then adopted by the Linux Containers community,
+taking back the spot left empty by LXD's departure.
+
+Incus is a true open source community project, free of any CLA
+and remains released under the Apache 2.0 license. It is
+maintained by the same team of developers that first created LXD.
+
+LXD users wishing to migrate to Incus can easily do so
+through a migration tool called lxd-to-incus.
+
+
+The incusd server runs as root with client access via various
+"incus" commands. A particular user group can be assigned
+whose members are able run incus commands without becoming root.
+The default group is wheel but a different group may be used,
+as desired, by setting the INCUSD_GROUP environment variable
+when running this SlackBuild
+e.g.
+ INCUSD_GROUP=incus-admin bash incus.SlackBuild
+In this case, users belonging to the incus-admin group are able
+to run incus commands successfully. The incus-admin group does
+not exist in a default Slackware installation so it would need
+to have been already created.
+
+To start incusd by hand, ensure that the /etc/rc.d/rc.incusd
+file is executable and then run:
+ /etc/rc.d/rc.incusd start
+To start incusd automatically whenever the system boots, add
+the following snippet to /etc/rc.d/rc.local
+
+# Start incusd
+if [ -x /etc/rc.d/rc.incusd ]; then
+ . /etc/rc.d/rc.incusd start
+fi
diff --git a/system/incus/doinst.sh b/system/incus/doinst.sh
new file mode 100644
index 0000000000000..96b3a5736b116
--- /dev/null
+++ b/system/incus/doinst.sh
@@ -0,0 +1,32 @@
+
+config() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ # If there's no config file by that name, mv it over:
+ if [ ! -r $OLD ]; then
+ mv $NEW $OLD
+ elif [ "$(cat $OLD | md5sum)" = "$(cat $NEW | md5sum)" ]; then
+ # toss the redundant copy
+ rm $NEW
+ fi
+ # Otherwise, we leave the .new copy for the admin to consider...
+}
+
+preserve_perms() {
+ NEW="$1"
+ OLD="$(dirname $NEW)/$(basename $NEW .new)"
+ if [ -e $OLD ]; then
+ cp -a $OLD ${NEW}.incoming
+ cat $NEW > ${NEW}.incoming
+ mv ${NEW}.incoming $NEW
+ fi
+ config $NEW
+}
+preserve_perms etc/rc.d/rc.incusd.new
+preserve_perms etc/default/incus.new
+
+if [ -f etc/profile.d/bash_completion.sh ]; then
+ echo "Setting up bash completions for incus"
+ . etc/profile.d/bash_completion.sh
+fi
+
diff --git a/system/incus/incus.SlackBuild b/system/incus/incus.SlackBuild
new file mode 100644
index 0000000000000..242f6d7111d2a
--- /dev/null
+++ b/system/incus/incus.SlackBuild
@@ -0,0 +1,118 @@
+#!/bin/bash
+
+# Slackware build script for incus
+
+# Copyright 2024 Christoph Willing Sydney, Australia
+# All rights reserved.
+#
+# Redistribution and use of this script, with or without modification, is
+# permitted provided that the following conditions are met:
+#
+# 1. Redistributions of this script must retain the above copyright
+# notice, this list of conditions and the following disclaimer.
+#
+# THIS SOFTWARE IS PROVIDED BY THE AUTHOR "AS IS" AND ANY EXPRESS OR IMPLIED
+# WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
+# MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO
+# EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+# PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
+# OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
+# WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
+# OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
+# ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+cd $(dirname $0) ; CWD=$(pwd)
+
+PRGNAM=incus
+VERSION=${VERSION:-6.5}
+BUILD=${BUILD:-1}
+TAG=${TAG:-_SBo}
+PKGTYPE=${PKGTYPE:-tgz}
+
+if [ -z "$ARCH" ]; then
+ case "$( uname -m )" in
+ i?86) ARCH=i586 ;;
+ arm*) ARCH=arm ;;
+ *) ARCH=$( uname -m ) ;;
+ esac
+fi
+
+if [ ! -z "${PRINT_PACKAGE_NAME}" ]; then
+ echo "$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE"
+ exit 0
+fi
+
+TMP=${TMP:-/tmp/SBo}
+PKG=$TMP/package-$PRGNAM
+OUTPUT=${OUTPUT:-/tmp}
+
+set -e
+
+rm -rf $PKG
+mkdir -p $TMP $PKG $OUTPUT
+cd $TMP
+rm -rf $PRGNAM-$VERSION
+tar xvf $CWD/$PRGNAM-$VERSION.tar.xz
+cd $PRGNAM-$VERSION
+chown -R root:root .
+find -L . \
+ \( -perm 777 -o -perm 775 -o -perm 750 -o -perm 711 -o -perm 555 \
+ -o -perm 511 \) -exec chmod 755 {} \; -o \
+ \( -perm 666 -o -perm 664 -o -perm 640 -o -perm 600 -o -perm 444 \
+ -o -perm 440 -o -perm 400 \) -exec chmod 644 {} \;
+find -L . -type f|xargs sed -i -e "s:ubuntu/22.04:slackware/15.0:"
+
+# Ensure correct go is used
+. /etc/profile.d/go.sh
+
+# Build
+export GOFLAGS="-buildmode=pie -modcacherw"
+export CGO_LDFLAGS_ALLOW="-Wl,-z,now"
+GO_LDFLAGS="-compressdwarf=false -linkmode external"
+CGO_LDFLAGS="-static" go build -v -tags "agent" -o bin/ ./cmd/incus-agent/...
+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-user; do
+ go build -v -ldflags "${GO_LDFLAGS}" -tags "libsqlite3" -o bin/ ./cmd/$tool
+done
+
+# Install
+for tool in incus incus-agent incus-user lxd-to-incus; do
+ install -v -p -Dm755 "bin/$tool" "$PKG/usr/bin/$tool"
+done
+install -v -p -Dm755 "bin/incusd" "$PKG/usr/sbin/incusd"
+
+# Bash completions
+./bin/incus completion bash | install -Dm644 /dev/stdin "$PKG/usr/share/bash-completion/completions/incus"
+./bin/incus completion zsh | install -Dm644 /dev/stdin "$PKG/usr/share/zsh/site-functions/_incus"
+./bin/incus completion fish | install -Dm644 /dev/stdin "$PKG/usr/share/fish/vendor_completions.d/incus.fish"
+
+find $PKG -print0 | xargs -0 file | grep -e "executable" -e "shared object" | grep ELF \
+ | cut -f 1 -d : | xargs strip --strip-unneeded 2> /dev/null || true
+
+mkdir -p $PKG/usr/doc/$PRGNAM-$VERSION
+cp -a \
+ AUTHORS CONTRIBUTING* COPYING README* SECURITY* \
+ doc/html/reference/manpages/* \
+ $PKG/usr/doc/$PRGNAM-$VERSION
+cat $CWD/$PRGNAM.SlackBuild > $PKG/usr/doc/$PRGNAM-$VERSION/$PRGNAM.SlackBuild
+
+INCUSD_GROUP=${INCUSD_GROUP:-wheel}
+mkdir -p $PKG/etc/default
+cat >$PKG/etc/default/incus.new <<EOF
+
+INCUSD_GROUP=$INCUSD_GROUP
+
+EOF
+
+mkdir $PKG/etc/rc.d
+install -m664 $CWD/rc.incusd.new $PKG/etc/rc.d/
+# Directory specified in rc.incusd for log file
+mkdir -p $PKG/var/log/incus
+
+mkdir -p $PKG/install
+cat $CWD/slack-desc > $PKG/install/slack-desc
+cat $CWD/doinst.sh > $PKG/install/doinst.sh
+
+cd $PKG
+/sbin/makepkg -l y -c n $OUTPUT/$PRGNAM-$VERSION-$ARCH-$BUILD$TAG.$PKGTYPE
diff --git a/system/incus/incus.info b/system/incus/incus.info
new file mode 100644
index 0000000000000..f8fa452537d96
--- /dev/null
+++ b/system/incus/incus.info
@@ -0,0 +1,10 @@
+PRGNAM="incus"
+VERSION="6.5"
+HOMEPAGE="https://linuxcontainers.org/incus"
+DOWNLOAD="https://github.com/lxc/incus/releases/download/v6.5.0/incus-6.5.tar.xz"
+MD5SUM="499d7352183418a854accd55d4f241e0"
+DOWNLOAD_x86_64=""
+MD5SUM_x86_64=""
+REQUIRES="cowsql edk2-ovmf google-go-lang"
+MAINTAINER="Christoph Willing"
+EMAIL="chris.willing@linux.com"
diff --git a/system/incus/rc.incusd.new b/system/incus/rc.incusd.new
new file mode 100755
index 0000000000000..ab8637d829f87
--- /dev/null
+++ b/system/incus/rc.incusd.new
@@ -0,0 +1,47 @@
+#!/bin/sh
+#
+# /etc/rc.d/rc.incusd
+#
+# start/stop/restart incusd as a daemon.
+
+
+INCUSD_GROUP=wheel
+
+# Use defaults from /etc/default/incusd
+# (overrides anything set above).
+#
+if [ -r /etc/default/incusd ]; then
+ . /etc/default/incusd
+fi
+
+
+incusd_start() {
+ echo "Starting incusd: /usr/sbin/incus --group $INCUSD_GROUP --logfile=/var/log/incus/incusd.log"
+ INCUS_EDK2_PATH=/usr/share/edk2-ovmf-x64 /usr/sbin/incusd --group $INCUSD_GROUP --logfile=/var/log/incus/incusd.log 2>/dev/null &
+
+}
+
+incusd_stop() {
+ killall /usr/sbin/incusd
+}
+
+incusd_restart() {
+ incusd_stop
+ sleep 1
+ incusd_start
+}
+
+case "$1" in
+'start')
+ # We don't want to run this more than once, so just use restart to start it:
+ incusd_restart
+ ;;
+'stop')
+ incusd_stop
+ ;;
+'restart')
+ incusd_restart
+ ;;
+*)
+ incusd_start
+esac
diff --git a/system/incus/slack-desc b/system/incus/slack-desc
new file mode 100644
index 0000000000000..0fbed380f039a
--- /dev/null
+++ b/system/incus/slack-desc
@@ -0,0 +1,19 @@
+# HOW TO EDIT THIS FILE:
+# The "handy ruler" below makes it easier to edit a package description.
+# Line up the first '|' above the ':' following the base package name, and
+# the '|' on the right side marks the last column you can put a character in.
+# You must make exactly 11 lines for the formatting to be correct. It's also
+# customary to leave one space after the ':' except on otherwise blank lines.
+
+ |-----handy-ruler------------------------------------------------------|
+incus: incus (Container & VM Manager)
+incus:
+incus: Incus is a next generation system container and virtual
+incus: machine manager.
+incus:
+incus: It provides a user experience similar to that of a public cloud.
+incus: With it, you can easily mix and match both containers and
+incus: virtual machines, sharing the same underlying storage and network.
+incus:
+incus:
+incus: