1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/calibreweb_ynh.git synced 2024-09-03 18:16:20 +02:00

Merge pull request #64 from YunoHost-Apps/testing

Imagemagick Policy
This commit is contained in:
Krakinou 2021-02-20 22:10:33 +01:00 committed by GitHub
commit 75c44fe6f3
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 29 additions and 1 deletions

3
.gitignore vendored
View file

@ -1,2 +1,3 @@
*~ *~
*.sw[op] *.sw[op]
/check_process

View file

@ -191,6 +191,13 @@ eval sqlite3 $final_path/app.db "$conf"
conf="\"UPDATE user SET $(. <(echo -E echo $(<../conf/init_calibre_db_user))) WHERE ID=1\"" conf="\"UPDATE user SET $(. <(echo -E echo $(<../conf/init_calibre_db_user))) WHERE ID=1\""
eval sqlite3 $final_path/app.db "$conf" eval sqlite3 $final_path/app.db "$conf"
#Update Imagick policy as per https://github.com/janeczku/calibre-web/wiki/FAQ#what-to-do-if-cover-pictures-are-not-extracted-from-pdf-files
ynh_replace_string --match_string="<policy domain="coder" rights="none" pattern="PDF" />" \
--replace_string="<policy domain="coder" rights="read" pattern="PDF" />" \
--target_file="/etc/ImageMagick-6/policy.xml"
#================================================= #=================================================
# STORE THE CHECKSUM OF THE CONFIG FILE # STORE THE CHECKSUM OF THE CONFIG FILE
#================================================= #=================================================

View file

@ -87,6 +87,13 @@ then
yunohost firewall disallow TCP $port 2>&1 yunohost firewall disallow TCP $port 2>&1
fi fi
#Restore Imagick policy
if [ -z /etc/ImageMagick-6/policy.xml ]; then
ynh_replace_string --match_string="<policy domain="coder" rights="read" pattern="PDF" />" \
--replace_string="<policy domain="coder" rights="none" pattern="PDF" />" \
--target_file="/etc/ImageMagick-6/policy.xml"
fi
# Remove the log files # Remove the log files
ynh_script_progression --message="Removing log file..." --weight=1 ynh_script_progression --message="Removing log file..." --weight=1
ynh_secure_remove "/var/log/$app/" ynh_secure_remove "/var/log/$app/"

View file

@ -146,6 +146,13 @@ else
chown $app:$app $calibre_dir/* chown $app:$app $calibre_dir/*
fi fi
fi fi
#Update Imagick policy as per https://github.com/janeczku/calibre-web/wiki/FAQ#what-to-do-if-cover-pictures-are-not-extracted-from-pdf-files
ynh_replace_string --match_string="<policy domain="coder" rights="none" pattern="PDF" />" \
--replace_string="<policy domain="coder" rights="read" pattern="PDF" />" \
--target_file="/etc/ImageMagick-6/policy.xml"
# Remove the option backup_core_only if it's in the settings.yml file # Remove the option backup_core_only if it's in the settings.yml file
ynh_app_setting_delete $app backup_core_only ynh_app_setting_delete $app backup_core_only

View file

@ -191,9 +191,15 @@ ynh_systemd_action --service_name=$app --action="stop"
conf="\"UPDATE settings SET $(. <(echo -E echo $(<../conf/init_calibre_db_settings))), $(. <(echo -E echo $(<../conf/init_calibre_db_ldap_settings))) WHERE ID=1\"" conf="\"UPDATE settings SET $(. <(echo -E echo $(<../conf/init_calibre_db_settings))), $(. <(echo -E echo $(<../conf/init_calibre_db_ldap_settings))) WHERE ID=1\""
eval sqlite3 $final_path/app.db "$conf" eval sqlite3 $final_path/app.db "$conf"
#Update Imagick policy as per https://github.com/janeczku/calibre-web/wiki/FAQ#what-to-do-if-cover-pictures-are-not-extracted-from-pdf-files
ynh_replace_string --match_string="<policy domain="coder" rights="none" pattern="PDF" />" \
--replace_string="<policy domain="coder" rights="read" pattern="PDF" />" \
--target_file="/etc/ImageMagick-6/policy.xml"
# Recalculate and store the checksum of the file for the next upgrade. # Recalculate and store the checksum of the file for the next upgrade.
ynh_store_file_checksum "$final_path/app.db" ynh_store_file_checksum "$final_path/app.db"
#================================================= #=================================================
# SETUP LOGROTATE # SETUP LOGROTATE
#================================================= #=================================================