2021-02-16 13:38:59 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
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
|
|
|
|
#=================================================
|
2024-06-23 09:23:13 +02:00
|
|
|
ynh_script_progression "Installing dependencies..."
|
2021-02-16 14:17:45 +01:00
|
|
|
|
2024-06-23 09:23:13 +02:00
|
|
|
ynh_nodejs_install
|
2021-02-16 14:17:45 +01:00
|
|
|
|
2021-02-16 13:38:59 +01:00
|
|
|
#=================================================
|
|
|
|
# DOWNLOAD, CHECK AND UNPACK SOURCE
|
|
|
|
#=================================================
|
2024-06-23 09:23:13 +02:00
|
|
|
ynh_script_progression "Setting up source files..."
|
2021-02-16 13:38:59 +01:00
|
|
|
|
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
|
|
|
#=================================================
|
2024-06-23 09:23:13 +02:00
|
|
|
ynh_script_progression "Adding system configurations related to $app..."
|
2021-02-16 13:38:59 +01:00
|
|
|
|
2024-06-23 09:23:13 +02:00
|
|
|
ynh_config_add_nginx
|
2021-02-16 13:38:59 +01:00
|
|
|
|
2024-06-23 09:23:13 +02:00
|
|
|
ynh_config_add_systemd
|
2023-03-12 22:29:28 +01:00
|
|
|
|
2024-06-23 09:25:57 +02:00
|
|
|
yunohost service add $app --description="Non-linear personal web notebook" --log="/var/log/$app/$app.log"
|
2023-03-12 22:29:28 +01:00
|
|
|
|
2022-07-03 16:40:34 +02:00
|
|
|
#=================================================
|
|
|
|
# ADD A CONFIGURATION
|
|
|
|
#=================================================
|
2024-06-23 09:23:13 +02:00
|
|
|
ynh_script_progression "Configuring $app..."
|
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
|
2024-06-23 16:28:50 +02:00
|
|
|
ynh_hide_warnings ynh_exec_as_app --preserve-env=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
|
|
|
|
#=================================================
|
2024-06-23 09:23:13 +02:00
|
|
|
ynh_script_progression "Starting $app's systemd service..."
|
2021-02-16 14:17:45 +01:00
|
|
|
|
2022-07-03 16:40:34 +02:00
|
|
|
# Start a systemd service
|
2024-06-23 09:23:13 +02:00
|
|
|
ynh_systemctl --service=$app --action="start" --log_path="systemd" --wait_until="Serving on"
|
2021-02-16 14:17:45 +01:00
|
|
|
|
2021-02-16 13:38:59 +01:00
|
|
|
#=================================================
|
|
|
|
# END OF SCRIPT
|
|
|
|
#=================================================
|
|
|
|
|
2024-06-23 09:23:13 +02:00
|
|
|
ynh_script_progression "Installation of $app completed"
|