2021-02-16 13:38:59 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
#=================================================
|
|
|
|
# GENERIC START
|
|
|
|
#=================================================
|
|
|
|
# IMPORT GENERIC HELPERS
|
|
|
|
#=================================================
|
|
|
|
|
2021-02-16 14:17:45 +01:00
|
|
|
source _common.sh
|
2021-02-16 13:38:59 +01:00
|
|
|
source /usr/share/yunohost/helpers
|
|
|
|
|
2021-02-16 14:17:45 +01:00
|
|
|
#=================================================
|
|
|
|
# INSTALL DEPENDENCIES
|
|
|
|
#=================================================
|
2023-03-12 22:22:24 +01:00
|
|
|
ynh_script_progression --message="Installing dependencies..."
|
2021-02-16 14:17:45 +01:00
|
|
|
|
2022-07-03 16:40:34 +02:00
|
|
|
ynh_exec_warn_less ynh_install_nodejs --nodejs_version=$nodejs_version
|
2022-07-04 21:33:57 +02:00
|
|
|
ynh_use_nodejs
|
2021-02-16 14:17:45 +01:00
|
|
|
|
2021-02-16 13:38:59 +01:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2021-02-16 14:30:51 +01:00
|
|
|
ynh_script_progression --message="Setting up source files..." --weight=1
|
2021-02-16 13:38:59 +01:00
|
|
|
|
2024-02-28 23:19:34 +01:00
|
|
|
# Download, check integrity, uncompress and patch the source from app.src
|
2023-03-12 22:15:34 +01:00
|
|
|
ynh_setup_source --dest_dir="$install_dir"
|
2021-02-16 13:38:59 +01:00
|
|
|
|
2023-03-12 22:15:34 +01:00
|
|
|
chmod -R o-rwx "$install_dir"
|
|
|
|
chown -R $app:www-data "$install_dir"
|
2021-06-24 19:35:38 +02:00
|
|
|
|
2021-02-16 13:38:59 +01:00
|
|
|
#=================================================
|
2023-03-12 22:29:28 +01:00
|
|
|
# SYSTEM CONFIGURATION
|
2021-02-16 13:38:59 +01:00
|
|
|
#=================================================
|
2023-03-12 22:29:28 +01:00
|
|
|
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
|
2021-02-16 13:38:59 +01:00
|
|
|
|
2024-02-28 23:19:34 +01:00
|
|
|
# Create a dedicated NGINX config
|
2021-02-16 13:38:59 +01:00
|
|
|
ynh_add_nginx_config
|
|
|
|
|
2024-02-28 23:19:34 +01:00
|
|
|
# Create a dedicated systemd config
|
2023-03-12 22:29:28 +01:00
|
|
|
ynh_add_systemd_config
|
|
|
|
|
2024-02-28 23:19:34 +01:00
|
|
|
yunohost service add $app --description="A non-linear personal web notebook"
|
2023-03-12 22:29:28 +01:00
|
|
|
|
2022-07-03 16:40:34 +02:00
|
|
|
#=================================================
|
|
|
|
# ADD A CONFIGURATION
|
|
|
|
#=================================================
|
2021-02-16 21:56:01 +01:00
|
|
|
ynh_script_progression --message="Configuring TiddlyWiki..." --weight=2
|
2021-02-16 16:37:57 +01:00
|
|
|
|
2023-03-12 22:15:34 +01:00
|
|
|
if [ ! -f $data_dir/tiddlywiki.info ]
|
2022-07-04 21:33:57 +02:00
|
|
|
then
|
2023-03-12 22:15:34 +01:00
|
|
|
pushd $install_dir
|
|
|
|
ynh_exec_warn_less ynh_exec_as $app env $ynh_node_load_PATH ./tiddlywiki.js $data_dir --init server
|
2022-07-04 21:33:57 +02:00
|
|
|
popd
|
|
|
|
fi
|
2021-06-24 19:20:05 +02:00
|
|
|
|
2021-02-16 14:17:45 +01:00
|
|
|
#=================================================
|
|
|
|
# START SYSTEMD SERVICE
|
|
|
|
#=================================================
|
2021-02-16 16:40:11 +01:00
|
|
|
ynh_script_progression --message="Starting a systemd service..." --weight=2
|
2021-02-16 14:17:45 +01:00
|
|
|
|
2022-07-03 16:40:34 +02:00
|
|
|
# Start a systemd service
|
|
|
|
ynh_systemd_action --service_name=$app --action="start" --log_path="systemd" --line_match="Serving on"
|
2021-02-16 14:17:45 +01:00
|
|
|
|
2021-02-16 13:38:59 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2021-02-16 14:30:51 +01:00
|
|
|
ynh_script_progression --message="Installation of $app completed" --last
|