mirror of
https://github.com/YunoHost/ynh-dev.git
synced 2024-09-03 20:05:59 +02:00
Global check prevented to run ynh-dev inside the LXC ... factorized stuff to a single check_lxc_setup function
This commit is contained in:
parent
6aa1a557af
commit
c2b8f459dd
1 changed files with 13 additions and 14 deletions
27
ynh-dev
27
ynh-dev
|
@ -30,8 +30,6 @@ function main()
|
|||
|
||||
[ -z "$ACTION" ] && show_usage && exit 0
|
||||
|
||||
check_lxc_version
|
||||
|
||||
case "${ACTION}" in
|
||||
|
||||
help|-h|--help) show_usage $ARGUMENTS ;;
|
||||
|
@ -113,22 +111,23 @@ function create_sym_link() {
|
|||
# Actions #
|
||||
##################################################################
|
||||
|
||||
function check_lxc_version()
|
||||
function check_lxc_setup()
|
||||
{
|
||||
local LXC_VERSION=$(lxc-info --version)
|
||||
|
||||
if [ "${LXC_VERSION:0:1}" != 3 ]
|
||||
then
|
||||
echo "ERROR: you need at least version 3 of LXC otherwise the box won't work"
|
||||
exit 1
|
||||
fi
|
||||
[[ "${LXC_VERSION:0:1}" == 3 ]] \
|
||||
|| critical "You need at least version 3 of LXC otherwise the box won't work"
|
||||
|
||||
[[ $(systemctl is-active lxc-net) == "active" ]] \
|
||||
|| critical "Service lxc-net should be running ... You probably need to fix your lxc network conf before being able to use lxc's."
|
||||
|
||||
ip a | grep -q lxcbr0 \
|
||||
|| critical "There is no 'lxcbr0' interface. You probably need to fix your lxc network conf before being able to use lxc's."
|
||||
}
|
||||
|
||||
function start_ynhdev()
|
||||
{
|
||||
[[ $(systemctl is-active lxc-net) == "active" ]] || critical "Service lxc-net should be running ... You probably need to fix your lxc network conf before being able to use lxc's."
|
||||
|
||||
ip a | grep lxcbr0 -q || critical "There is no 'lxcbr0' interface. You probably need to fix your lxc network conf before being able to use lxc's."
|
||||
check_lxc_setup
|
||||
|
||||
local NAME=${1:-ynh-dev}
|
||||
local BOX_NAME="yunohost/$NAME"
|
||||
|
@ -150,21 +149,21 @@ function start_ynhdev()
|
|||
|
||||
function ssh_ynhdev()
|
||||
{
|
||||
check_lxc_setup
|
||||
local NAME=${1:-ynh-dev}
|
||||
vagrant ssh $NAME -c "echo 'You are now inside the LXC !'; cd /ynh-dev; sudo su"
|
||||
}
|
||||
|
||||
function destroy_ynhdev()
|
||||
{
|
||||
check_lxc_setup
|
||||
local NAME=${1:-ynh-dev}
|
||||
vagrant destroy $NAME
|
||||
}
|
||||
|
||||
function rebuild_ynhdev()
|
||||
{
|
||||
[[ $(systemctl is-active lxc-net) == "active" ]] || critical "Service lxc-net should be running ... You probably need to fix your lxc network conf before being able to use lxc's."
|
||||
|
||||
ip a | grep lxcbr0 -q || critical "There is no 'lxcbr0' interface. You probably need to fix your lxc network conf before being able to use lxc's."
|
||||
check_lxc_setup
|
||||
|
||||
local BOX="ynh-dev"
|
||||
|
||||
|
|
Loading…
Add table
Reference in a new issue