#!/usr/bin/env bash set -eu source /usr/share/yunohost/helpers main() { local app=$YNH_APP_INSTANCE_NAME local deploy_path=$(ynh_app_setting_get $app deploy_path) local symlink_to_deploy_path=$(ynh_app_setting_get $app symlink_to_deploy_path) local nginx_config_file=$( ynh_app_setting_get $app nginx_config_file ) local systemd_service_name=$( ynh_app_setting_get $app systemd_service_name ) local systemd_service_file=$( ynh_app_setting_get $app systemd_service_file ) local user=$( ynh_app_setting_get $app user ) local group_id=$( ynh_app_setting_get $app group_id ) local user_zeronet_dir=$( ynh_app_setting_get $app user_zeronet_dir ) local url=$(ynh_app_setting_get $app url) sudo yunohost app checkurl $url -a $app sudo cp -a "./sources" $deploy_path sudo chown www-data:www-data $deploy_path -R sudo ln --symbolic --force $deploy_path $symlink_to_deploy_path sudo rm -rf $user_zeronet_dir sudo cp -aR "./conf/.zeronet" $user_zeronet_dir sudo chown -R $user:$group_id $user_zeronet_dir sudo cp -a "./conf/nginx.conf" $nginx_config_file sudo service nginx reload sudo cp -a "./conf/${systemd_service_name}" $systemd_service_file sudo systemctl restart $systemd_service_name } main