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

70 lines
2.3 KiB
Text
Raw Permalink Normal View History

2021-03-01 02:41:36 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
2024-02-04 19:14:24 +01:00
# INITIALIZE AND STORE SETTINGS
2021-03-01 02:41:36 +01:00
#=================================================
2022-08-02 04:04:50 +02:00
email=$(ynh_user_get_info --username=$admin --key="mail")
2021-03-01 02:41:36 +01:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
2022-08-02 04:04:50 +02:00
# Download, check integrity, uncompress and patch the source from app.src
2024-02-04 19:23:42 +01:00
ynh_setup_source --dest_dir="$install_dir/source"
2021-07-14 18:44:40 +02:00
2024-02-04 20:34:16 +01:00
mkdir -p "$install_dir/source/accounts/newsmirror"
ln -s "$install_dir/source/accounts/newsmirror" "$install_dir/newsmirror"
2021-03-01 02:41:36 +01:00
2024-02-04 19:14:24 +01:00
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
2021-03-01 02:41:36 +01:00
2022-01-27 00:53:06 +01:00
#=================================================
# SPECIFIC SETUP
#=================================================
2022-08-02 04:04:50 +02:00
# CREATE ADMIN USER
2022-01-27 00:53:06 +01:00
#=================================================
2022-08-02 04:04:50 +02:00
ynh_script_progression --message="Creating admin user" --weight=1
2022-01-27 00:53:06 +01:00
# Create admin
2024-02-04 19:23:42 +01:00
pushd "$install_dir"
2024-02-04 19:23:55 +01:00
ynh_exec_as "$app" python3 "$install_dir/source/epicyon.py" --addaccount="$admin" --password="$password" --domain="$domain"
2024-02-04 19:23:42 +01:00
popd
2022-01-27 00:53:06 +01:00
2021-03-01 02:41:36 +01:00
#=================================================
2024-02-04 19:14:24 +01:00
# SYSTEM CONFIGURATION
2021-03-01 02:41:36 +01:00
#=================================================
2024-02-04 19:14:24 +01:00
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
2021-03-01 02:41:36 +01:00
2022-01-27 00:53:06 +01:00
# Create a dedicated systemd config
2021-07-14 18:44:40 +02:00
ynh_add_systemd_config
2024-02-04 19:14:24 +01:00
yunohost service add "$app" --description="Federated social network server" --log="/var/log/$app/$app.log"
2021-03-01 02:41:36 +01:00
#=================================================
# START SYSTEMD SERVICE
#=================================================
2021-07-14 18:44:40 +02:00
ynh_script_progression --message="Starting a systemd service..." --weight=1
2021-03-01 02:41:36 +01:00
# Start a systemd service
2024-02-04 19:14:24 +01:00
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
2021-03-01 02:41:36 +01:00
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last