2016-08-20 02:31:08 +02:00
|
|
|
#/bin/bash
|
|
|
|
|
|
|
|
INSTALL_DUNITER_DEBIAN_PACKAGE () {
|
2019-04-28 23:02:13 +02:00
|
|
|
version="v1.7.17"
|
2018-11-29 17:32:21 +01:00
|
|
|
if [ $arch == "x64" ]; then
|
2019-04-28 23:02:13 +02:00
|
|
|
url_base="https://git.duniter.org/nodes/typescript/duniter/-/jobs/21158/artifacts/raw/work/bin/"
|
2018-11-29 17:32:21 +01:00
|
|
|
else
|
2018-12-18 23:22:06 +01:00
|
|
|
url_base="https://jytou.fr/duniter/"
|
2018-11-29 17:32:21 +01:00
|
|
|
fi
|
2018-12-18 23:22:06 +01:00
|
|
|
|
|
|
|
deb="duniter-server-$version-linux-$arch.deb"
|
|
|
|
url="${url_base}${deb}"
|
2018-11-29 17:32:21 +01:00
|
|
|
|
|
|
|
# Retrieve debian package and install it
|
|
|
|
wget -nc --quiet $url -P /tmp
|
|
|
|
deb_path="/tmp/$deb"
|
|
|
|
dpkg -i $deb_path > /dev/null
|
|
|
|
rm -f $deb_path
|
2016-08-20 02:31:08 +02:00
|
|
|
}
|
|
|
|
|
2018-03-13 19:36:50 +01:00
|
|
|
CONFIGURE_DUNITER () {
|
2018-11-29 17:03:39 +01:00
|
|
|
duniter config --ipv4 127.0.0.1 --port $port --remoteh $domain --remotep 80 --noupnp
|
|
|
|
duniter config --addep "BMAS $domain 443"
|
|
|
|
duniter config --ws2p-host 127.0.0.1 --ws2p-port 20901 --ws2p-remote-host $domain --ws2p-remote-port 443 --ws2p-noupnp
|
2018-03-13 19:36:50 +01:00
|
|
|
}
|
|
|
|
|
2017-03-14 09:41:28 +01:00
|
|
|
CONFIG_SSOWAT () {
|
2018-11-29 17:32:21 +01:00
|
|
|
# Add admin to the allowed users
|
|
|
|
yunohost app addaccess $app -u $admin
|
2016-08-20 02:31:08 +02:00
|
|
|
|
2018-11-29 17:32:21 +01:00
|
|
|
# Protect senstive sub-routes
|
|
|
|
ynh_app_setting_set "$app" protected_uris "/webui","/webmin"
|
2016-08-20 02:31:08 +02:00
|
|
|
|
2018-11-29 17:32:21 +01:00
|
|
|
# Duniter is public app, with only some parts restricted in nginx.conf
|
|
|
|
ynh_app_setting_set "$app" unprotected_uris "/","/modules"
|
2017-03-05 16:19:13 +01:00
|
|
|
|
2018-11-29 17:32:21 +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 () {
|
2018-11-29 17:32:21 +01:00
|
|
|
nginx_conf="../conf/nginx.conf"
|
|
|
|
sed -i "s@YNH_EXAMPLE_PORT@$port@" $nginx_conf
|
|
|
|
sed -i "s@YNH_EXAMPLE_DOMAIN@$domain@" $nginx_conf
|
|
|
|
cp $nginx_conf /etc/nginx/conf.d/$domain.d/$app.conf
|
|
|
|
service nginx reload
|
2016-08-20 02:31:08 +02:00
|
|
|
}
|
2017-03-31 11:33:59 +02:00
|
|
|
|
|
|
|
REMOVE_DUNITER () {
|
2018-11-29 17:32:21 +01:00
|
|
|
# Stop duniter daemon if running
|
|
|
|
duniter status
|
|
|
|
if [ `echo "$?"` == 0 ]; then
|
|
|
|
duniter stop
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Remove Duniter package
|
|
|
|
dpkg -r duniter
|
2017-03-31 11:33:59 +02:00
|
|
|
}
|