mirror of
https://github.com/YunoHost-Apps/garage_ynh.git
synced 2024-09-03 18:36:32 +02:00
use systemd-detect-virt
This commit is contained in:
parent
3103ccefab
commit
2d606f0a2f
4 changed files with 14 additions and 21 deletions
|
@ -9,6 +9,20 @@ pkg_dependencies_virtualisation="qemu-utils e2fsprogs"
|
||||||
# PERSONAL HELPERS
|
# 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"
|
GARAGE_VERSION="0.8.2"
|
||||||
|
|
||||||
|
|
|
@ -16,7 +16,6 @@ ynh_abort_if_errors
|
||||||
|
|
||||||
final_path=$(ynh_app_setting_get $app final_path)
|
final_path=$(ynh_app_setting_get $app final_path)
|
||||||
node_id=$(ynh_app_setting_get $app node_id)
|
node_id=$(ynh_app_setting_get $app node_id)
|
||||||
virtualisation=$(ynh_app_setting_get $app virtualisation)
|
|
||||||
datadir=$(ynh_app_setting_get $app datadir)
|
datadir=$(ynh_app_setting_get $app datadir)
|
||||||
if [ "$virtualisation" = "true" ]
|
if [ "$virtualisation" = "true" ]
|
||||||
then
|
then
|
||||||
|
|
|
@ -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"
|
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
|
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
|
# STORE SETTINGS FROM MANIFEST
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
|
@ -9,7 +9,6 @@
|
||||||
source _common.sh
|
source _common.sh
|
||||||
source /usr/share/yunohost/helpers
|
source /usr/share/yunohost/helpers
|
||||||
|
|
||||||
|
|
||||||
if [ "$virtualisation" = "true" ] ;
|
if [ "$virtualisation" = "true" ] ;
|
||||||
then
|
then
|
||||||
virt_protection=""
|
virt_protection=""
|
||||||
|
|
Loading…
Add table
Reference in a new issue