1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/zeronet_ynh.git synced 2024-09-03 17:46:12 +02:00
zeronet_ynh/scripts/restore
whypsi d87e7807c0 Squashed commit of the following:
commit f64d3c0eca9ee13888524a07b8d178140b52620e
Author: whypsi <whypsi@riseup.net>
Date:   Sat Mar 4 13:35:24 2017 +0100

    Several improvements

    ZeroNet application is now owned by user
    Cleans up code
2017-03-04 13:35:40 +01:00

36 lines
1.2 KiB
Bash
Executable file

#!/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 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 ln --symbolic --force $deploy_path $symlink_to_deploy_path
sudo chown $user: -LR $symlink_to_deploy_path
sudo chown $user: -h $symlink_to_deploy_path
sudo rm -rf $user_zeronet_dir
sudo cp -aR "./conf/.zeronet" $user_zeronet_dir
sudo chown -R $user: $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