Ein für Shopware 6 vorbereitet Systemmanagment.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

97 lines
3.1 KiB

2 years ago
  1. #!/bin/bash
  2. ### DO NOT EDIT THIS FILE
  3. source "$(dirname "${BASH_SOURCE[0]}")/../includes/includes.sh"
  4. app_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." &> /dev/null && pwd)
  5. source "$app_dir/etc/config.sh"
  6. updatemode=0
  7. echo
  8. echoMainTitle "Shopware installer/updater"
  9. path="$app_dir/git/$project_name$git_shopware_path"
  10. if [ -f "$path/install.lock" ]
  11. then
  12. updatemode=1
  13. echo "Update mode"
  14. else
  15. echo "Install mode"
  16. fi
  17. if [ "$updatemode" == "0" ]
  18. then
  19. echo
  20. echoSequenzeTitle "Wich database to use?"
  21. echo
  22. echoSelect "[live] " "Local live database"
  23. echoSelect "[stage]" "Local stage database"
  24. echo
  25. env=$(readConsole "Select: " "Invalid selection" "live stage")
  26. fi
  27. ### Fetch sources
  28. echo
  29. echo "Fetch sources ..."
  30. wget -q --show-progress -O "$app_dir/var/tmp/sdp.html" "https://www.shopware.com/de/download/"
  31. if [ "$updatemode" == "0" ]
  32. then
  33. download_url=$(grep -Po '(?<=href=")https://releases.shopware.com/sw6/install_[^"]*' "$app_dir/var/tmp/sdp.html")
  34. filename="shopware_install.zip"
  35. else
  36. download_url=$(grep -Po '(?<=href=")https://releases.shopware.com/sw6/update_[^"]*' "$app_dir/var/tmp/sdp.html")
  37. filename="shopware_update.zip"
  38. fi
  39. wget -q --show-progress -O "$app_dir/var/tmp/$filename" "$download_url"
  40. echo "Install files ..."
  41. unzip -oqq "$app_dir/var/tmp/$filename" -d "$path"
  42. local_database_socket=$(eval "echo \"\$local_${env}_database_socket\"")
  43. local_database_host=$(eval "echo \"\$local_${env}_database_host\"")
  44. local_database_port=$(eval "echo \"\$local_${env}_database_port\"")
  45. local_database_name=$(eval "echo \"\$local_${env}_database_name\"")
  46. local_database_user=$(eval "echo \"\$local_${env}_database_user\"")
  47. local_database_password=$(eval "echo \"\$local_${env}_database_password\"")
  48. if [ "$local_database_socket" != "" ]
  49. then
  50. database_url="mysql:unix_socket=$local_database_socket;dbname=$local_database_name;user=$local_database_user;password=$local_database_password"
  51. else
  52. database_url="mysql://$local_database_user:$local_database_password@$local_database_host:$local_database_port/$local_database_name"
  53. fi
  54. export DATABASE_URL="$database_url"
  55. cwd=$(pwd)
  56. cd "$path"
  57. if [ "$updatemode" == "0" ]
  58. then
  59. echo "Setup Shopware ..."
  60. cp "$app_dir/etc/.env.local" "$path/.env"
  61. bin/console system:install --shop-name="$install_shopware_name" --shop-email="$install_shopware_email" \
  62. --shop-locale="$install_shopware_locale" --shop-currency="$install_shopware_currency" --no-interaction --env="dev"
  63. bin/console sales-channel:create:storefront --name="$install_shopware_storefront_name" --url="$install_install_shopware_storefront_url" --no-interaction --quiet
  64. bin/console user:create -a --firstName="$local_shopware_user" --lastName="$local_shopware_firstname" --email="$local_shopware_email" "$local_shopware_user"
  65. else
  66. echo "Prepare Shopware setup ..."
  67. bin/console --quiet --no-interaction --env="dev" system:update:prepare
  68. "$path/public/recovery/update/index.php"
  69. fi
  70. cd "$cwd"
  71. postScript "$app_dir/bin/postscripts/install_shopware.sh"
  72. rm "$app_dir/var/tmp/sdp.html"
  73. rm "$app_dir/var/tmp/$filename"