mirror of
https://github.com/YunoHost/ynh-dev.git
synced 2024-09-03 20:05:59 +02:00
Add optional name to interact with custom boxes
This commit is contained in:
parent
99cba1e489
commit
acbf79377d
1 changed files with 15 additions and 12 deletions
27
ynh-dev
27
ynh-dev
|
@ -8,9 +8,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 (Create and) starts the ynh-dev LXC
|
start [NAME] (Create and) starts a LXC (ynh-dev by default)
|
||||||
ssh SSH into an already started ynh-dev LXC
|
ssh [NAME] SSH into an already started LXC (ynh-dev by default)
|
||||||
destroy Destroy the ynh-dev LXC
|
destroy [NAME] Destroy the ynh-dev LXC (ynh-dev 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}
|
||||||
|
@ -113,31 +113,34 @@ function create_sym_link() {
|
||||||
|
|
||||||
function start_ynhdev()
|
function start_ynhdev()
|
||||||
{
|
{
|
||||||
local BOX_NAME="yunohost/ynh-dev"
|
local NAME=${1:-ynh-dev}
|
||||||
|
local BOX_NAME="yunohost/$NAME"
|
||||||
local BOX_URL="https://build.yunohost.org/yunohost-$BOX_NAME-lxc.box"
|
local BOX_URL="https://build.yunohost.org/yunohost-$BOX_NAME-lxc.box"
|
||||||
|
|
||||||
set -eu
|
set -eu
|
||||||
# Download box if not available
|
# Download box if not available
|
||||||
if ! vagrant box list | grep -qc $BOX_NAME ; then
|
#if ! vagrant box list | grep -qc $BOX_NAME ; then
|
||||||
info "Vagrant box '$BOX_NAME' is missing. Trying to download it"
|
# info "Vagrant box '$BOX_NAME' is missing. Trying to download it"
|
||||||
vagrant box add $BOX_NAME $BOX_URL
|
# vagrant box add $BOX_NAME $BOX_URL
|
||||||
fi
|
#fi
|
||||||
|
|
||||||
# Run VM
|
# Run VM
|
||||||
vagrant up ynh-dev
|
vagrant up $NAME
|
||||||
|
|
||||||
# Log into the VM
|
# Log into the VM
|
||||||
ssh_ynhdev
|
ssh_ynhdev $NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
function ssh_ynhdev()
|
function ssh_ynhdev()
|
||||||
{
|
{
|
||||||
vagrant ssh ynh-dev -c "echo 'You are now inside the LXC !'; cd /ynh-dev; sudo su"
|
local NAME=${1:-ynh-dev}
|
||||||
|
vagrant ssh $NAME -c "echo 'You are now inside the LXC !'; cd /ynh-dev; sudo su"
|
||||||
}
|
}
|
||||||
|
|
||||||
function destroy_ynhdev()
|
function destroy_ynhdev()
|
||||||
{
|
{
|
||||||
vagrant destroy ynh-dev
|
local NAME=${1:-ynh-dev}
|
||||||
|
vagrant destroy $NAME
|
||||||
}
|
}
|
||||||
|
|
||||||
function rebuild_ynhdev()
|
function rebuild_ynhdev()
|
||||||
|
|
Loading…
Add table
Reference in a new issue