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
2024-01-05 18:46:20 +01:00

71 lines
2.2 KiB
Bash
Executable file

#!/bin/bash
#=================================================
# GENERIC START
#=================================================
# IMPORT GENERIC HELPERS
#=================================================
source _common.sh
source /usr/share/yunohost/helpers
#=================================================
# DOWNLOAD, CHECK AND UNPACK SOURCE
#=================================================
ynh_script_progression --message="Setting up source files..." --weight=1
# Download, check integrity, uncompress and patch the source from app.src
ynh_setup_source --dest_dir="$install_dir"
chmod -R o-rwx "$install_dir"
chown -R "$app:www-data" "$install_dir"
#=================================================
# CREATE DATA DIRECTORY
#=================================================
ynh_script_progression --message="Creating a calibre directory..." --weight=1
# build multimedia directory
ynh_multimedia_build_main_dir
ynh_multimedia_addaccess "$app"
calibre_dir=/home/yunohost.multimedia/share/eBook
ynh_app_setting_set --app=$app --key=calibre_dir --value=$calibre_dir
# 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
fi
chmod 750 "$calibre_dir"
chmod -R o-rwx "$calibre_dir"
chown -R $app:www-data "$calibre_dir"
#=================================================
# ADD A CONFIGURATION
#=================================================
ynh_script_progression --message="Adding a configuration file..." --weight=1
timezone="$(cat /etc/timezone)"
ynh_add_config --template="../conf/config_local.php" --destination="$install_dir/config_local.php"
chmod 400 "$install_dir/config_local.php"
chown $app "$install_dir/config_local.php"
#=================================================
# SYSTEM CONFIGURATION
#=================================================
ynh_script_progression --message="Adding system configurations related to $app..." --weight=1
# Create a dedicated NGINX config
ynh_add_nginx_config
# Create a dedicated PHP-FPM config
ynh_add_fpm_config
#=================================================
# END OF SCRIPT
#=================================================
ynh_script_progression --message="Installation of $app completed" --last