mirror of
https://github.com/YunoHost-Apps/funkwhale_ynh.git
synced 2024-09-03 18:36:24 +02:00
fix data_dir
This commit is contained in:
parent
4ead0c52f9
commit
a06c41db73
4 changed files with 25 additions and 23 deletions
|
@ -62,9 +62,10 @@ ram.runtime = "50M"
|
||||||
[resources.system_user]
|
[resources.system_user]
|
||||||
|
|
||||||
[resources.install_dir]
|
[resources.install_dir]
|
||||||
owner = "__APP__:www-data"
|
|
||||||
|
|
||||||
[resources.data_dir]
|
[resources.data_dir]
|
||||||
|
dir = "/home/yunohost.app/__APP__/data/"
|
||||||
|
owner = "__APP__:www-data"
|
||||||
|
|
||||||
[resources.permissions]
|
[resources.permissions]
|
||||||
main.url = "/"
|
main.url = "/"
|
||||||
|
|
|
@ -45,12 +45,12 @@ ynh_add_nginx_config
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Creating a data directory..." --weight=1
|
ynh_script_progression --message="Creating a data directory..." --weight=1
|
||||||
|
|
||||||
mkdir -p $data_dir/data
|
mkdir -p $data_dir/
|
||||||
mkdir -p $data_dir/data/{static,media,music}
|
mkdir -p $data_dir/{static,media,music}
|
||||||
|
|
||||||
chmod 750 "$data_dir/data/"
|
chmod 750 "$data_dir/"
|
||||||
chmod -R o-rwx "$data_dir/data/"
|
chmod -R o-rwx "$data_dir/"
|
||||||
chown -R $app:www-data "$data_dir/data/"
|
chown -R $app:www-data "$data_dir/"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# ADD A CONFIGURATION
|
# ADD A CONFIGURATION
|
||||||
|
|
|
@ -25,13 +25,13 @@ chown -R $app:www-data "$install_dir"
|
||||||
#=================================================
|
#=================================================
|
||||||
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
ynh_script_progression --message="Restoring the data directory..." --weight=1
|
||||||
|
|
||||||
ynh_restore_file --origin_path="$data_dir/data/" --not_mandatory
|
ynh_restore_file --origin_path="$data_dir/" --not_mandatory
|
||||||
|
|
||||||
mkdir -p $data_dir/data/{static,media,music}
|
mkdir -p $data_dir/{static,media,music}
|
||||||
|
|
||||||
chmod 750 "$data_dir/data/"
|
chmod 750 "$data_dir/"
|
||||||
chmod -R o-rwx "$data_dir/data/"
|
chmod -R o-rwx "$data_dir/"
|
||||||
chown -R $app:www-data "$data_dir/data/"
|
chown -R $app:www-data "$data_dir/"
|
||||||
|
|
||||||
#=================================================
|
#=================================================
|
||||||
# RESTORE THE NGINX CONFIGURATION
|
# RESTORE THE NGINX CONFIGURATION
|
||||||
|
|
|
@ -31,18 +31,19 @@ ynh_systemd_action --action="stop" --service_name="${app}-worker" --log_path="sy
|
||||||
#=================================================
|
#=================================================
|
||||||
|
|
||||||
# If data_dir doesn't exist, create it
|
# If data_dir doesn't exist, create it
|
||||||
if [ -z "$data_dir/data/" ]; then
|
if [ -z "$data_dir/" ]; then
|
||||||
# Do a full backup before moving datas
|
# Do a full backup before moving datas
|
||||||
yunohost backup create --apps $app
|
yunohost backup create --apps $app
|
||||||
|
|
||||||
|
data_dir="/home/yunohost.app/${app}/data"
|
||||||
ynh_script_progression --message="Moving datas to $data_dir..." --weight=1
|
ynh_script_progression --message="Moving datas to $data_dir..." --weight=1
|
||||||
|
|
||||||
mkdir -p /home/yunohost.app/${app}/data
|
mkdir -p $data_dir
|
||||||
mkdir -p /home/yunohost.app/${app}/data/{static,media,music}
|
mkdir -p $data_dir/{static,media,music}
|
||||||
|
|
||||||
chmod 750 "/home/yunohost.app/${app}/data"
|
chmod 750 "$data_dir"
|
||||||
chmod -R o-rwx "/home/yunohost.app/${app}/data"
|
chmod -R o-rwx "$data_dir"
|
||||||
chown -R $app:www-data "/home/yunohost.app/${app}/data"
|
chown -R $app:www-data "$data_dir"
|
||||||
|
|
||||||
ynh_backup_if_checksum_is_different --file="$install_dir/code/config/.env"
|
ynh_backup_if_checksum_is_different --file="$install_dir/code/config/.env"
|
||||||
mkdir -p $install_dir/config
|
mkdir -p $install_dir/config
|
||||||
|
@ -52,19 +53,19 @@ if [ -z "$data_dir/data/" ]; then
|
||||||
ynh_delete_file_checksum --file="$install_dir/code/config/.env"
|
ynh_delete_file_checksum --file="$install_dir/code/config/.env"
|
||||||
|
|
||||||
if [ -d "$install_dir/code/data/static/" ]; then
|
if [ -d "$install_dir/code/data/static/" ]; then
|
||||||
rsync -a $install_dir/code/data/static/ "/home/yunohost.app/${app}/data/static/"
|
rsync -a $install_dir/code/data/static/ $data_dir/static/
|
||||||
fi
|
fi
|
||||||
if [ -d "$install_dir/media/" ]; then
|
if [ -d "$install_dir/media/" ]; then
|
||||||
rsync -a $install_dir/media/ "/home/yunohost.app/${app}/data/media/"
|
rsync -a $install_dir/media/ $data_dir/media/
|
||||||
fi
|
fi
|
||||||
if [ -d "$install_dir/code/data/media/" ]; then
|
if [ -d "$install_dir/code/data/media/" ]; then
|
||||||
rsync -a $install_dir/code/data/media/ "/home/yunohost.app/${app}/data/media/"
|
rsync -a $install_dir/code/data/media/ $data_dir/media/
|
||||||
fi
|
fi
|
||||||
if [ -d "$install_dir/import/" ]; then
|
if [ -d "$install_dir/import/" ]; then
|
||||||
rsync -a $install_dir/import/ "/home/yunohost.app/${app}/data/music/"
|
rsync -a $install_dir/import/ $data_dir/music/
|
||||||
fi
|
fi
|
||||||
if [ -d "$install_dir/code/data/music/" ]; then
|
if [ -d "$install_dir/code/data/music/" ]; then
|
||||||
rsync -a $install_dir/code/data/music/ "/home/yunohost.app/${app}/data/music/"
|
rsync -a $install_dir/code/data/music/ $data_dir/music/
|
||||||
fi
|
fi
|
||||||
|
|
||||||
ynh_secure_remove --file="$install_dir/code"
|
ynh_secure_remove --file="$install_dir/code"
|
||||||
|
|
Loading…
Reference in a new issue