mirror of
https://github.com/YunoHost-Apps/calibreweb_ynh.git
synced 2024-09-03 18:16:20 +02:00
Merge pull request #72 from YunoHost-Apps/testing
Grant access to multimedia folder when restoring
This commit is contained in:
commit
c59e529fb4
2 changed files with 27 additions and 18 deletions
|
@ -84,7 +84,7 @@
|
|||
"optional": true,
|
||||
"ask": {
|
||||
"en": "Do you want to allow uploading of books?",
|
||||
"fr": "Voulez vous autoriser l'upload de livres?"
|
||||
"fr": "Voulez vous autoriser le téléversement de livres?"
|
||||
},
|
||||
"help":{
|
||||
"en":"You may change it later in the app",
|
||||
|
|
|
@ -70,14 +70,11 @@ ynh_system_user_create --username=$app
|
|||
# RESTORE THE APP MAIN DIR
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the app main directory..." --weight=1
|
||||
|
||||
ynh_restore_file --origin_path="$final_path"
|
||||
|
||||
#=================================================
|
||||
# RESTORE USER RIGHTS
|
||||
#=================================================
|
||||
|
||||
# Restore permissions on app files
|
||||
chown -R $app: $final_path
|
||||
|
||||
#=================================================
|
||||
|
@ -127,26 +124,38 @@ chown -R $app:$app /var/log/$app
|
|||
# RESTORE THE DATA DIRECTORY
|
||||
#=================================================
|
||||
|
||||
ynh_script_progression --message="Restoring data directory..." --weight=2
|
||||
ynh_script_progression --message="Restoring data directory if required..." --weight=2
|
||||
# The data directory will be restored only if it exists in the backup archive
|
||||
# So only if it was backup previously.
|
||||
|
||||
if [ -d "$YNH_BACKUP_DIR/apps/$app/backup/$calibre_dir" ]
|
||||
then
|
||||
#if [ -d "$YNH_BACKUP_DIR/apps/$app/backup/$calibre_dir" ] && [ ! tail "$calibre_dir" | grep "yunohost.multimedia" ]; then
|
||||
ynh_restore_file --origin_path="$calibre_dir" --not_mandatory
|
||||
else
|
||||
if [ ! -e "$calibre_dir" ]; then
|
||||
#fi
|
||||
|
||||
#=================================================
|
||||
# RESTORE THE MULTIMEDIA DIR IF NOT EXISTING
|
||||
#=================================================
|
||||
ynh_script_progression --message="Restoring the multimedia directory..." --weight=5
|
||||
ynh_multimedia_build_main_dir
|
||||
ynh_multimedia_addaccess $app
|
||||
|
||||
#=================================================
|
||||
# INITIALIZE DATA IF NOT EXISTING
|
||||
#=================================================
|
||||
|
||||
if [ ! -e "$calibre_dir" ]; then
|
||||
ynh_print_info "Create calibre library folder $calibre_dir"
|
||||
mkdir -p $calibre_dir
|
||||
chown -R $app:$app $calibre_dir
|
||||
fi
|
||||
fi
|
||||
#Check if metadata.db file exists. If not create it (empty library)
|
||||
if [ ! -e "$calibre_dir"/metadata.db ]; then
|
||||
if [ ! -e "$calibre_dir"/metadata.db ]; then
|
||||
cp -a ../settings/conf/metadata.db.empty $calibre_dir/metadata.db
|
||||
chown $app:$app $calibre_dir/*
|
||||
fi
|
||||
fi
|
||||
|
||||
#===================================================
|
||||
# SPECIFIC SETUP
|
||||
#===================================================
|
||||
#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" />" \
|
||||
|
|
Loading…
Add table
Reference in a new issue