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

72 lines
2.2 KiB
Text
Raw Normal View History

2016-12-21 18:46:36 +01:00
#!/bin/bash
2021-08-04 12:23:13 +02:00
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
2016-12-21 18:46:36 +01:00
2021-08-04 12:23:13 +02:00
source _common.sh
2016-12-21 18:46:36 +01:00
source /usr/share/yunohost/helpers
2021-08-04 12:23:13 +02:00
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
2021-08-04 12:50:02 +02:00
ynh_script_progression --message="Setting up source files..." --weight=1
2017-02-24 14:43:49 +01:00
2021-08-04 12:23:13 +02:00
# Download, check integrity, uncompress and patch the source from app.src
2024-01-05 18:46:20 +01:00
ynh_setup_source --dest_dir="$install_dir"
2023-01-22 12:26:54 +01:00
2024-01-05 18:46:20 +01:00
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
2023-01-22 12:26:54 +01:00
2021-08-04 12:23:13 +02:00
#=================================================
# CREATE DATA DIRECTORY
#=================================================
2021-12-09 16:07:56 +01:00
ynh_script_progression --message="Creating a calibre directory..." --weight=1
2017-02-24 17:06:06 +01:00
2024-01-05 18:46:20 +01:00
# build multimedia directory
2021-12-09 16:07:56 +01:00
ynh_multimedia_build_main_dir
2024-01-05 18:46:20 +01:00
ynh_multimedia_addaccess "$app"
2017-02-24 17:06:06 +01:00
2021-12-09 16:07:56 +01:00
calibre_dir=/home/yunohost.multimedia/share/eBook
ynh_app_setting_set --app=$app --key=calibre_dir --value=$calibre_dir
2024-01-05 18:46:20 +01:00
# Check if metadata.db file exists. If not create it (empty library)
if [ ! -e "$calibre_dir/metadata.db" ]; then
cp -a ../conf/metadata.db.empty $calibre_dir/metadata.db
2021-12-09 16:47:03 +01:00
fi
2021-12-09 16:07:56 +01:00
2021-12-09 16:21:13 +01:00
chmod 750 "$calibre_dir"
chmod -R o-rwx "$calibre_dir"
chown -R $app:www-data "$calibre_dir"
2021-08-04 12:23:13 +02:00
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
2024-01-05 18:46:20 +01:00
timezone="$(cat /etc/timezone)"
2016-12-21 18:46:36 +01:00
2024-01-05 18:46:20 +01:00
ynh_add_config --template="../conf/config_local.php" --destination="$install_dir/config_local.php"
2016-12-21 18:46:36 +01:00
2024-01-05 18:46:20 +01:00
chmod 400 "$install_dir/config_local.php"
chown $app "$install_dir/config_local.php"
2016-12-21 18:46:36 +01:00
2021-08-04 12:23:13 +02:00
#=================================================
2024-01-05 18:46:20 +01:00
# SYSTEM CONFIGURATION
2021-08-04 12:23:13 +02:00
#=================================================
2024-01-05 18:46:20 +01:00
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
2021-08-04 12:23:13 +02:00
2024-01-05 18:46:20 +01:00
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
2021-08-04 12:23:13 +02:00
#=================================================
# END OF SCRIPT
#=================================================
2021-08-04 12:50:02 +02:00
ynh_script_progression --message="Installation of $app completed" --last