diff --git a/scripts/upgrade b/scripts/upgrade index b8f752c..26db1a8 100644 --- a/scripts/upgrade +++ b/scripts/upgrade @@ -43,7 +43,7 @@ upgrade_type=$(ynh_check_app_version_changed) #================================================= # ENSURE DOWNWARD COMPATIBILITY #================================================= -ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 +#ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # # N.B. : the followings setting migrations snippets are provided as *EXAMPLES* @@ -57,15 +57,6 @@ ynh_script_progression --message="Ensuring downward compatibility..." --weight=1 # ynh_app_setting_set --app=$app --key=db_name --value=$db_name #fi -# If final_path doesn't exist, create it -#if [ -z "$final_path" ]; then -# final_path=/var/www/$app -# ynh_app_setting_set --app=$app --key=final_path --value=$final_path -#fi - -### If nobody installed your app before 4.1, -### then you may safely remove these lines - #================================================= # BACKUP BEFORE UPGRADE THEN ACTIVE TRAP #================================================= @@ -93,8 +84,6 @@ ynh_systemd_action --service_name=$app --action="stop" # DOWNLOAD, CHECK AND UNPACK SOURCE #================================================= -# siwi: to be checked - if [ "$upgrade_type" == "UPGRADE_APP" ] then myynh_install @@ -137,7 +126,6 @@ ynh_add_systemd_config --others_var="conf_file start_file" # substitute __CO #================================================= # MODIFY A CONFIG FILE #================================================= -#siwi : to be checked ### Verify the checksum of a file, stored by `ynh_store_file_checksum` in the install script. ### And create a backup of this file if the checksum is different. So the file will be backed up if the admin had modified it. @@ -145,16 +133,16 @@ ynh_backup_if_checksum_is_different --file="$conf_file" cp ../conf/app.conf "$conf_file" -#if [ -n "$(uname -m | grep arm)" ]; # check CPU (raspberry is armxx) -# then -# cat ../conf/raspberry.conf >> "$conf_file" -#fi ynh_replace_string --match_string="__PORT__" --replace_string=$port --target_file="$conf_file" ynh_replace_string --match_string="__MEDIADIR__" --replace_string=$media_dir --target_file="$conf_file" ynh_replace_string --match_string="__CACHE_DIR__" --replace_string=$work_dir/cache --target_file="$conf_file" ynh_replace_string --match_string="__DATA_DIR__" --replace_string=$work_dir/data --target_file="$conf_file" +#================================================= +# STORE THE CONFIG FILE CHECKSUM +#================================================= + # Recalculate and store the checksum of the file for the next upgrade. ynh_store_file_checksum --file="$conf_file" @@ -163,10 +151,11 @@ ynh_store_file_checksum --file="$conf_file" #================================================= # SECURE FILES AND DIRECTORIES #================================================= -# siwi : to be checked +# siwi okay -# Set permissions on app files +# user mopidy needs permission to mkdir on final_path chown -R root: $final_path +chown $app: $final_path #================================================= # INTEGRATE SERVICE IN YUNOHOST @@ -174,6 +163,7 @@ chown -R root: $final_path ynh_script_progression --message="Integrating service in YunoHost..." --weight=1 yunohost service add $app --log_type systemd --description "this is mopidy, a music server" + #================================================= # START SYSTEMD SERVICE #================================================= @@ -184,14 +174,14 @@ ynh_systemd_action --service_name=$app --action="start" #================================================= # RELOAD NGINX #================================================= -ynh_script_progression --message="Reloading NGINX web server..." --weight=1 +ynh_script_progression --message="Reloading NGINX web server..." ynh_systemd_action --service_name=nginx --action=reload #================================================= # PROVIDE ADDITIONAL SHELL COMAND #================================================= -ynh_script_progression --message="Provide additional shell comand..." --weight=1 +ynh_script_progression --message="Provide additional shell comand..." cp -a ../sources/extra_files/mopidyctl "$cmd_file" ynh_replace_string --match_string="__APP__" --replace_string=$app --target_file="$cmd_file" @@ -200,13 +190,6 @@ ynh_replace_string --match_string="__CONF_FILE__" --replace_string=$conf_file chmod +x "$cmd_file" -#================================================= -# SCAN LOCAL MEDIA DIRECTORY -#================================================= -ynh_script_progression --message="Scan local media directory..." --weight=3 - -"$cmd_file" local scan - #================================================= # END OF SCRIPT #=================================================