diff --git a/scripts/_common.sh b/scripts/_common.sh index 494a560..ec9aa5c 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -9,6 +9,20 @@ pkg_dependencies_virtualisation="qemu-utils e2fsprogs" # PERSONAL HELPERS #================================================= +systemd-detect-virt -c -q +if [ $? ] +then #system is inside a container, + export VIRTUALISATION=true + virtualisation=true + # comment systemd isolation to allow mount disk + virt_protection="#" +else + virtualisation=false + export VIRTUALISATION=false + # uncomment systemd isolation + virt_protection="" +fi + GARAGE_VERSION="0.8.2" diff --git a/scripts/config b/scripts/config index dd482d3..a39681c 100644 --- a/scripts/config +++ b/scripts/config @@ -16,7 +16,6 @@ ynh_abort_if_errors final_path=$(ynh_app_setting_get $app final_path) node_id=$(ynh_app_setting_get $app node_id) -virtualisation=$(ynh_app_setting_get $app virtualisation) datadir=$(ynh_app_setting_get $app datadir) if [ "$virtualisation" = "true" ] then diff --git a/scripts/install b/scripts/install index 2151322..99247b2 100755 --- a/scripts/install +++ b/scripts/install @@ -24,25 +24,6 @@ then echo "$bootstrap_peers" | grep -E '[0-9a-f]{64}@((\b25[0-5]|\b2[0-4][0-9]|\b[01]?[0-9][0-9]?)(\.(25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)){3}|([a-zA-Z0-9][a-zA-Z0-9-]{0,61}[a-zA-Z0-9]\.)+[a-zA-Z]{2,}):[0-9]{1,4}' || ynh_die --message="friend server id must have id with the following form : 1799bccfd7411eddcf9ebd316bc1f5287ad12a68094e1c6ac6abde7e6feae1ec@192.168.1.1:1234 or 1799bccfd7411eddcf9ebd316bc1f5287ad12a68094e1c6ac6abde7e6feae1ec@example.tld:1234" fi -#================================================= -# LOOKING FOR VIRTUALISATION -#================================================= -ynh_script_progression --message="Checking virtualisation availability…" --weight=1 - -if [ "$(which modprobe)" = "" ] -then - virtualisation=false - export VIRTUALISATION=false - # uncomment systemd isolation - virt_protection="" -else - export VIRTUALISATION=true - virtualisation=true - # comment systemd isolation to allow mount disk - virt_protection="#" -fi -ynh_app_setting_set --app=$app --key=virtualisation --value=$virtualisation - #================================================= # STORE SETTINGS FROM MANIFEST #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 663ee9c..bd32ef9 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -9,7 +9,6 @@ source _common.sh source /usr/share/yunohost/helpers - if [ "$virtualisation" = "true" ] ; then virt_protection=""