diff --git a/manifest.json b/manifest.json index 1b2f0f6..34db662 100644 --- a/manifest.json +++ b/manifest.json @@ -14,7 +14,7 @@ "email": "liberodark@gmail.com" }, "requirements": { - "yunohost": ">= 4.1.7" + "yunohost": ">= 4.2.4" }, "multi_instance": false, "services": [ diff --git a/scripts/install b/scripts/install index f3c99bf..fc6bc90 100644 --- a/scripts/install +++ b/scripts/install @@ -81,6 +81,11 @@ ynh_app_setting_set --app=$app --key=final_path --value=$final_path # Download, check integrity, uncompress and patch the source from app.src ynh_setup_source --dest_dir="$final_path" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" +chmod +x $final_path/streama.jar + #================================================= # NGINX CONFIGURATION #================================================= @@ -105,7 +110,8 @@ ynh_add_systemd_config # Set permissions to app files mkdir -p $final_path/data/streama ln -s $final_path/data/streama /home/yunohost.app/streama -cp "../conf/convert.sh" /usr/bin/convert_movies +ynh_add_config --template="../conf/convert.sh" --destination="/usr/bin/convert_movies/convert.sh" +chmod +x "/usr/bin/convert_movies" #================================================= # GENERIC FINALIZATION diff --git a/scripts/restore b/scripts/restore index 34e3457..ea11593 100644 --- a/scripts/restore +++ b/scripts/restore @@ -63,6 +63,10 @@ ynh_script_progression --message="Restoring Streama main directory..." --weight= ynh_restore_file --origin_path="$final_path" +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" + #================================================= # INSTALL DEPENDENCIES #================================================= diff --git a/scripts/upgrade b/scripts/upgrade index 7a45d61..283fbed 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -28,17 +28,6 @@ port=$(ynh_app_setting_get --app=$app --key=port) upgrade_type=$(ynh_check_app_version_changed) -#================================================= -# ENSURE DOWNWARD COMPATIBILITY -#================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 - -# Cleaning legacy permissions -if ynh_legacy_permissions_exists; then - ynh_legacy_permissions_delete_all - - ynh_app_setting_delete --app=$app --key=is_public -fi #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -53,6 +42,18 @@ ynh_clean_setup () { # Exit if an error occurs during the execution of the script ynh_abort_if_errors +#================================================= +# ENSURE DOWNWARD COMPATIBILITY +#================================================= +ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 + +# Cleaning legacy permissions +if ynh_legacy_permissions_exists; then + ynh_legacy_permissions_delete_all + + ynh_app_setting_delete --app=$app --key=is_public +fi + #================================================= # STANDARD UPGRADE STEPS #================================================= @@ -73,11 +74,19 @@ ynh_system_user_create --username=$app --home_dir="$final_path" #================================================= # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -ynh_script_progression --message="Setting up source files..." --weight=3 -ynh_app_setting_set --app=$app --key=final_path --value=$final_path -# Download, check integrity, uncompress and patch the source from app.src -ynh_setup_source --dest_dir="$final_path" +if [ "$upgrade_type" == "UPGRADE_APP" ] +then + ynh_script_progression --message="Upgrading source files..." --weight=1 + + # Download, check integrity, uncompress and patch the source from app.src + ynh_setup_source --dest_dir="$final_path" +fi + +chmod 750 "$final_path" +chmod -R o-rwx "$final_path" +chown -R $app:www-data "$final_path" +chmod +x $final_path/streama.jar #================================================= # NGINX CONFIGURATION @@ -109,17 +118,8 @@ ynh_add_systemd_config # Set permissions to app files mkdir -p $final_path/data/streama -cp -a "../conf/convert.sh" /usr/bin/convert_movies - -#================================================= -# GENERIC FINALIZATION -#================================================= -# SECURE FILES AND DIRECTORIES -#================================================= - -chown -R $app: $final_path -chmod +x /usr/bin/convert_movies -chmod +x $final_path/streama.jar +ynh_add_config --template="../conf/convert.sh" --destination="/usr/bin/convert_movies/convert.sh" +chmod +x "/usr/bin/convert_movies" #================================================= # INTEGRATE SERVICE IN YUNOHOST