Subject: bug#583: lxc-templates: Devuan template for LXC

From: Ryutaroh Matsumoto <[email-masked]>
Date: Sun, 30 May 2021 19:07:51 +0900 (JST)

Package: lxc-templates
Version: 3.0.4-5
Severity: normal
Tags: patch chimaera ceres

Dear Maintainer,

There is no official way to build an LXC container running a Devuan host.
I modified /usr/share/lxc/templates/lxc-debian so that it can install Devuan
as attached diff.
I tested the modified template by the following two cases
on Devuan Chimaera amd64 host:

lxc-create -n devuan-beowulf -t devuan -- -F --enable-non-free -r beowulf
lxc-create -n beowulf-arm64 -t devuan -- -F --enable-non-free -r beowulf -a arm64

Best regards, Ryutaroh Matsumoto

-- System Information:
Distributor ID:	Devuan
Description:	Devuan GNU/Linux 4 (chimaera)
Release:	4
Codename:	n/a
Architecture: x86_64

Kernel: Linux 5.10.0-6-amd64 (SMP w/2 CPU threads)
Kernel taint flags: TAINT_FIRMWARE_WORKAROUND
Locale: LANG=en_US.UTF-8, LC_CTYPE=en_US.UTF-8 (charmap=UTF-8), LANGUAGE=en_US:en
Shell: /bin/sh linked to /bin/dash
Init: sysvinit (via /sbin/init)
LSM: AppArmor: enabled

Versions of packages lxc-templates depends on:
ii  lxc  1:4.0.6-1

Versions of packages lxc-templates recommends:
ii  bridge-utils       1.7-1
ii  busybox-static     1:1.30.1-6+b1
ii  cloud-image-utils  0.31-2
ii  debootstrap        1.0.123+devuan3
ii  distro-info        1.0
ii  mmdebstrap         0.7.5-2.2
ii  openssl            1.1.1k-1
ii  rsync              3.2.3-4
ii  uuid-runtime       2.36.1-7+devuan1
ii  xz-utils           5.2.5-2

Versions of packages lxc-templates suggests:
ii  qemu-user-static  1:5.2+dfsg-10

-- no debconf information
--- usr/share/lxc/templates/lxc-debian	2021-03-12 19:53:24.000000000 +0900
+++ usr/share/lxc/templates/lxc-devuan	2021-05-30 17:20:09.881654064 +0900
@@ -37,8 +37,8 @@
 export PATH=$PATH:/usr/sbin:/usr/bin:/sbin:/bin
 export GREP_OPTIONS=""
 
-MIRROR=${MIRROR:-http://deb.debian.org/debian}
-SECURITY_MIRROR=${SECURITY_MIRROR:-http://security.debian.org/debian-security}
+MIRROR=${MIRROR:-http://deb.devuan.org/merged}
+SECURITY_MIRROR=${SECURITY_MIRROR:-http://deb.devuan.org/merged}
 LOCALSTATEDIR="/var"
 LXC_TEMPLATE_CONFIG="/usr/share/lxc/config"
 # Allows the lxc-cache directory to be set by environment variable
@@ -98,6 +98,7 @@
 $(for tty in $(seq 1 "$num_tty"); do echo "c${tty}:12345:respawn:/sbin/getty 38400 tty${tty} linux" ; done;)
 p6::ctrlaltdel:/sbin/init 6
 p0::powerfail:/sbin/init 0
+pf::powerwait:/sbin/shutdown -h -P now
 EOF
 
     # symlink mtab
@@ -200,6 +201,9 @@
     local release="${1}"; shift
     local -i release_code=0
 
+    echo "${release}-updates"
+    return 0
+
     # oldoldstable is too old, let's ignore that case.
     if [[ "${release}" == "oldoldstable" ]]; then
         echo "${release}/updates"
@@ -386,7 +390,7 @@
     mkdir -p "$cache"
 
     # If debian-archive-keyring isn't installed, fetch GPG keys directly
-    releasekeyring=/usr/share/keyrings/debian-archive-keyring.gpg
+    releasekeyring=/usr/share/keyrings/devuan-archive-keyring.gpg
     if [ ! -f $releasekeyring ]; then
         releasekeyring="$cache/archive-key.gpg"
         case $release in
@@ -854,7 +858,7 @@
     exit 1
 fi
 
-configure_debian_systemd "$path" "$rootfs" "$config" $num_tty
+#configure_debian_systemd "$path" "$rootfs" "$config" $num_tty
 
 post_process "${rootfs}" "${release}" ${arch} ${hostarch} "${interpreter}" "${packages}"