2016-08-20 02:31:08 +02:00
|
|
|
#/bin/bash
|
|
|
|
|
|
|
|
INSTALL_DUNITER_DEBIAN_PACKAGE () {
|
2018-02-03 23:25:57 +01:00
|
|
|
|
|
|
|
version="v1.6.21"
|
|
|
|
git_repo="https://git.duniter.org/nodes/typescript/duniter/"
|
|
|
|
if [ $arch == "x64" ]; then
|
|
|
|
middle_url="-/jobs/3296/artifacts/raw/work/bin/"
|
|
|
|
else
|
|
|
|
middle_url="uploads/94f13f3dd61357ddf2539afbc5dc7893/"
|
|
|
|
fi
|
|
|
|
deb="duniter-server-$version-linux-$arch.deb"
|
|
|
|
url="${git_repo}${middle_url}${deb}"
|
2016-08-20 02:31:08 +02:00
|
|
|
|
|
|
|
# Retrieve debian package and install it
|
|
|
|
wget -nc --quiet $url -P /tmp
|
2018-02-03 23:25:57 +01:00
|
|
|
deb_path="/tmp/$deb"
|
|
|
|
sudo dpkg -i $deb_path > /dev/null
|
|
|
|
sudo rm -f $deb_path
|
2016-08-20 02:31:08 +02:00
|
|
|
}
|
|
|
|
|
2017-03-14 09:41:28 +01:00
|
|
|
CONFIG_SSOWAT () {
|
2016-08-20 02:31:08 +02:00
|
|
|
# Add admin to the allowed users
|
|
|
|
sudo yunohost app addaccess $app -u $admin
|
|
|
|
|
2017-06-14 16:11:49 +02:00
|
|
|
# Protect senstive sub-routes
|
2017-06-21 11:31:21 +02:00
|
|
|
ynh_app_setting_set "$app" protected_uris "/webui","/webmin"
|
2016-08-20 02:31:08 +02:00
|
|
|
|
2017-02-14 11:22:33 +01:00
|
|
|
# Duniter is public app, with only some parts restricted in nginx.conf
|
2017-06-21 11:31:21 +02:00
|
|
|
ynh_app_setting_set "$app" unprotected_uris "/","/modules"
|
2017-03-05 16:19:13 +01:00
|
|
|
|
|
|
|
# Set URL redirection from root to webadmin
|
|
|
|
ynh_app_setting_set "$app" redirected_urls "{'$domain/':'$domain/webui'}"
|
2016-08-20 02:31:08 +02:00
|
|
|
}
|
|
|
|
|
2017-03-14 09:41:28 +01:00
|
|
|
CONFIG_NGINX () {
|
2016-08-20 02:31:08 +02:00
|
|
|
# Configure Nginx
|
|
|
|
nginx_conf="../conf/nginx.conf"
|
|
|
|
sudo sed -i "s@YNH_EXAMPLE_PORT@$port@" $nginx_conf
|
|
|
|
sudo sed -i "s@YNH_EXAMPLE_DOMAIN@$domain@" $nginx_conf
|
|
|
|
sudo cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
2017-02-25 12:09:07 +01:00
|
|
|
sudo service nginx reload
|
2016-08-20 02:31:08 +02:00
|
|
|
}
|
2017-03-31 11:33:59 +02:00
|
|
|
|
|
|
|
REMOVE_DUNITER () {
|
2017-03-31 11:36:28 +02:00
|
|
|
# Stop duniter daemon if running
|
|
|
|
sudo duniter status
|
|
|
|
if [ `echo "$?"` == 0 ]; then
|
|
|
|
sudo duniter stop
|
|
|
|
fi
|
2017-03-31 11:33:59 +02:00
|
|
|
|
|
|
|
# Remove Duniter package
|
|
|
|
sudo dpkg -r duniter
|
|
|
|
}
|