_common.sh 2.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768
  1. #!/bin/bash
  2. #=================================================
  3. # COMMON VARIABLES
  4. #=================================================
  5. ## new filenames starting 0.00~ynh5
  6. # make a filename/service name from domain/path
  7. if [[ "$path" == /* ]]; then
  8. url_path="${path:1}"
  9. fi
  10. if [[ "__${url_path}__" == '____' ]]; then
  11. flohmarkt_filename="$domain"
  12. else
  13. flohmarkt_filename="$domain-${url_path}"
  14. fi
  15. # this filename is used for logfile name and systemd.service name
  16. # and for symlinking install_dir and data_dir
  17. flohmarkt_filename="${YNH_APP_ID}_${flohmarkt_filename//[^A-Za-z0-9._-]/_}"
  18. # directory flohmarkts software is installed to
  19. # contains ./venv and ./src as sub-directories
  20. flohmarkt_install="$install_dir"
  21. flohmarkt_sym_install="$( dirname $flohmarkt_install )/$flohmarkt_filename"
  22. flohmarkt_venv_dir="${flohmarkt_install}/venv"
  23. flohmarkt_app_dir="${flohmarkt_install}/app"
  24. # directory containing logfiles
  25. flohmarkt_log_dir="/var/log/${YNH_APP_ID}/${flohmarkt_filename}"
  26. # filename for logfiles - ¡ojo! if not ends with .log will be interpreted
  27. # as a directory by ynh_use_logrotate
  28. # https://github.com/YunoHost/issues/issues/2383
  29. flohmarkt_logfile="${flohmarkt_log_dir}/${app}.log"
  30. # flohmarkt data_dir
  31. flohmarkt_data_dir="$data_dir"
  32. flohmarkt_sym_data_dir="$( dirname $flohmarkt_data_dir )/$flohmarkt_filename"
  33. ## old filenames before 0.00~ynh5 - for reference and needed to
  34. # migrate (see below)
  35. flohmarkt_old_install="$install_dir/$app/"
  36. flohmarkt_old_venv_dir="$install_dir/venv"
  37. flohmarkt_old_log_dir="/var/log/$app/"
  38. flohmarkt_old_logfile="$app"
  39. flohmarkt_old_service="$app"
  40. #=================================================
  41. # PERSONAL HELPERS
  42. #=================================================
  43. # move files and directories to their new places
  44. flohmarkt_ynh_upgrade_path_ynh5() {
  45. # flohmarkt and couchdb are already stopped in upgrade script
  46. # move install_dir
  47. # move venv_dir
  48. # move data_dir
  49. # move systemd.service
  50. # move logfiles
  51. # update settings for above
  52. false
  53. # there's still some work open - see above
  54. }
  55. #=================================================
  56. # EXPERIMENTAL HELPERS
  57. #=================================================
  58. #=================================================
  59. # FUTURE OFFICIAL HELPERS
  60. #=================================================