2015-05-24 23:01:16 +02:00
|
|
|
#!/bin/bash
|
|
|
|
|
2016-05-31 23:22:59 +02:00
|
|
|
# Exit on command errors and treat unset variables as an error
|
|
|
|
set -eu
|
2015-12-02 21:41:55 +01:00
|
|
|
|
2015-05-24 23:01:16 +02:00
|
|
|
# Retrieve arguments
|
2016-06-23 13:27:00 +02:00
|
|
|
app=$YNH_APP_INSTANCE_NAME
|
|
|
|
domain=$YNH_APP_ARG_DOMAIN
|
2017-02-21 12:58:51 +01:00
|
|
|
path="/"
|
2017-03-20 21:01:47 +01:00
|
|
|
port=10901
|
2016-06-24 11:57:31 +02:00
|
|
|
admin=$YNH_APP_ARG_ADMIN
|
2015-12-25 21:33:56 +01:00
|
|
|
|
2016-08-20 02:31:08 +02:00
|
|
|
# Source app helpers and functions
|
2016-05-31 15:26:06 +02:00
|
|
|
source /usr/share/yunohost/helpers
|
2016-08-20 02:31:08 +02:00
|
|
|
source functions.sh
|
2016-05-31 15:26:06 +02:00
|
|
|
|
2015-12-25 21:33:56 +01:00
|
|
|
# Check domain/path availability
|
2018-11-29 17:03:39 +01:00
|
|
|
yunohost app checkurl "${domain}${path}" -a "$app" \
|
2016-06-23 13:12:33 +02:00
|
|
|
|| ynh_die "Path not available: ${domain}${path}"
|
2015-12-25 21:33:56 +01:00
|
|
|
|
|
|
|
# Check port availability
|
2018-11-29 17:03:39 +01:00
|
|
|
yunohost app checkport $port
|
2015-12-25 21:33:56 +01:00
|
|
|
if [[ ! $? -eq 0 ]]; then
|
2017-02-21 14:51:22 +01:00
|
|
|
ynh_die "Port not available: ${port}"
|
2015-12-25 21:33:56 +01:00
|
|
|
fi
|
|
|
|
|
2020-06-11 18:01:26 +02:00
|
|
|
#=================================================
|
|
|
|
# CREATE DEDICATED USER
|
|
|
|
#=================================================
|
|
|
|
ynh_script_progression --message="Configuring system user..."
|
|
|
|
|
|
|
|
# Create a system user
|
|
|
|
ynh_system_user_create --username=$app --home_dir=$final_path
|
2016-06-24 11:57:31 +02:00
|
|
|
|
2016-06-24 11:49:05 +02:00
|
|
|
# Get CPU architecture and check it
|
2016-06-23 12:05:02 +02:00
|
|
|
arch=$(uname -m)
|
|
|
|
if [ $arch == "x86_64" ]; then
|
|
|
|
arch="x64"
|
|
|
|
fi
|
2016-07-03 11:47:35 +02:00
|
|
|
if [[ $arch != "x64" && $arch != "armv7l" ]]; then
|
2016-08-20 02:31:08 +02:00
|
|
|
ynh_die "$arch is not supported." 2
|
2016-06-24 11:49:05 +02:00
|
|
|
fi
|
2016-06-23 12:05:02 +02:00
|
|
|
|
2015-12-25 21:33:56 +01:00
|
|
|
# Store config on YunoHost instance
|
2016-05-31 15:26:06 +02:00
|
|
|
ynh_app_setting_set $app port $port
|
2016-06-23 12:05:02 +02:00
|
|
|
ynh_app_setting_set $app arch $arch
|
2016-06-24 11:57:31 +02:00
|
|
|
ynh_app_setting_set "$app" admin "$admin"
|
2015-05-24 23:01:16 +02:00
|
|
|
|
2017-02-14 11:22:33 +01:00
|
|
|
# Open port on firewall
|
2018-11-29 17:03:39 +01:00
|
|
|
yunohost firewall allow TCP $port > /dev/null 2>&1
|
2017-02-14 11:22:33 +01:00
|
|
|
|
2016-08-20 02:31:08 +02:00
|
|
|
INSTALL_DUNITER_DEBIAN_PACKAGE
|
2018-03-13 19:36:50 +01:00
|
|
|
CONFIGURE_DUNITER
|
2017-02-14 11:22:33 +01:00
|
|
|
|
|
|
|
# Reset Duniter node's existing data (blockchain, not conf)
|
2018-11-29 17:03:39 +01:00
|
|
|
duniter reset data > /dev/null
|
2015-12-25 21:33:56 +01:00
|
|
|
|
2016-05-02 14:54:52 +02:00
|
|
|
# Launch Duniter node
|
2018-11-29 17:03:39 +01:00
|
|
|
duniter webstart
|
2015-12-31 15:24:30 +01:00
|
|
|
|
2016-05-02 14:54:52 +02:00
|
|
|
# Add Duniter service to the YunoHost monitoring
|
2020-06-11 18:01:26 +02:00
|
|
|
yunohost service add $app --log $USER/.config/$app/"$app"_default/"$app".log
|
2015-12-25 21:33:56 +01:00
|
|
|
|
2017-03-14 09:41:28 +01:00
|
|
|
CONFIG_SSOWAT
|
|
|
|
CONFIG_NGINX
|