1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/armadietto_ynh.git synced 2024-09-03 18:06:18 +02:00
armadietto_ynh/scripts/install

80 lines
2.5 KiB
Text
Raw Normal View History

2021-12-17 11:38:57 +01:00
#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# INSTALL DEPENDENCIES
2021-12-17 11:38:57 +01:00
#=================================================
2024-01-05 15:28:04 +01:00
ynh_script_progression --message="Installing NodeJS..." --weight=23
2021-12-17 11:38:57 +01:00
2024-01-05 15:28:04 +01:00
ynh_install_nodejs --nodejs_version="$NODEJS_VERSION"
ynh_use_nodejs
2021-12-17 11:38:57 +01:00
#=================================================
2022-05-27 17:03:32 +02:00
# SPECIFIC SETUP
2021-12-17 11:38:57 +01:00
#=================================================
2022-05-27 17:03:32 +02:00
# INSTALL ARMADIETTO
#=================================================
2022-05-27 17:03:32 +02:00
ynh_script_progression --message="Install armadietto with npm..." --weight=1
2021-12-18 14:56:34 +01:00
2024-01-05 15:28:04 +01:00
pushd "$install_dir"
upstream_version=$(ynh_app_upstream_version)
ynh_npm -g i "armadietto@$upstream_version"
2022-05-27 17:03:32 +02:00
popd
2021-12-17 11:38:57 +01:00
2024-01-05 15:28:04 +01:00
chmod 750 "$install_dir"
chmod -R o-rwx "$install_dir"
chown -R "$app:$app" "$install_dir"
2022-01-01 16:14:00 +01:00
2024-01-05 15:28:04 +01:00
chmod -R o-rwx "$data_dir"
chown -R "$app:$app" "$data_dir"
2022-05-27 17:03:32 +02:00
2022-01-01 16:14:00 +01:00
#=================================================
2022-05-27 17:03:32 +02:00
# ADD A CONFIGURATION
2022-01-01 16:14:00 +01:00
#=================================================
2022-05-27 17:03:32 +02:00
ynh_script_progression --message="Adding a configuration file..." --weight=2
2021-12-18 14:56:34 +01:00
2022-01-01 16:14:00 +01:00
# Define armadietto module path
module_path="$node_version_path/$nodejs_version/lib/node_modules/armadietto/lib"
2024-01-05 15:28:04 +01:00
ynh_add_config --template="../conf/server.js" --destination="$install_dir/server.js"
2021-12-18 14:56:34 +01:00
2024-01-05 15:28:04 +01:00
chmod 400 "$install_dir/server.js"
chown $app:$app "$install_dir/server.js"
2021-12-18 14:56:34 +01:00
#=================================================
2024-01-05 15:28:04 +01:00
# SYSTEM CONFIGURATION
2021-12-18 14:56:34 +01:00
#=================================================
2024-01-05 15:28:04 +01:00
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
2021-12-17 11:38:57 +01:00
2022-05-27 17:03:32 +02:00
# Create a dedicated systemd config
ynh_add_systemd_config
2024-01-05 15:28:04 +01:00
yunohost service add $app --description="Armadietto run a remotestorage server as service" --log="/var/log/$app/$app.log"
2021-12-17 11:38:57 +01:00
# Use logrotate to manage application logfile(s)
ynh_use_logrotate
#=================================================
2022-05-27 17:03:32 +02:00
# START SYSTEMD SERVICE
2021-12-17 11:38:57 +01:00
#=================================================
2022-05-27 17:03:32 +02:00
ynh_script_progression --message="Starting a systemd service..." --weight=1
2021-12-17 11:38:57 +01:00
2022-05-27 17:03:32 +02:00
# Start a systemd service
2024-01-05 15:28:04 +01:00
ynh_systemd_action --service_name="$app" --action="start" --log_path="/var/log/$app/$app.log"
2021-12-17 11:38:57 +01:00
#=================================================
# END OF SCRIPT
#=================================================
2022-05-27 17:03:32 +02:00
ynh_script_progression --message="Installation of $app completed" --last