diff --git a/scripts/_common.sh b/scripts/_common.sh index 775fe6f..4f333ae 100644 --- a/scripts/_common.sh +++ b/scripts/_common.sh @@ -207,6 +207,36 @@ ynh_set_default_perm () { } +ynh_read_manifest () { + python3 -c "import sys, json;print(json.load(open('../manifest.json'))['$1'])" +} + + +ynh_app_dependencies (){ + export dependencies=$1 + export project_url=$(ynh_read_manifest 'url') + export version=$(ynh_read_manifest 'version') + mkdir -p conf + cat > ../conf/app-ynh-deps.control.j2 << EOF +Section: misc +Priority: optional +Homepage: {{ project_urlĀ }} +Standards-Version: 3.9.2 + +Package: {{ app }}-ynh-deps +Version: {{ version }} +Depends: {{ dependencies }} +Architecture: all +Description: meta package for {{ app }} (YunoHost app) dependencies + This meta-package is only responsible of installing its dependencies. +EOF + + ynh_configure app-ynh-deps.control ./$app-ynh-deps.control + ynh_package_install_from_equivs ./$app-ynh-deps.control \ + || ynh_die "Unable to install dependencies" +} + + # Create a system user # # usage: ynh_system_user_create user_name [home_dir] diff --git a/scripts/install b/scripts/install index df1b1c6..4a120bb 100755 --- a/scripts/install +++ b/scripts/install @@ -28,7 +28,7 @@ ynh_local_path_available "$data_path" ynh_save_args domain path admin is_public language local_path -ynh_package_install php5-imap +ynh_app_dependencies php5-imap ynh_mysql_generate_db "$user" "$app" diff --git a/scripts/remove b/scripts/remove index 8fffbbb..a2fdb27 100755 --- a/scripts/remove +++ b/scripts/remove @@ -20,5 +20,7 @@ ynh_rm_php_fpm_conf # We can't delete it before because php5-fpm use it ynh_system_user_delete "$user" +ynh_package_remove $app-ynh-deps + sudo yunohost app ssowatconf echo -e "\e[0m" # Restore norml color