change_url 1.8 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950
  1. #!/bin/bash
  2. ## this script is only run if actual change to domain/path is detected, if you're here either $domain or $path changed
  3. ## new location is available via $domain and $path (or $new_domain and $new_path variables if you want to be explicit)
  4. ## old values are available via, you guessed it, $old_domain and $old_path
  5. #=================================================
  6. # IMPORT GENERIC HELPERS
  7. #=================================================
  8. source _common.sh
  9. source /usr/share/yunohost/helpers
  10. #=================================================
  11. # STOP SYSTEMD SERVICE
  12. #=================================================
  13. ynh_script_progression "Stopping $app's systemd service..."
  14. ynh_systemctl --service="$app" --action="stop"
  15. #=================================================
  16. # MODIFY URL IN NGINX CONF
  17. #=================================================
  18. ynh_script_progression "Updating NGINX web server configuration..."
  19. # this will most likely adjust NGINX config correctly
  20. ynh_config_change_url_nginx
  21. #=================================================
  22. # SPECIFIC MODIFICATIONS
  23. #=================================================
  24. ## do any changes to files that reference specific installation domain/path, i.e. regenerate configs etc
  25. ynh_config_add --template=".env" --destination="$install_dir/.env"
  26. chmod 400 "$install_dir/.env"
  27. chown "$app:$app" "$install_dir/.env"
  28. #=================================================
  29. # START SYSTEMD SERVICE
  30. #=================================================
  31. ynh_script_progression "Starting $app's systemd service..."
  32. ynh_systemctl --service="$app" --action="start" --wait_until="No requirements found in frontmatter"
  33. #=================================================
  34. # END OF SCRIPT
  35. #=================================================
  36. ynh_script_progression "Change of URL completed for $app"