diff --git a/conf/couchpotato.conf b/conf/couchpotato.conf index a61f33e..1947858 100644 --- a/conf/couchpotato.conf +++ b/conf/couchpotato.conf @@ -4,7 +4,7 @@ username = ssl_key = proxy_server = ssl_cert = -data_dir = __APP_DATA_DIR__ +data_dir = __DATADIR__ use_proxy = 0 permission_file = 0755 proxy_password = diff --git a/conf/systemd.service b/conf/systemd.service index f33eefd..c9c657e 100644 --- a/conf/systemd.service +++ b/conf/systemd.service @@ -7,7 +7,7 @@ Type=simple User=__APP__ Group=__APP__ WorkingDirectory=__FINALPATH__/ -ExecStart=/opt/pyenv/versions/__PYTHON_VERSION__/bin/python __FINALPATH__/CouchPotato.py --quiet --pid_file=/var/run/__APP__/__APP__.pid --data_dir=__APP_DATA_DIR__ --config_file=__FINALPATH__/settings.conf +ExecStart=/opt/pyenv/versions/__PYTHON_VERSION__/bin/python __FINALPATH__/CouchPotato.py --quiet --pid_file=/var/run/__APP__/__APP__.pid --data_dir=__DATADIR__ --config_file=__FINALPATH__/settings.conf [Install] diff --git a/scripts/backup b/scripts/backup index e495c37..67278fd 100644 --- a/scripts/backup +++ b/scripts/backup @@ -29,7 +29,7 @@ app=$YNH_APP_INSTANCE_NAME final_path=$(ynh_app_setting_get --app=$app --key=final_path) domain=$(ynh_app_setting_get --app=$app --key=domain) -app_data_dir=$(ynh_app_setting_get --app=$app --key=app_data_dir) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # DECLARE DATA AND CONF FILES TO BACKUP @@ -42,6 +42,12 @@ ynh_print_info --message="Declaring files to be backed up..." ynh_backup --src_path="$final_path" +#================================================= +# BACKUP THE DATA DIR +#================================================= + +ynh_backup --src_path="$datadir" --is_big + #================================================= # BACKUP THE NGINX CONFIGURATION #================================================= @@ -62,13 +68,6 @@ ynh_backup --src_path="/etc/logrotate.d/$app" ynh_backup --src_path="/etc/systemd/system/$app.service" -#================================================= -# BACKUP VARIOUS FILES -#================================================= - -# Backup data -ynh_backup --src_path="$app_data_dir" --is_big - #================================================= # END OF SCRIPT #================================================= diff --git a/scripts/install b/scripts/install index 7e5621a..3c3df11 100644 --- a/scripts/install +++ b/scripts/install @@ -37,8 +37,6 @@ ynh_script_progression --message="Validating installation parameters..." final_path=/opt/yunohost/$app test ! -e "$final_path" || ynh_die --message="This path already contains a folder" -app_data_dir=/home/yunohost.app/$app - # Register (book) web path ynh_webpath_register --app=$app --domain=$domain --path_url=$path_url @@ -49,7 +47,6 @@ ynh_script_progression --message="Storing installation settings..." ynh_app_setting_set --app=$app --key=domain --value=$domain ynh_app_setting_set --app=$app --key=path --value=$path_url -ynh_app_setting_set --app=$app --key=app_data_dir --value=$app_data_dir #================================================= # STANDARD MODIFICATIONS @@ -109,15 +106,16 @@ ynh_add_nginx_config #================================================= # SPECIFIC SETUP #================================================= -# MAKE DATA DIRECTORY +# CREATE DATA DIRECTORY #================================================= -ynh_script_progression --message="Make data directory..." +ynh_script_progression --message="Creating a data directory..." -# Make directories -mkdir -p "$app_data_dir" -chmod 750 "$app_data_dir" -chmod -R o-rwx "$app_data_dir" -chown -R $app:$app "$app_data_dir" +datadir=/home/yunohost.app/$app +mkdir -p $datadir + +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:$app "$datadir" #================================================= # BUILD COUCHPOTATO diff --git a/scripts/remove b/scripts/remove index 6232ebf..de15ca9 100644 --- a/scripts/remove +++ b/scripts/remove @@ -20,7 +20,6 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) port=$(ynh_app_setting_get --app=$app --key=port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -app_data_dir=$(ynh_app_setting_get --app=$app --key=app_data_dir) #================================================= # STANDARD REMOVE diff --git a/scripts/restore b/scripts/restore index d2af860..ba302be 100644 --- a/scripts/restore +++ b/scripts/restore @@ -31,7 +31,7 @@ app=$YNH_APP_INSTANCE_NAME domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -app_data_dir=$(ynh_app_setting_get --app=$app --key=app_data_dir) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK IF THE APP CAN BE RESTORED @@ -71,6 +71,19 @@ chmod 750 "$final_path" chmod -R o-rwx "$final_path" chown -R $app:$app "$final_path" +#================================================= +# RESTORE THE DATA DIRECTORY +#================================================= +ynh_script_progression --message="Restoring the data directory..." + +ynh_restore_file --origin_path="$datadir" --not_mandatory + +mkdir -p $datadir + +chmod 750 "$datadir" +chmod -R o-rwx "$datadir" +chown -R $app:$app "$datadir" + #================================================= # SPECIFIC RESTORATION #================================================= @@ -94,18 +107,6 @@ pushd $final_path /opt/pyenv/versions/$app/bin/pip install cheetah popd -#================================================= -# RESTORE THE DATA DIRECTORY -#================================================= -ynh_script_progression --message="Restoring the data directory..." - -ynh_restore_file --origin_path="$app_data_dir" --not_mandatory - -mkdir -p "$app_data_dir" -chmod 750 "$app_data_dir" -chmod -R o-rwx "$app_data_dir" -chown -R $app:$app "$app_data_dir" - #================================================= # INSTALL YUNOHOST MULTIMEDIA #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index e0871c6..7d16422 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -21,7 +21,7 @@ domain=$(ynh_app_setting_get --app=$app --key=domain) path_url=$(ynh_app_setting_get --app=$app --key=path) port=$(ynh_app_setting_get --app=$app --key=port) final_path=$(ynh_app_setting_get --app=$app --key=final_path) -app_data_dir=$(ynh_app_setting_get --app=$app --key=app_data_dir) +datadir=$(ynh_app_setting_get --app=$app --key=datadir) #================================================= # CHECK VERSION @@ -64,10 +64,10 @@ if [ -z "$final_path" ]; then ynh_app_setting_set --app=$app --key=final_path --value=$final_path fi -# If app_data_dir doesn't exist, create it -if [ -z "$app_data_dir" ]; then - app_data_dir=/home/yunohost.app/$app - ynh_app_setting_set --app=$app --key=app_data_dir --value=$app_data_dir +# If datadir doesn't exist, create it +if [ -z "$datadir" ]; then + datadir=/home/yunohost.app/$app + ynh_app_setting_set --app=$app --key=datadir --value=$datadir fi # Cleaning legacy permissions