1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/duniter_ynh.git synced 2024-09-03 18:26:35 +02:00
duniter_ynh/scripts/functions.sh

67 lines
1.9 KiB
Bash
Raw Normal View History

#/bin/bash
INSTALL_DUNITER_DEBIAN_PACKAGE () {
version="v1.8.0"
url_base="https://git.duniter.org/nodes/typescript/duniter/"
2018-11-29 17:32:21 +01:00
if [ $arch == "x64" ]; then
mid_url="-/jobs/40349/artifacts/raw/work/bin/"
2018-11-29 17:32:21 +01:00
else
mid_url="uploads/afe00e6e6cb318fbdbb977d8c73f4645/"
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}${mid_url}${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
}
INSTALL_SYSTEMD () {
cp ../conf/duniter.service /etc/systemd/system/duniter.service
systemctl enable duniter.service
}
CONFIGURE_DUNITER () {
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
}
2017-03-14 09:41:28 +01:00
CONFIG_SSOWAT () {
# Protect senstive sub-routes to Duniter web admin interface, give access to choosen admin
if ! ynh_permission_exists --permission "admin"; then
ynh_permission_create --permission "admin" --url "/webui","/webmin" --allowed "$admin"
fi
# Add access to BMA
ynh_permission_update --permission main --add visitors
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'}"
# Remove deprecated permission system settings
if [ ! -z "$(ynh_app_setting_get --app=$app --key=protected_uris)" ]; then
ynh_app_setting_delete --app=$app --key=protected_uris
ynh_app_setting_delete --app=$app --key=unprotected_uris
fi
}
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
2020-06-29 18:06:53 +02:00
systemctl reload nginx
}
REMOVE_DUNITER () {
# Stop duniter daemon
systemctl stop duniter
2018-11-29 17:32:21 +01:00
# Remove Duniter package
dpkg -r duniter
}