add names again

This commit is contained in:
Kay0u 2020-03-28 23:11:07 +01:00
parent 572b65a946
commit d73a9d74ed
No known key found for this signature in database
GPG key ID: AE1DCADB6415A156

19
ynh-dev
View file

@ -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 [DIST] (Create and) starts a LXC (stretch by default) start [DIST] [NAME] (Create and) starts a LXC (DIST=stretch and NAME=ynh-dev by default)
attach [DIST] Attach an already started LXC (stretch by default) attach [DIST] [NAME] Attach an already started LXC (DIST=stretch and NAME=ynh-dev by default)
destroy [DIST] Destroy the ynh-dev LXC (stretch by default) destroy [DIST] [NAME] Destroy the ynh-dev LXC (DIST=stretch and NAME=ynh-dev by default)
rebuild Rebuild a fresh, up-to-date box rebuild [DIST] [NAME] Rebuild a fresh, up-to-date box (DIST=stretch and NAME=ynh-dev by default)
${BLUE}Inside the dev instance${NORMAL} ${BLUE}Inside the dev instance${NORMAL}
${BLUE}=======================${NORMAL} ${BLUE}=======================${NORMAL}
@ -133,7 +133,7 @@ function start_ynhdev()
check_lxd_setup check_lxd_setup
local DIST=${1:-stretch} local DIST=${1:-stretch}
local BOX=ynh-dev-$DIST local BOX=${2:-ynh-dev}-${DIST}
if ! sudo lxc info $BOX &>/dev/null if ! sudo lxc info $BOX &>/dev/null
then then
@ -153,7 +153,7 @@ function start_ynhdev()
info "Attaching to existing container" info "Attaching to existing container"
fi fi
attach_ynhdev $DIST attach_ynhdev $BOX
} }
function attach_ynhdev() function attach_ynhdev()
@ -171,7 +171,7 @@ function attach_ynhdev()
fi fi
check_lxd_setup check_lxd_setup
local BOX=ynh-dev-${1:-stretch} local BOX=${1:-ynh-dev-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
} }
@ -179,7 +179,8 @@ function attach_ynhdev()
function destroy_ynhdev() function destroy_ynhdev()
{ {
check_lxd_setup check_lxd_setup
local BOX=ynh-dev-${1:-stretch} local DIST=${1:-stretch}
local BOX=${2:-ynh-dev}-${DIST}
sudo lxc stop $BOX sudo lxc stop $BOX
sudo lxc delete $BOX sudo lxc delete $BOX
} }
@ -189,7 +190,7 @@ function rebuild_ynhdev()
check_lxd_setup check_lxd_setup
local DIST=${1:-stretch} local DIST=${1:-stretch}
local BOX=ynh-dev-${DIST} local BOX=${2:-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