mirror of
https://github.com/YunoHost-Apps/BicBucStriim_ynh.git
synced 2024-09-03 18:15:53 +02:00
Use admin home dir for storing the calibre library
This commit is contained in:
parent
3ef20fcbe0
commit
e3777a81dc
3 changed files with 10 additions and 5 deletions
|
@ -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:
|
||||
|
|
|
@ -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
|
||||
|
||||
|
|
|
@ -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)
|
||||
|
|
Loading…
Add table
Reference in a new issue