mirror of
https://github.com/YunoHost/ynh-dev.git
synced 2024-09-03 20:05:59 +02:00
Add support for buster dev LXCs
This commit is contained in:
parent
3bdb65cd87
commit
913003acb3
1 changed files with 26 additions and 10 deletions
36
ynh-dev
36
ynh-dev
|
@ -6,9 +6,9 @@ function show_usage() {
|
||||||
${BLUE}On the host, to manage the LXC${NORMAL}
|
${BLUE}On the host, to manage the LXC${NORMAL}
|
||||||
${BLUE}==============================${NORMAL}
|
${BLUE}==============================${NORMAL}
|
||||||
|
|
||||||
start [NAME] (Create and) starts a LXC (ynh-dev by default)
|
start [DIST] (Create and) starts a LXC (stretch by default)
|
||||||
attach [NAME] Attach an already started LXC (ynh-dev by default)
|
attach [DIST] Attach an already started LXC (stretch by default)
|
||||||
destroy [NAME] Destroy the ynh-dev LXC (ynh-dev by default)
|
destroy [DIST] Destroy the ynh-dev LXC (stretch by default)
|
||||||
rebuild Rebuild a fresh, up-to-date box
|
rebuild Rebuild a fresh, up-to-date box
|
||||||
|
|
||||||
${BLUE}Inside the dev instance${NORMAL}
|
${BLUE}Inside the dev instance${NORMAL}
|
||||||
|
@ -132,7 +132,8 @@ function start_ynhdev()
|
||||||
{
|
{
|
||||||
check_lxd_setup
|
check_lxd_setup
|
||||||
|
|
||||||
local BOX=${1:-ynh-dev}
|
local DIST=${1:-stretch}
|
||||||
|
local BOX=ynh-dev-$DIST
|
||||||
|
|
||||||
if ! sudo lxc info $BOX &>/dev/null
|
if ! sudo lxc info $BOX &>/dev/null
|
||||||
then
|
then
|
||||||
|
@ -141,6 +142,10 @@ function start_ynhdev()
|
||||||
set -x
|
set -x
|
||||||
sudo lxc launch $BOX-base $BOX
|
sudo lxc launch $BOX-base $BOX
|
||||||
sudo lxc config set $BOX security.privileged true
|
sudo lxc config set $BOX security.privileged true
|
||||||
|
if [[ "$DIST" == "buster" ]]
|
||||||
|
then
|
||||||
|
sudo lxc config set $BOX-rebuild security.nesting true # Need this for buster because it is using apparmor
|
||||||
|
fi
|
||||||
sudo lxc config device add $BOX ynhdev-shared-folder disk path=/ynh-dev source="$PWD"
|
sudo lxc config device add $BOX ynhdev-shared-folder disk path=/ynh-dev source="$PWD"
|
||||||
set +x
|
set +x
|
||||||
info "Now attaching to the container"
|
info "Now attaching to the container"
|
||||||
|
@ -148,7 +153,7 @@ function start_ynhdev()
|
||||||
info "Attaching to existing container"
|
info "Attaching to existing container"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
attach_ynhdev $BOX
|
attach_ynhdev $DIST
|
||||||
}
|
}
|
||||||
|
|
||||||
function attach_ynhdev()
|
function attach_ynhdev()
|
||||||
|
@ -166,7 +171,7 @@ function attach_ynhdev()
|
||||||
fi
|
fi
|
||||||
|
|
||||||
check_lxd_setup
|
check_lxd_setup
|
||||||
local BOX=${1:-ynh-dev}
|
local BOX=ynh-dev-${1:-stretch}
|
||||||
sudo lxc start $BOX 2>/dev/null || true
|
sudo lxc start $BOX 2>/dev/null || true
|
||||||
sudo lxc exec $BOX --cwd /ynh-dev -- /bin/bash
|
sudo lxc exec $BOX --cwd /ynh-dev -- /bin/bash
|
||||||
}
|
}
|
||||||
|
@ -174,7 +179,7 @@ function attach_ynhdev()
|
||||||
function destroy_ynhdev()
|
function destroy_ynhdev()
|
||||||
{
|
{
|
||||||
check_lxd_setup
|
check_lxd_setup
|
||||||
local BOX=${1:-ynh-dev}
|
local BOX=ynh-dev-${1:-stretch}
|
||||||
sudo lxc stop $BOX
|
sudo lxc stop $BOX
|
||||||
sudo lxc delete $BOX
|
sudo lxc delete $BOX
|
||||||
}
|
}
|
||||||
|
@ -183,15 +188,26 @@ function rebuild_ynhdev()
|
||||||
{
|
{
|
||||||
check_lxd_setup
|
check_lxd_setup
|
||||||
|
|
||||||
local BOX=${1:-ynh-dev}
|
local DIST=${1:-stretch}
|
||||||
|
local BOX=ynh-dev-${DIST}
|
||||||
|
|
||||||
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/stretch/amd64 $BOX-rebuild
|
sudo lxc launch images:debian/$DIST/amd64 $BOX-rebuild
|
||||||
sudo lxc config set $BOX-rebuild security.privileged true
|
sudo lxc config set $BOX-rebuild security.privileged true
|
||||||
|
if [[ "$DIST" == "buster" ]]
|
||||||
|
then
|
||||||
|
sudo lxc config set $BOX-rebuild security.nesting true # Need this for buster because it is using apparmor
|
||||||
|
fi
|
||||||
sudo lxc restart $BOX-rebuild
|
sudo lxc restart $BOX-rebuild
|
||||||
sudo lxc exec $BOX-rebuild -- apt install curl -y
|
sudo lxc exec $BOX-rebuild -- apt install curl -y
|
||||||
sudo lxc exec $BOX-rebuild -- /bin/bash -c "curl https://install.yunohost.org | bash -s -- -a -d unstable"
|
if [[ "$DIST" == "buster" ]]
|
||||||
|
then
|
||||||
|
INSTALL_SCRIPT="https://raw.githubusercontent.com/YunoHost/install_script/buster-unstable/install_yunohost"
|
||||||
|
else
|
||||||
|
INSTALL_SCRIPT="https://install.yunohost.org"
|
||||||
|
fi
|
||||||
|
sudo lxc exec $BOX-rebuild -- /bin/bash -c "curl $INSTALL_SCRIPT | bash -s -- -a -d unstable"
|
||||||
sudo lxc stop $BOX-rebuild
|
sudo lxc stop $BOX-rebuild
|
||||||
sudo lxc publish $BOX-rebuild --alias $BOX-base
|
sudo lxc publish $BOX-rebuild --alias $BOX-base
|
||||||
set +x
|
set +x
|
||||||
|
|
Loading…
Add table
Reference in a new issue