diff --git a/scripts/_common.sh b/scripts/_common.sh index 738733c..0548822 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -7,7 +7,8 @@ nodejs_version=16 # dependencies used by the app (must be on a single line) -pkg_dependencies="golang-1.18-go postgresql" +pkg_dependencies="postgresql" +pkg_dependency_golang="golang-1.18-go" #================================================= # PERSONAL HELPERS @@ -42,17 +43,10 @@ build_fider() { # EXPERIMENTAL HELPERS #================================================= -_ynh_enable_backports() { - version=$(ynh_get_debian_release) - backports_file="/etc/apt/sources.list.d/backports_$version.list" - if [[ -f "$backports_file" ]]; then - return 0 - fi - { - echo "deb http://deb.debian.org/debian $version-backports main contrib non-free" - echo "deb-src http://deb.debian.org/debian $version-backports main contrib non-free" - } > "$backports_file" - apt update +install_golang_from_backports() { + ynh_exec_warn_less ynh_install_extra_app_dependencies \ + --repo="deb http://deb.debian.org/debian $version-backports main contrib non-free" \ + --package="$pkg_dependency_golang" } #================================================= diff --git a/scripts/install b/scripts/install index 7b65a58..afbc6a2 100755 --- a/scripts/install +++ b/scripts/install @@ -69,8 +69,8 @@ ynh_app_setting_set --app=$app --key=port --value=$port #================================================= ynh_script_progression --message="Installing dependencies..." --weight=1 -_ynh_enable_backports ynh_install_app_dependencies $pkg_dependencies +install_golang_from_backports ynh_install_nodejs --nodejs_version=$nodejs_version #================================================= diff --git a/scripts/restore b/scripts/restore index 1f1aaf2..86fe83e 100755 --- a/scripts/restore +++ b/scripts/restore @@ -82,8 +82,8 @@ chmod +x "$final_path/run_fider" ynh_script_progression --message="Reinstalling dependencies..." --weight=1 # Define and install dependencies -_ynh_enable_backports ynh_install_app_dependencies $pkg_dependencies +install_golang_from_backports #================================================= # RESTORE THE NGINX CONFIGURATION diff --git a/scripts/upgrade b/scripts/upgrade index d6caf5d..38944be 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -102,6 +102,7 @@ chown -R $app:www-data "$final_path" ynh_script_progression --message="Upgrading dependencies..." --weight=1 ynh_install_app_dependencies $pkg_dependencies +install_golang_from_backports #================================================= # NGINX CONFIGURATION