mirror of
https://github.com/YunoHost-Apps/cops_ynh.git
synced 2024-09-03 18:25:57 +02:00
Fix
This commit is contained in:
parent
d1be575673
commit
eabf7baa50
5 changed files with 48 additions and 12 deletions
|
@ -14,7 +14,7 @@
|
||||||
* containing all the formats.
|
* containing all the formats.
|
||||||
* BEWARE : it has to end with a /
|
* BEWARE : it has to end with a /
|
||||||
*/
|
*/
|
||||||
$config['calibre_directory'] = '__DATADIR__';
|
$config['calibre_directory'] = '__CALIBRE_DIR__/';
|
||||||
|
|
||||||
/*
|
/*
|
||||||
* $config['calibre_internal_directory'] = '/Calibre/';
|
* $config['calibre_internal_directory'] = '/Calibre/';
|
||||||
|
|
0
conf/metadata.db.empty
Normal file
0
conf/metadata.db.empty
Normal file
|
@ -39,11 +39,11 @@ ynh_print_info --message="Declaring files to be backed up..."
|
||||||
|
|
||||||
ynh_backup --src_path="$final_path"
|
ynh_backup --src_path="$final_path"
|
||||||
|
|
||||||
# #=================================================
|
#=================================================
|
||||||
# # BACKUP THE DATA DIR
|
# BACKUP THE DATA DIR
|
||||||
# #=================================================
|
#=================================================
|
||||||
|
|
||||||
# ynh_backup --src_path="$datadir" --is_big
|
ynh_backup --src_path="$calibre_dir" --is_big
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# BACKUP THE NGINX CONFIGURATION
|
# BACKUP THE NGINX CONFIGURATION
|
||||||
|
|
|
@ -96,16 +96,23 @@ ynh_add_fpm_config
|
||||||
#=================================================
|
#=================================================
|
||||||
# CREATE DATA DIRECTORY
|
# CREATE DATA DIRECTORY
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
ynh_script_progression --message="Creating a calibre directory..." --weight=1
|
||||||
|
|
||||||
datadir=/home/yunohost.app/$app
|
#build multimedia directory
|
||||||
ynh_app_setting_set --app=$app --key=datadir --value=$datadir
|
ynh_multimedia_build_main_dir
|
||||||
|
ynh_multimedia_addaccess $app
|
||||||
|
|
||||||
mkdir -p $datadir
|
calibre_dir=/home/yunohost.multimedia/share/eBook
|
||||||
|
ynh_app_setting_set --app=$app --key=calibre_dir --value=$calibre_dir
|
||||||
|
|
||||||
chmod 750 "$datadir"
|
#Check if metadata.db file exists. If not create it (empty library)
|
||||||
chmod -R o-rwx "$datadir"
|
if [ ! -e "$calibre_dir"/metadata.db ]; then
|
||||||
chown -R $app:www-data "$datadir"
|
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
|
# ADD A CONFIGURATION
|
||||||
|
|
|
@ -20,6 +20,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain)
|
||||||
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
path_url=$(ynh_app_setting_get --app=$app --key=path)
|
||||||
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
final_path=$(ynh_app_setting_get --app=$app --key=final_path)
|
||||||
language=$(ynh_app_setting_get --app=$app --key=language)
|
language=$(ynh_app_setting_get --app=$app --key=language)
|
||||||
|
calibre_dir=$(ynh_app_setting_get --app=$app --key=calibre_dir)
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# CHECK VERSION
|
# CHECK VERSION
|
||||||
|
@ -55,6 +56,18 @@ ynh_systemd_action --service_name=$app --action="stop" --log_path="/var/log/$app
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
ynh_script_progression --message="Ensuring downward compatibility..." --weight=1
|
||||||
|
|
||||||
|
if [ ! -e "$calibre_dir" ]; then
|
||||||
|
ynh_print_info "Create calibre library folder $calibre_dir"
|
||||||
|
mkdir -p $calibre_dir
|
||||||
|
chown -R $app:www-data $calibre_dir
|
||||||
|
fi
|
||||||
|
|
||||||
|
#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
|
||||||
|
chown $app:www-data $calibre_dir/*
|
||||||
|
fi
|
||||||
|
|
||||||
# Cleaning legacy permissions
|
# Cleaning legacy permissions
|
||||||
if ynh_legacy_permissions_exists; then
|
if ynh_legacy_permissions_exists; then
|
||||||
ynh_legacy_permissions_delete_all
|
ynh_legacy_permissions_delete_all
|
||||||
|
@ -109,6 +122,22 @@ ynh_script_progression --message="Upgrading PHP-FPM configuration..." --weight=1
|
||||||
# Create a dedicated PHP-FPM config
|
# Create a dedicated PHP-FPM config
|
||||||
ynh_add_fpm_config
|
ynh_add_fpm_config
|
||||||
|
|
||||||
|
#=================================================
|
||||||
|
# RESTORE THE 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
|
||||||
|
|
||||||
|
chmod 750 "$calibre_dir"
|
||||||
|
chmod -R o-rwx "$calibre_dir"
|
||||||
|
chown -R $app:www-data "$calibre_dir"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# UPDATE A CONFIG FILE
|
# UPDATE A CONFIG FILE
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
Loading…
Reference in a new issue