1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/epicyon_ynh.git synced 2024-09-03 18:36:08 +02:00
epicyon_ynh/scripts/install
2024-02-04 19:24:17 +01:00

70 lines
2.3 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INITIALIZE AND STORE SETTINGS
#=================================================
email=$(ynh_user_get_info --username=$admin --key="mail")
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir/source"
mkdir -p "$install_dir/accounts/newsmirror"
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# SPECIFIC SETUP
#=================================================
# CREATE ADMIN USER
#=================================================
ynh_script_progression --message="Creating admin user" --weight=1
# Create admin
pushd "$install_dir"
ynh_exec_as "$app" python3 "$install_dir/epicyon.py" --addaccount="$admin" --password="$password" --domain="$domain"
popd
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated systemd config
ynh_add_systemd_config
yunohost service add "$app" --description="Federated social network server" --log="/var/log/$app/$app.log"
ynh_exec_warn find "$install_dir"
#=================================================
# START SYSTEMD SERVICE
#=================================================
ynh_script_progression --message="Starting a systemd service..." --weight=1
# Start a systemd service
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last