1
0
Fork 0
mirror of https://github.com/YunoHost-Apps/nodered_ynh.git synced 2024-09-03 19:46:25 +02:00

Improve upgrade with ">>" flows file

This commit is contained in:
tituspijean 2021-12-16 11:49:03 +01:00 committed by GitHub
parent 48ac205c8b
commit 53d1e2e236
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -87,9 +87,14 @@ fi
# Flows were stored in file named after the hostname. # Flows were stored in file named after the hostname.
# Not very portable. Let's fix that. # Not very portable. Let's fix that.
if [ ! -f "$final_path/data/flows.json" ]; then if [[ ! -f "$final_path/data/flows.json" && -f "$final_path/data/flows_$(hostname).json" ]]; then
mv "$final_path/data/flows_$(hostname)_cred.json" "$final_path/data/flows_cred.json" mv "$final_path/data/flows_$(hostname)_cred.json" "$final_path/data/flows_cred.json"
mv "$final_path/data/flows_$(hostname).json" "$final_path/data/flows.json" mv "$final_path/data/flows_$(hostname).json" "$final_path/data/flows.json"
# Flows could be stored in a file named '>>'.
# Definitely weird, let's fix that.
elif [[ ! -f "$final_path/data/flows.json" && -f "$final_path/data/>>" ]]; then
mv "$final_path/data/>>_cred" "$final_path/data/flows_cred.json"
mv "$final_path/data/>>" "$final_path/data/flows.json"
fi fi
#================================================= #=================================================