This commit is contained in:
rosbeef andino 2024-03-07 02:59:07 +01:00 committed by GitHub
commit 36f50aaddd
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
2 changed files with 30 additions and 3 deletions

View file

@ -116,7 +116,7 @@ libvirt or vanilla LXCs**, especially because they all require a daemon based
on DNSmasq and therefore require to listen on port 53. on DNSmasq and therefore require to listen on port 53.
On a Debian-based system (regular Debian, Ubuntu, Mint ...), LXD can be On a Debian-based system (regular Debian, Ubuntu, Mint ...), LXD can be
installed using `snapd`. On other systems like Archlinux, you will probably also installed using `snapd` or directly with `apt` since bookworm . On other systems like Archlinux, you will probably also
be able to install `snapd` using the system package manager (or even be able to install `snapd` using the system package manager (or even
`lxd` directly). `lxd` directly).

31
ynh-dev
View file

@ -199,12 +199,13 @@ function start_ynhdev()
local DIST=${1:-bookworm} local DIST=${1:-bookworm}
local YNH_BRANCH=${3:-unstable} local YNH_BRANCH=${3:-unstable}
local BOX=${2:-ynh-dev}-${DIST}-${YNH_BRANCH} local BOX=${2:-ynh-dev}-${DIST}-${YNH_BRANCH}
local ARCH=$(dpkg --print-architecture)
if ! sudo lxc info $BOX &>/dev/null if ! sudo lxc info $BOX &>/dev/null
then then
if ! sudo lxc image info $BOX-base &>/dev/null if ! sudo lxc image info $BOX-base &>/dev/null
then then
LXC_BASE="ynh-dev-$DIST-amd64-$YNH_BRANCH-base" LXC_BASE="ynh-dev-$DIST-$ARCH-$YNH_BRANCH-base"
sudo lxc launch yunohost:$LXC_BASE $BOX -c security.nesting=true -c security.privileged=true \ sudo lxc launch yunohost:$LXC_BASE $BOX -c security.nesting=true -c security.privileged=true \
|| critical "Failed to launch the container ?" || critical "Failed to launch the container ?"
else else
@ -246,10 +247,36 @@ function rebuild_ynhdev()
local DIST=${1:-bookworm} local DIST=${1:-bookworm}
local YNH_BRANCH=${3:-unstable} local YNH_BRANCH=${3:-unstable}
local BOX=${2:-ynh-dev}-${DIST}-${YNH_BRANCH} local BOX=${2:-ynh-dev}-${DIST}-${YNH_BRANCH}
local ARCH=$(dpkg --print-architecture)
set -x set -x
sudo lxc info $BOX-rebuild >/dev/null && sudo lxc delete $BOX-rebuild --force sudo lxc info $BOX-rebuild >/dev/null && sudo lxc delete $BOX-rebuild --force
sudo lxc launch images:debian/$DIST/amd64 $BOX-rebuild -c security.nesting=true -c security.privileged=true if [[ ${ARCH} -eq "armhf" ]] ;
then
sudo apt install debootstrap -y
sudo mkdir -p ~/lxc-images/debian-$DIST/img
sudo debootstrap $DIST ~/lxc-images/debian-$DIST/img
sudo tar -czf ~/lxc-images/debian-$DIST/rootfs.tar.gz -C ~/lxc-images/debian-$DIST/img .
sudo cat << EOF > ~/lxc-images/debian-$DIST/metadata.yaml
creation_date: $(date +%s)
properties:
architecture: "$ARCH"
description: "Yunohost Debian ($DIST)"
os: "debian"
release: "$DIST"
EOF
sudo tar -czf ~/lxc-images/debian-$DIST/metadata.tar.gz -C ~/lxc-images/debian-$DIST/ metadata.yaml
sudo lxc image import ~/lxc-images/debian-$DIST/metadata.tar.gz ~/lxc-images/debian-$DIST/rootfs.tar.gz --alias $BOX-rebuild
sudo lxc launch $BOX-rebuild $BOX-rebuild -c security.nesting=true -c security.privileged=true
sudo lxc exec $BOX-rebuild -- dhclient
sudo lxc exec $BOX-rebuild -- bash -c "cat << EOF > /etc/network/interfaces.d/eth0
auto eth0
iface eth0 inet dhcp
allow-hotplug eth0
EOF"
else
sudo lxc launch images:debian/$DIST/$ARCH $BOX-rebuild -c security.nesting=true -c security.privileged=true
fi
sleep 5 sleep 5
sudo lxc exec $BOX-rebuild -- apt install curl -y sudo lxc exec $BOX-rebuild -- apt install curl -y
INSTALL_SCRIPT="https://install.yunohost.org/$DIST" INSTALL_SCRIPT="https://install.yunohost.org/$DIST"