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/install
Moul 67e49bfb1e [fix] #89: Use new permission system:
Requires YnH v4.1 which implements this new permission system
Use ynh_permission_create helper
Set Duniter admin interface accessible to the selected admin
BMA is set as accessible to visitors by default
Remove / −> /webui redirection, since this change adds a tile to the admin
Remove deprecated permission system settings
Re-enable the web admin since it is protected again
Rename f() name
2021-04-13 20:55:20 +02:00

58 lines
1.3 KiB
Bash
Executable file

#!/bin/bash
# Exit on command errors and treat unset variables as an error
set -eu
# Retrieve arguments
app=$YNH_APP_INSTANCE_NAME
domain=$YNH_APP_ARG_DOMAIN
path="/"
port=10901
admin=$YNH_APP_ARG_ADMIN
# Source app helpers and functions
source /usr/share/yunohost/helpers
source functions.sh
# Check domain/path availability
yunohost app checkurl "${domain}${path}" -a "$app" \
|| ynh_die "Path not available: ${domain}${path}"
# Check port availability
yunohost app checkport $port
if [[ ! $? -eq 0 ]]; then
ynh_die "Port not available: ${port}"
fi
# Check the admin exists in YunoHost users
ynh_user_exists $admin
# Get CPU architecture and check it
arch=$(uname -m)
if [ $arch == "x86_64" ]; then
arch="x64"
fi
if [[ $arch != "x64" && $arch != "armv7l" ]]; then
ynh_die "$arch is not supported." 2
fi
# Store config on YunoHost instance
ynh_app_setting_set $app port $port
ynh_app_setting_set $app arch $arch
ynh_app_setting_set "$app" admin "$admin"
# Open port on firewall
yunohost firewall allow TCP $port > /dev/null 2>&1
INSTALL_DUNITER_DEBIAN_PACKAGE
INSTALL_SYSTEMD
CONFIGURE_DUNITER
# Launch Duniter node
systemctl start duniter
# Add Duniter service to the YunoHost monitoring
yunohost service add $app --log /root/.config/$app/"$app"_default/"$app".log
CONFIG_PERMISSIONS
CONFIG_NGINX