diff --git a/scripts/backup b/scripts/backup index 1282772..cceb424 100644 --- a/scripts/backup +++ b/scripts/backup @@ -12,7 +12,9 @@ source /usr/share/yunohost/helpers # Backup sources & data # Note: the last argument is where to save this path, see the restore script. ynh_backup "/var/www/${app}" "sources" -ynh_backup "/var/www/${app}_library" "data" +admin=$(ynh_app_setting_get "$app" admin) +books_path=/home/$admin/calibre_library +ynh_backup "$books_path" "data" ### MySQL (remove if not used) ### # If a MySQL database is used: diff --git a/scripts/install b/scripts/install index ed8eeb7..3797b0d 100644 --- a/scripts/install +++ b/scripts/install @@ -47,7 +47,7 @@ sudo cp -R "$src_path"/BicBucStriim-1.3.6/* "$src_path" sudo rm "$src_path"/bbs.zip sudo rm -rf "$src_path"/BicBucStriim-1.3.6 -books_path=${src_path}_library +books_path=/home/$admin/calibre_library cp -r ../empty_library $books_path # Disable BicBucStriim login if checked @@ -67,11 +67,11 @@ cd - mail=$(ynh_user_get_info $admin mail) if ! ynh_package_is_installed "sqlite3" ; then ynh_package_install sqlite3 - echo "INSERT INTO config (name, val) VALUES ('calibre_dir', '/var/www/bicbucstriim_library');" | sqlite3 $src_path/data/data.db + echo "INSERT INTO config (name, val) VALUES ('calibre_dir', '$books_path');" | sqlite3 $src_path/data/data.db echo "UPDATE user SET username = '$admin', password = '$hash', email='$mail' WHERE id = 1;" | sqlite3 $src_path/data/data.db ynh_package_remove sqlite3 else - echo "INSERT INTO config (name, val) VALUES ('calibre_dir', '/var/www/bicbucstriim_library');" | sqlite3 $src_path/data/data.db + echo "INSERT INTO config (name, val) VALUES ('calibre_dir', '$books_path');" | sqlite3 $src_path/data/data.db echo "UPDATE user SET username = '$admin', password = '$hash', email='$mail' WHERE id = 1;" | sqlite3 $src_path/data/data.db fi diff --git a/scripts/restore b/scripts/restore index 0041c7e..d18eb6a 100644 --- a/scripts/restore +++ b/scripts/restore @@ -15,6 +15,7 @@ source /usr/share/yunohost/helpers # Retrieve old app settings domain=$(ynh_app_setting_get "$app" domain) path=$(ynh_app_setting_get "$app" path) +admin=$(ynh_app_setting_get "$app" admin) # Check domain/path availability sudo yunohost app checkurl "${domain}${path}" -a "$app" \ @@ -23,7 +24,9 @@ sudo yunohost app checkurl "${domain}${path}" -a "$app" \ # Restore sources & data src_path="/var/www/${app}" sudo cp -a ./sources "$src_path" -sudo cp -a ./data "${src_path}_library" + +books_path=/home/$admin/calibre_library +sudo cp -a ./data "$books_path" # Restore permissions to app files # you may need to make some file and/or directory writeable by www-data (nginx user)