mirror of
https://github.com/YunoHost-Apps/seafile_ynh.git
synced 2024-09-03 20:26:01 +02:00
Improve data dir management and use find to optimize permission set
This commit is contained in:
parent
2139b5d744
commit
cf66fcf714
5 changed files with 17 additions and 8 deletions
|
@ -22,7 +22,7 @@ This app use now the core-only feature of the backup. To keep the integrity of t
|
||||||
|
|
||||||
`yunohost backup create --app seafile`
|
`yunohost backup create --app seafile`
|
||||||
|
|
||||||
- Do a backup of your data with your specific strategy (could be with rsync, borg backup or just cp). The data is stored in `/home/yunohost.app/seafile-data`.
|
- Do a backup of your data with your specific strategy (could be with rsync, borg backup or just cp). The data is stored in `/home/yunohost.app/seafile`.
|
||||||
- Restart the seafile service with theses command:
|
- Restart the seafile service with theses command:
|
||||||
|
|
||||||
`systemctl start seafile.service seahub.service`
|
`systemctl start seafile.service seahub.service`
|
||||||
|
|
|
@ -71,7 +71,7 @@ ram.runtime = "500M"
|
||||||
subdirs = ["installed", "logs"]
|
subdirs = ["installed", "logs"]
|
||||||
|
|
||||||
[resources.data_dir]
|
[resources.data_dir]
|
||||||
dir = "/home/yunohost.app/seafile-data"
|
dir = "/home/yunohost.app/__APP__"
|
||||||
|
|
||||||
[resources.permissions]
|
[resources.permissions]
|
||||||
main.url = "/"
|
main.url = "/"
|
||||||
|
|
|
@ -75,11 +75,11 @@ set_permission() {
|
||||||
test -e $install_dir/seafile-server-latest/seahub/media && setfacl -R -m user:www-data:rX $install_dir/seafile-server-latest/seahub/media
|
test -e $install_dir/seafile-server-latest/seahub/media && setfacl -R -m user:www-data:rX $install_dir/seafile-server-latest/seahub/media
|
||||||
test -e $install_dir/seahub-data && setfacl -R -m user:www-data:rX $install_dir/seahub-data
|
test -e $install_dir/seahub-data && setfacl -R -m user:www-data:rX $install_dir/seahub-data
|
||||||
|
|
||||||
# We also check at the install time when data directory is not already initialised
|
find $data_dir \( \! -perm -o= \
|
||||||
if [ -e /home/yunohost.app/seafile-data ]; then
|
-o \! -user $YNH_APP_ID \
|
||||||
chown -R $YNH_APP_ID /home/yunohost.app/seafile-data
|
-o \! -group $YNH_APP_ID \) \
|
||||||
chmod -R o= /home/yunohost.app/seafile-data
|
-exec chown $YNH_APP_ID:$YNH_APP_ID {} \; \
|
||||||
fi
|
-exec chmod o= {} \;
|
||||||
}
|
}
|
||||||
|
|
||||||
clean_url_in_db_config() {
|
clean_url_in_db_config() {
|
||||||
|
|
|
@ -26,7 +26,7 @@ fi
|
||||||
ynh_print_info --message="Backing up code..."
|
ynh_print_info --message="Backing up code..."
|
||||||
ynh_backup --src_path $install_dir
|
ynh_backup --src_path $install_dir
|
||||||
ynh_print_info --message="Backing up user data..."
|
ynh_print_info --message="Backing up user data..."
|
||||||
ynh_backup --src_path=/home/yunohost.app/seafile-data --dest_path="data" --is_big=1
|
ynh_backup --src_path=$data_dir --dest_path="data" --is_big=1
|
||||||
ynh_print_info --message="Backing up configuration..."
|
ynh_print_info --message="Backing up configuration..."
|
||||||
ynh_backup --src_path /etc/nginx/conf.d/$domain.d/${app}.conf
|
ynh_backup --src_path /etc/nginx/conf.d/$domain.d/${app}.conf
|
||||||
ynh_backup --src_path /etc/systemd/system/seafile.service
|
ynh_backup --src_path /etc/systemd/system/seafile.service
|
||||||
|
|
|
@ -64,6 +64,15 @@ if [ -z ${seahub_secret_key:-} ]; then
|
||||||
ynh_app_setting_set --app $app --key seahub_secret_key --value $seahub_secret_key
|
ynh_app_setting_set --app $app --key seahub_secret_key --value $seahub_secret_key
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
# Update data dir if needed
|
||||||
|
if [ $(readlink $install_dir/seafile-data) == '/home/yunohost.app/seafile-data' ]; then
|
||||||
|
rm $install_dir/seafile-data
|
||||||
|
ln -s $data_dir $install_dir/seafile-data
|
||||||
|
fi
|
||||||
|
if [ -e /home/yunohost.app/seafile-data ]; then
|
||||||
|
mv /home/yunohost.app/seafile-data $data_dir
|
||||||
|
fi
|
||||||
|
|
||||||
ynh_script_progression --message="Upgrading source files..." --weight=6
|
ynh_script_progression --message="Upgrading source files..." --weight=6
|
||||||
|
|
||||||
# Download new version from sources
|
# Download new version from sources
|
||||||
|
|
Loading…
Reference in a new issue