mirror of
https://github.com/YunoHost/ynh-dev.git
synced 2024-09-03 20:05:59 +02:00
add buster support
This commit is contained in:
parent
3bdb65cd87
commit
46c8e95604
1 changed files with 28 additions and 22 deletions
50
ynh-dev
50
ynh-dev
|
@ -6,10 +6,10 @@ 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 [NAME] [DEBIAN_VERSION] (Create and) starts a LXC (ynh-dev by default)
|
||||||
attach [NAME] Attach an already started LXC (ynh-dev by default)
|
attach [NAME] [DEBIAN_VERSION] Attach an already started LXC (ynh-dev by default)
|
||||||
destroy [NAME] Destroy the ynh-dev LXC (ynh-dev by default)
|
destroy [NAME] [DEBIAN_VERSION] Destroy the ynh-dev LXC (ynh-dev by default)
|
||||||
rebuild Rebuild a fresh, up-to-date box
|
rebuild [NAME] [DEBIAN_VERSION] Rebuild a fresh, up-to-date box
|
||||||
|
|
||||||
${BLUE}Inside the dev instance${NORMAL}
|
${BLUE}Inside the dev instance${NORMAL}
|
||||||
${BLUE}=======================${NORMAL}
|
${BLUE}=======================${NORMAL}
|
||||||
|
@ -133,22 +133,23 @@ function start_ynhdev()
|
||||||
check_lxd_setup
|
check_lxd_setup
|
||||||
|
|
||||||
local BOX=${1:-ynh-dev}
|
local BOX=${1:-ynh-dev}
|
||||||
|
local DEBIAN_VERSION=${2:-stretch}
|
||||||
|
|
||||||
if ! sudo lxc info $BOX &>/dev/null
|
if ! sudo lxc info $BOX-$DEBIAN_VERSION &>/dev/null
|
||||||
then
|
then
|
||||||
sudo lxc image info $BOX-base &>/dev/null || critical "You should first build the base YunoHost LXC using ./ynh-dev rebuild"
|
sudo lxc image info $BOX-$DEBIAN_VERSION-base &>/dev/null || critical "You should first build the base YunoHost LXC using ./ynh-dev rebuild"
|
||||||
set -eu
|
set -eu
|
||||||
set -x
|
set -x
|
||||||
sudo lxc launch $BOX-base $BOX
|
sudo lxc launch $BOX-$DEBIAN_VERSION-base $BOX-$DEBIAN_VERSION
|
||||||
sudo lxc config set $BOX security.privileged true
|
sudo lxc config set $BOX-$DEBIAN_VERSION security.privileged true
|
||||||
sudo lxc config device add $BOX ynhdev-shared-folder disk path=/ynh-dev source="$PWD"
|
sudo lxc config device add $BOX-$DEBIAN_VERSION 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"
|
||||||
else
|
else
|
||||||
info "Attaching to existing container"
|
info "Attaching to existing container"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
attach_ynhdev $BOX
|
attach_ynhdev $BOX $DEBIAN_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
function attach_ynhdev()
|
function attach_ynhdev()
|
||||||
|
@ -167,16 +168,20 @@ function attach_ynhdev()
|
||||||
|
|
||||||
check_lxd_setup
|
check_lxd_setup
|
||||||
local BOX=${1:-ynh-dev}
|
local BOX=${1:-ynh-dev}
|
||||||
sudo lxc start $BOX 2>/dev/null || true
|
local DEBIAN_VERSION=${2:-stretch}
|
||||||
sudo lxc exec $BOX --cwd /ynh-dev -- /bin/bash
|
|
||||||
|
sudo lxc start $BOX-$DEBIAN_VERSION 2>/dev/null || true
|
||||||
|
sudo lxc exec $BOX-$DEBIAN_VERSION --cwd /ynh-dev -- /bin/bash
|
||||||
}
|
}
|
||||||
|
|
||||||
function destroy_ynhdev()
|
function destroy_ynhdev()
|
||||||
{
|
{
|
||||||
check_lxd_setup
|
check_lxd_setup
|
||||||
local BOX=${1:-ynh-dev}
|
local BOX=${1:-ynh-dev}
|
||||||
sudo lxc stop $BOX
|
local DEBIAN_VERSION=${2:-stretch}
|
||||||
sudo lxc delete $BOX
|
|
||||||
|
sudo lxc stop $BOX-$DEBIAN_VERSION
|
||||||
|
sudo lxc delete $BOX-$DEBIAN_VERSION
|
||||||
}
|
}
|
||||||
|
|
||||||
function rebuild_ynhdev()
|
function rebuild_ynhdev()
|
||||||
|
@ -184,16 +189,17 @@ function rebuild_ynhdev()
|
||||||
check_lxd_setup
|
check_lxd_setup
|
||||||
|
|
||||||
local BOX=${1:-ynh-dev}
|
local BOX=${1:-ynh-dev}
|
||||||
|
local DEBIAN_VERSION=${2:-stretch}
|
||||||
|
|
||||||
set -x
|
set -x
|
||||||
sudo lxc info $BOX-rebuild >/dev/null && sudo lxc delete $BOX-rebuild --force
|
sudo lxc info $BOX-$DEBIAN_VERSION-rebuild >/dev/null && sudo lxc delete $BOX-$DEBIAN_VERSION-rebuild --force
|
||||||
sudo lxc launch images:debian/stretch/amd64 $BOX-rebuild
|
sudo lxc launch images:debian/$DEBIAN_VERSION/amd64 $BOX-$DEBIAN_VERSION-rebuild
|
||||||
sudo lxc config set $BOX-rebuild security.privileged true
|
sudo lxc config set $BOX-$DEBIAN_VERSION-rebuild security.privileged true
|
||||||
sudo lxc restart $BOX-rebuild
|
sudo lxc restart $BOX-$DEBIAN_VERSION-rebuild
|
||||||
sudo lxc exec $BOX-rebuild -- apt install curl -y
|
sudo lxc exec $BOX-$DEBIAN_VERSION-rebuild -- apt install curl -y
|
||||||
sudo lxc exec $BOX-rebuild -- /bin/bash -c "curl https://install.yunohost.org | bash -s -- -a -d unstable"
|
sudo lxc exec $BOX-$DEBIAN_VERSION-rebuild -- /bin/bash -c "curl https://install.yunohost.org | bash -s -- -a -d unstable"
|
||||||
sudo lxc stop $BOX-rebuild
|
sudo lxc stop $BOX-$DEBIAN_VERSION-rebuild
|
||||||
sudo lxc publish $BOX-rebuild --alias $BOX-base
|
sudo lxc publish $BOX-$DEBIAN_VERSION-rebuild --alias $BOX-$DEBIAN_VERSION-base
|
||||||
set +x
|
set +x
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Add table
Reference in a new issue