1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/peertube_ynh.git synced 2024-09-03 19:56:29 +02:00

Apply last example_ynh

This commit is contained in:
yalh76 2022-06-10 01:21:56 +02:00
parent cc362656f4
commit 5852904202
10 changed files with 259 additions and 167 deletions

View file

@ -1,7 +0,0 @@
language: python
before_install:
- git clone https://github.com/YunoHost/package_linter /tmp/package_linter
script:
- /tmp/package_linter/package_linter.py ./

View file

@ -1,9 +1,8 @@
;; Test complet
; Manifest
domain="domain.tld"
email="admin@example.com"
is_public=1
port="9000"
admin="john"
; Checks
pkg_linter=1
setup_sub_dir=0
@ -26,6 +25,8 @@
upgrade=1 from_commit=7c2bb0bb6a91b6b957b734f684aa3d64da892f4c
# 4.0.0~ynh2
upgrade=1 from_commit=6995b27972e27c6cf8ee3e1f23a2de5cc8c8e8ee
# 4.1.1~ynh1
upgrade=1 from_commit=24c8333d70312e9dcf8d278e64787ca561a10b2e
backup_restore=1
multi_instance=0
port_already_use=0

View file

@ -45,7 +45,7 @@ database:
# Redis server for short time storage
# You can also specify a 'socket' path to a unix socket but first need to
# comment out hostname and port
# set 'hostname' and 'port' to null
redis:
hostname: 'localhost'
port: 6379
@ -73,12 +73,31 @@ email:
subject:
prefix: '[PeerTube]'
# PeerTube client/interface configuration
client:
videos:
miniature:
# By default PeerTube client displays author username
prefer_author_display_name: false
# Update default PeerTube values
# Set by API when the field is not provided and put as default value in client
defaults:
# Change default values when publishing a video (upload/import/go Live)
publish:
download_enabled: true
comments_enabled: true
# public = 1, unlisted = 2, private = 3, internal = 4
privacy: 1
# CC-BY = 1, CC-SA = 2, CC-ND = 3, CC-NC = 4, CC-NC-SA = 5, CC-NC-ND = 6, Public Domain = 7
# You can also choose a custom licence value added by a plugin
# No licence by default
licence: null
p2p:
# Enable P2P by default
# Can be enabled/disabled by anonymous users and logged in users
webapp:
enabled: true
embed:
enabled: true
# From the project root directory
storage:
@ -115,6 +134,9 @@ object_storage:
region: 'us-east-1'
# Set this ACL on each uploaded object
upload_acl: 'public'
credentials:
# You can also use AWS_ACCESS_KEY_ID env variable
access_key_id: ''
@ -155,7 +177,6 @@ trending:
interval_days: 7 # Compute trending videos for the last x days
algorithms:
enabled:
- 'best' # adaptation of Reddit's 'Best' algorithm (Hot minus History)
- 'hot' # adaptation of Reddit's 'Hot' algorithm
- 'most-viewed' # default, used initially by PeerTube as the trending page
- 'most-liked'
@ -235,6 +256,13 @@ views:
ip_view_expiration: '1 hour'
# Used to get country location of views of local videos
geo_ip:
enabled: true
country:
database_url: 'https://dbip.mirror.framasoft.org/files/dbip-country-lite-latest.mmdb'
plugins:
# The website PeerTube will ask for available PeerTube plugins and themes
# This is an unmoderated plugin index, so only install plugins/themes you trust
@ -287,7 +315,7 @@ cache:
admin:
# Used to generate the root user at first startup
# And to receive emails from the contact form
email: '__ADMIN_EMAIL__'
email: '__ADMIN_MAIL__'
contact_form:
enabled: true
@ -381,19 +409,43 @@ live:
# /!\ transcoding.enabled (and not live.transcoding.enabled) has to be true to create a replay
allow_replay: true
# Allow your users to change latency settings (small latency/default/high latency)
# Small latency live streams cannot use P2P
# High latency live streams can increase P2P ratio
latency_setting:
enabled: true
# Your firewall should accept traffic from this port in TCP if you enable live
rtmp:
enabled: true
# Listening hostname/port for RTMP server
# '::' to listen on IPv6 and IPv4, '0.0.0.0' to listen on IPv4
# Use null to automatically listen on '::' if IPv6 is available, or '0.0.0.0' otherwise
hostname: null
port: 1935
# Public hostname of your RTMP server
# Use null to use the same value than `webserver.hostname`
public_hostname: null
rtmps:
enabled: false
# Listening hostname/port for RTMPS server
# '::' to listen on IPv6 and IPv4, '0.0.0.0' to listen on IPv4
# Use null to automatically listen on '::' if IPv6 is available, or '0.0.0.0' otherwise
hostname: null
port: 1936
# Absolute path
# Absolute paths
key_file: ''
# Absolute path
cert_file: ''
# Public hostname of your RTMPS server
# Use null to use the same value than `webserver.hostname`
public_hostname: null
# Allow to transcode the live streaming in multiple live resolutions
transcoding:
enabled: true
@ -414,13 +466,21 @@ live:
1440p: false
2160p: false
video_studio:
# Enable video edition by users (cut, add intro/outro, add watermark etc)
# If enabled, users can create transcoding tasks as they wish
enabled: false
import:
# Add ability for your users to import remote videos (from YouTube, torrent...)
videos:
# Amount of import jobs to execute in parallel
concurrency: 1
http: # Classic HTTP or all sites supported by youtube-dl https://rg3.github.io/youtube-dl/supportedsites.html
# Classic HTTP or all sites supported by youtube-dl https://rg3.github.io/youtube-dl/supportedsites.html
http:
# We recommend to use a HTTP proxy if you enable HTTP import to prevent private URL access from this server
# See https://docs.joinpeertube.org/maintain-configuration?id=security for more information
enabled: false
youtube_dl_release:
@ -429,18 +489,22 @@ import:
# Examples:
# * https://api.github.com/repos/ytdl-org/youtube-dl/releases
# * https://api.github.com/repos/yt-dlp/yt-dlp/releases
url: 'https://api.github.com/repos/yt-dlp/yt-dlp/releases'
url: 'https://yt-dl.org/downloads/latest/youtube-dl'
# youtube-dl binary name
# yt-dlp is also supported
name: 'yt-dlp'
name: 'youtube-dl'
# Path to the python binary to execute for youtube-dl or yt-dlp
python_path: '/usr/bin/python3'
# IPv6 is very strongly rate-limited on most sites supported by youtube-dl
force_ipv4: false
torrent: # Magnet URI or torrent file (use classic TCP/UDP/WebSeed to download the file)
# Magnet URI or torrent file (use classic TCP/UDP/WebSeed to download the file)
torrent:
# We recommend to only enable magnet URI/torrent import if you trust your users
# See https://docs.joinpeertube.org/maintain-configuration?id=security for more information
enabled: false
auto_blacklist:
@ -593,3 +657,21 @@ search:
disable_local_search: false
# If you did not disable local search, you can decide to use the search index by default
is_default_search: false
# PeerTube client/interface configuration
client:
videos:
miniature:
# By default PeerTube client displays author username
prefer_author_display_name: false
display_author_avatar: false
resumable_upload:
# Max size of upload chunks, e.g. '90MB'
# If null, it will be calculated based on network speed
max_chunk_size: null
menu:
login:
# If you enable only one external auth plugin
# You can automatically redirect your users on this external platform when they click on the login button
redirect_on_single_external_auth: false

View file

@ -38,14 +38,14 @@
"name": "domain",
"type": "domain"
},
{
"name": "admin",
"type": "user"
},
{
"name": "is_public",
"type": "boolean",
"default": true
},
{
"name": "admin",
"type": "user"
}
]
}

View file

@ -6,8 +6,9 @@
# dependencies used by the app
pkg_dependencies="ffmpeg postgresql postgresql-contrib openssl g++ mailutils apt-transport-https"
ynh_app_dependencies="prosody"
NODEJS_VERSION=16
nodejs_version=16
#=================================================
# PERSONAL HELPERS

View file

@ -9,6 +9,7 @@
source _common.sh
source ynh_redis
source ynh_send_readme_to_admin__2
source ynh_apps
source /usr/share/yunohost/helpers
#=================================================
@ -27,9 +28,9 @@ ynh_abort_if_errors
domain=$YNH_APP_ARG_DOMAIN
path_url="/"
admin=$YNH_APP_ARG_ADMIN
is_public=$YNH_APP_ARG_IS_PUBLIC
admin_email=$(ynh_user_get_info --username=$admin --key="mail")
admin=$YNH_APP_ARG_ADMIN
admin_mail=$(ynh_user_get_info --username=$admin --key="mail")
admin_pass=$(ynh_string_random --length=24)
app=$YNH_APP_INSTANCE_NAME
@ -64,7 +65,7 @@ ynh_app_setting_set --app=$app --key=admin --value=$admin
ynh_script_progression --message="Finding an available port..."
# Find an available port
port=$(ynh_find_port --port=9000)
port=$(ynh_find_port --port=8095)
ynh_app_setting_set --app=$app --key=port --value=$port
# PeerTube Live port
@ -81,33 +82,18 @@ ynh_exec_warn_less yunohost firewall allow TCP $rtmp_port
#=================================================
ynh_script_progression --message="Installing dependencies..."
# Install nodejs
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
# Install dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# Install Yarn
ynh_install_apps --apps="$ynh_app_dependencies"
ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
if ! yunohost app list | grep -q "prosody"
then
yunohost tools update
yunohost app install prosody
else
yunohost tools update
yunohost app upgrade prosody
fi
ynh_app_setting_set --app=$app --key=require_prosody --value="1"
#=================================================
# CREATE DEDICATED USER
#=================================================
ynh_script_progression --message="Configuring system user..."
# Create a system user
ynh_system_user_create --username=$app --home_dir=$final_path
ynh_system_user_create --username=$app --home_dir="$final_path"
#=================================================
# CREATE A POSTGRESQL DATABASE
@ -116,12 +102,11 @@ ynh_script_progression --message="Creating a PostgreSQL database..."
db_name="peertube_${app}"
db_user=$(ynh_sanitize_dbid --db_name=$app)
db_pwd=$(ynh_string_random --length=30)
ynh_app_setting_set --app=$app --key=db_name --value=$db_name
ynh_app_setting_set --app=$app --key=db_user --value=$db_user
ynh_app_setting_set --app=$app --key=db_pwd --value=$db_pwd
ynh_psql_test_if_first_run
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS unaccent;" --database=$db_name
ynh_psql_execute_as_root --sql="CREATE EXTENSION IF NOT EXISTS pg_trgm;" --database=$db_name
@ -300,7 +285,7 @@ ynh_systemd_action --service_name=nginx --action=reload
#=================================================
ynh_script_progression --message="Sending a readme for the admin..."
ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$admin_email --type='install'
ynh_send_readme_to_admin --app_message="../conf/msg_install" --recipients=$admin_mail --type='install'
#=================================================
# END OF SCRIPT

View file

@ -9,6 +9,7 @@
source _common.sh
source ynh_redis
source ynh_send_readme_to_admin__2
source ynh_apps
source /usr/share/yunohost/helpers
#=================================================
@ -25,7 +26,7 @@ db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
admin_email=$(ynh_user_get_info --username=$admin --key="mail")
admin_mail=$(ynh_user_get_info --username=$admin --key="mail")
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
path_url=$(ynh_app_setting_get --app=$app --key=path)
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
@ -109,42 +110,12 @@ ynh_script_progression --message="Removing dependencies..."
# Remove metapackage and its dependencies
ynh_remove_nodejs
ynh_remove_app_dependencies
# Remove Prosody
ynh_app_setting_delete --app=$app --key=require_prosody
# List apps requiring Prosody
installed_apps=$(yunohost app list | grep -oP 'id: \K.*$')
required_by=""
installed_app_required_by=""
for installed_app in $installed_apps
do
installed_app_required_by=$(ynh_app_setting_get --app=$installed_app --key="require_prosody")
if [[ $installed_app_required_by ]]
then
required_by="${installed_app_required_by}"
fi
installed_app_required_by=""
done
# If Prosody is no more required
if [[ ! $required_by ]]
then
# Remove Prosody
ynh_print_info --message="Removing of Prosody"
yunohost app remove prosody --purge
fi
ynh_remove_apps
#=================================================
# CLOSE A PORT
#=================================================
if yunohost firewall list | grep -q "\- $port$"
then
ynh_script_progression --message="Closing port $port..."
ynh_exec_warn_less yunohost firewall disallow TCP $port
fi
if yunohost firewall list | grep -q "\- $rtmp_port$"
then
ynh_script_progression --message="Closing port $rtmp_port..."
@ -176,7 +147,7 @@ ynh_system_user_delete --username=$app
#=================================================
ynh_script_progression --message="Sending a readme for the admin..."
ynh_send_readme_to_admin --app_message="../conf/msg_remove" --recipients=$admin_email --type='remove'
ynh_send_readme_to_admin --app_message="../conf/msg_remove" --recipients=$admin_mail --type='remove'
#=================================================
# END OF SCRIPT

View file

@ -8,6 +8,7 @@
# Keep this path for calling _common.sh inside the execution's context of backup and restore scripts
source ../settings/scripts/_common.sh
source ../settings/scripts/ynh_apps
source /usr/share/yunohost/helpers
#=================================================
@ -34,7 +35,6 @@ port=$(ynh_app_setting_get --app=$app --key=port)
rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
#=================================================
@ -47,13 +47,6 @@ test ! -d $final_path \
#=================================================
# STANDARD RESTORATION STEPS
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RECREATE THE DEDICATED USER
#=================================================
@ -93,22 +86,17 @@ chown -R $app:www-data "$datadir"
#=================================================
ynh_script_progression --message="Reinstalling dependencies..."
# Install nodejs
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
ynh_install_apps --apps="$ynh_app_dependencies"
ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
# Install dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
#=================================================
# RESTORE THE NGINX CONFIGURATION
#=================================================
ynh_script_progression --message="Restoring the NGINX web server configuration..."
if ! yunohost app list | grep -q "prosody"
then
yunohost tools update
yunohost app install prosody
else
yunohost tools update
yunohost app upgrade prosody
fi
ynh_app_setting_set --app=$app --key=require_prosody --value="1"
ynh_restore_file --origin_path="/etc/nginx/conf.d/$domain.d/$app.conf"
#=================================================
# RESTORE THE POSTGRESQL DATABASE
@ -116,6 +104,7 @@ ynh_app_setting_set --app=$app --key=require_prosody --value="1"
ynh_script_progression --message="Restoring the PostgreSQL database..."
ynh_psql_test_if_first_run
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
ynh_psql_setup_db --db_user=$db_user --db_name=$db_name --db_pwd=$db_pwd
ynh_psql_execute_file_as_root --file="./db.sql" --database=$db_name

View file

@ -8,6 +8,7 @@
source _common.sh
source ynh_redis
source ynh_apps
source /usr/share/yunohost/helpers
#=================================================
@ -19,15 +20,15 @@ app=$YNH_APP_INSTANCE_NAME
domain=$(ynh_app_setting_get --app=$app --key=domain)
path_url=$(ynh_app_setting_get --app=$app --key=path)
admin=$(ynh_app_setting_get --app=$app --key=admin)
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
port=$(ynh_app_setting_get --app=$app --key=port)
rtmp_port=$(ynh_app_setting_get --app=$app --key=rtmp_port)
db_name=$(ynh_app_setting_get --app=$app --key=db_name)
db_user=$(ynh_app_setting_get --app=$app --key=db_user)
db_pwd=$(ynh_app_setting_get --app=$app --key=db_pwd)
db_pwd=$(ynh_app_setting_get --app=$app --key=psqlpwd)
datadir=$(ynh_app_setting_get --app=$app --key=datadir)
admin=$(ynh_app_setting_get --app=$app --key=admin)
admin_email=$(ynh_user_get_info --username=$admin --key="mail")
admin_mail=$(ynh_user_get_info --username=$admin --key="mail")
redis_db=$(ynh_app_setting_get --app=$app --key=redis_db)
#=================================================
@ -67,7 +68,7 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="systemd"
ynh_script_progression --message="Ensuring downward compatibility..."
ynh_app_setting_delete --app=$app --key=admin_pass
ynh_app_setting_delete --app=$app --key=admin_email
ynh_app_setting_delete --app=$app --key=admin_mail
# If db_name doesn't exist, create it
if [ -z "$db_name" ]; then
@ -164,40 +165,24 @@ if [ "$upgrade_type" == "UPGRADE_APP" ]
then
ynh_script_progression --message="Upgrading source files..."
# Create a temporary directory
tmpdir="$(mktemp -d)"
# Backup the config file in the temp dir
cp -af "$final_path/config/production.yaml" "$tmpdir/production.yaml"
if [ -s "$final_path/config/local-production.json" ]
then
cp -af "$final_path/config/local-production.json" "$tmpdir/local-production.json"
fi
# Remove the app directory securely
ynh_secure_remove --file="$final_path"
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$final_path"
#Copy the admin saved settings from tmp directory to final path
cp -af "$tmpdir/production.yaml" "$final_path/config/production.yaml"
if [ -s "$tmpdir/local-production.json" ]
then
cp -af "$tmpdir/local-production.json" "$final_path/config/local-production.json"
else
cp ../conf/local-production.json "$final_path/config/local-production.json"
fi
# Remove the tmp directory securely
ynh_secure_remove --file="$tmpdir"
ynh_setup_source --dest_dir="$final_path" --keep="config/production.yaml config/local-production.json"
fi
chmod 750 "$final_path"
chmod -R o-rwx "$final_path"
chown -R $app:www-data "$final_path"
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
ynh_install_apps --apps="$ynh_app_dependencies"
ynh_install_app_dependencies $pkg_dependencies
ynh_install_nodejs --nodejs_version=$nodejs_version
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
#=================================================
# NGINX CONFIGURATION
#=================================================
@ -206,31 +191,6 @@ ynh_script_progression --message="Upgrading NGINX web server configuration..."
# Create a dedicated NGINX config
ynh_add_nginx_config
#=================================================
# UPGRADE DEPENDENCIES
#=================================================
ynh_script_progression --message="Upgrading dependencies..."
# Install nodejs
ynh_install_nodejs --nodejs_version=$NODEJS_VERSION
# Install dependencies
ynh_exec_warn_less ynh_install_app_dependencies $pkg_dependencies
# Install Yarn
ynh_install_extra_app_dependencies --repo="deb https://dl.yarnpkg.com/debian/ stable main" --package="yarn" --key="https://dl.yarnpkg.com/debian/pubkey.gpg"
if ! yunohost app list | grep -q "prosody"
then
yunohost tools update
yunohost app install prosody
else
yunohost tools update
yunohost app upgrade prosody
fi
ynh_app_setting_set --app=$app --key=require_prosody --value="1"
#=================================================
# SPECIFIC UPGRADE
#=================================================
@ -303,7 +263,7 @@ pushd "$final_path"
popd
#=================================================
# PEERTUBE 4.0.0 UPGRADE MIGRATION SCRIPT
# PEERTUBE UPGRADE MIGRATION SCRIPT
#=================================================
if ynh_compare_current_package_version --comparison lt --version 4.0.0~ynh1; then

110
scripts/ynh_apps Normal file
View file

@ -0,0 +1,110 @@
#!/bin/bash
# Install others YunoHost apps
#
# usage: ynh_install_apps --apps="appfoo?domain=domain.foo&path=/foo appbar?domain=domain.bar&path=/bar&admin=USER&language=fr&is_public=1&pass?word=pass&port=666"
# | arg: -a, --apps= - apps to install
#
# Requires YunoHost version *.*.* or higher.
ynh_install_apps() {
# Declare an array to define the options of this helper.
local legacy_args=a
local -A args_array=([a]=apps=)
local apps
# Manage arguments with getopts
ynh_handle_getopts_args "$@"
# Split the list of apps in an array
local apps_list=($(echo $apps | tr " " "\n"))
local apps_dependencies=""
# For each app
for one_app_and_its_args in "${apps_list[@]}"
do
# Retrieve the name of the app (part before ?)
local one_app=$(cut -d "?" -f1 <<< "$one_app_and_its_args")
[ -z "$one_app" ] && ynh_die --message="You didn't provided a YunoHost app to install"
yunohost tools update apps
# Installing or upgrading the app depending if it's installed or not
if ! yunohost app list --output-as json --quiet | jq -e --arg id $one_app '.apps[] | select(.id == $id)' >/dev/null
then
# Retrieve the arguments of the app (part after ?)
local one_argument=$(cut -d "?" -f2- <<< "$one_app_and_its_args")
[ ! -z "$one_argument" ] && one_argument="--args $one_argument"
# Install the app with its arguments
yunohost app install $one_app $one_argument
else
# Upgrade the app
yunohost app upgrade $one_app
fi
if [ ! -z "$apps_dependencies" ]
then
apps_dependencies="$apps_dependencies, $one_app"
else
apps_dependencies="$one_app"
fi
done
ynh_app_setting_set --app=$app --key=apps_dependencies --value="$apps_dependencies"
}
# Remove other YunoHost apps
#
# Other YunoHost apps will be removed only if no other apps need them.
#
# usage: ynh_remove_apps
#
# Requires YunoHost version *.*.* or higher.
ynh_remove_apps() {
# Retrieve the apps dependencies of the app
local apps_dependencies=$(ynh_app_setting_get --app=$app --key=apps_dependencies)
ynh_app_setting_delete --app=$app --key=apps_dependencies
if [ ! -z "$apps_dependencies" ]
then
# Split the list of apps dependencies in an array
local apps_dependencies_list=($(echo $apps_dependencies | tr ", " "\n"))
# For each apps dependencies
for one_app in "${apps_dependencies_list[@]}"
do
# Retrieve the list of installed apps
local installed_apps_list=$(yunohost app list --output-as json --quiet | jq -r .apps[].id)
local required_by=""
local installed_app_required_by=""
# For each other installed app
for one_installed_app in $installed_apps_list
do
# Retrieve the other apps dependencies
one_installed_apps_dependencies=$(ynh_app_setting_get --app=$one_installed_app --key=apps_dependencies)
if [ ! -z "$one_installed_apps_dependencies" ]
then
one_installed_apps_dependencies_list=($(echo $one_installed_apps_dependencies | tr ", " "\n"))
# For each dependency of the other apps
for one_installed_app_dependency in "${one_installed_apps_dependencies_list[@]}"
do
if [[ $one_installed_app_dependency == $one_app ]]; then
required_by="$required_by $one_installed_app"
fi
done
fi
done
# If $one_app is no more required
if [[ -z "$required_by" ]]
then
# Remove $one_app
ynh_print_info --message="Removing of $one_app"
yunohost app remove $one_app --purge
else
ynh_print_info --message="$one_app was not removed because it's still required by${required_by}"
fi
done
fi
}