From b6bf749927dc06f2e558eb0a145e0c9da64b501a Mon Sep 17 00:00:00 2001 From: ewilly Date: Mon, 21 Feb 2022 21:33:31 +0100 Subject: [PATCH] Fix missing libffi.so.7 --- scripts/_common.sh | 22 +++++++++++++++++++++- scripts/install | 4 ++++ scripts/upgrade | 3 +++ 3 files changed, 28 insertions(+), 1 deletion(-) diff --git a/scripts/_common.sh b/scripts/_common.sh index 681b58f..6d6262a 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -41,6 +41,26 @@ myynh_create_dir () { [ -d "$1" ] || mkdir -p "$1" } +myynh_compile_libffi () { + ynh_print_info --message="Building libffi..." + + # Create a temp direcotry + tmpdir="$(mktemp --directory)" + cd "$tmpdir" + + # Download + wget "https://github.com/libffi/libffi/releases/download/v3.3/libffi-3.3.tar.gz" + + # Extract + tar zxf libffi-3.3.tar.gz + + # Install + cd libffi-3.3 + ./configure + make install + ldconfig +} + # Install specific python version # usage: myynh_install_python --python="3.8.6" # | arg: -p, --python= - the python version to install @@ -123,7 +143,7 @@ myynh_install_python () { # Save python version in settings ynh_app_setting_set --app=$app --key=python --value="$python" } - + # Install/Upgrade Homeassistant in virtual environement myynh_install_homeassistant () { ynh_exec_as $app -H -s /bin/bash -c " \ diff --git a/scripts/install b/scripts/install index bcaf8c3..4f2a7bb 100644 --- a/scripts/install +++ b/scripts/install @@ -70,6 +70,10 @@ ynh_app_setting_set --app=$app --key=port --value="$port" ynh_script_progression --message="Installing dependencies..." ynh_install_app_dependencies $pkg_dependencies + +# Install libffi-3.3 if libffi.so.7 is missing (buster) +[[ $(ldconfig -p | grep libffi.so.7) ]] || myynh_compile_libffi + myynh_install_python --python="$py_required_version" #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 8e51c99..4c261fa 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -153,6 +153,9 @@ ynh_script_progression --message="Upgrading dependencies..." ynh_install_app_dependencies $pkg_dependencies +# Install libffi-3.3 if libffi.so.7 is missing (buster) +[[ $(ldconfig -p | grep libffi.so.7) ]] || myynh_compile_libffi + #================================================= # UPDATE A CONFIG FILE #=================================================