mirror of
https://github.com/YunoHost/ynh-dev.git
synced 2024-09-03 20:05:59 +02:00
Smarter ./ynh-dev start that will attach to the container if it already exists
This commit is contained in:
parent
b27bc5deea
commit
20dafd3827
1 changed files with 13 additions and 8 deletions
21
ynh-dev
21
ynh-dev
|
@ -134,14 +134,19 @@ function start_ynhdev()
|
||||||
|
|
||||||
local BOX=${1:-ynh-dev}
|
local BOX=${1:-ynh-dev}
|
||||||
|
|
||||||
sudo lxc info $BOX &>/dev/null && critical "The container already exist. Use 'attach' to enter the LXC, or 'destroy' if you aim to recreate it."
|
if ! sudo lxc info $BOX &>/dev/null
|
||||||
sudo lxc image info $BOX-base &>/dev/null || critical "You should first build the base YunoHost LXC using ./ynh-dev rebuild"
|
then
|
||||||
set -eu
|
sudo lxc image info $BOX-base &>/dev/null || critical "You should first build the base YunoHost LXC using ./ynh-dev rebuild"
|
||||||
set -x
|
set -eu
|
||||||
sudo lxc launch $BOX-base $BOX
|
set -x
|
||||||
sudo lxc config set $BOX security.privileged true
|
sudo lxc launch $BOX-base $BOX
|
||||||
sudo lxc config device add $BOX ynhdev-shared-folder disk path=/ynh-dev source="$PWD"
|
sudo lxc config set $BOX security.privileged true
|
||||||
set +x
|
sudo lxc config device add $BOX ynhdev-shared-folder disk path=/ynh-dev source="$PWD"
|
||||||
|
set +x
|
||||||
|
info "Now attaching to the container"
|
||||||
|
else
|
||||||
|
info "Attaching to existing container"
|
||||||
|
fi
|
||||||
|
|
||||||
attach_ynhdev $BOX
|
attach_ynhdev $BOX
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue