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.

99 lines
2.2 KiB

2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
  1. #!/bin/bash
  2. set -e
  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. echo
  7. echoMainTitle "What do you want to do today?"
  8. echo
  9. echoSelect "[1]" "Databaseupdate"
  10. echoSelect "[2]" "Fetching Files"
  11. echo
  12. main_selection=$(readConsole "Select: " "Invalid selection" "1 2")
  13. words=(
  14. 'databaseupdate'
  15. 'files'
  16. )
  17. for i in "${!words[@]}"
  18. do
  19. ((cur=i+1))
  20. if [ $cur == "$main_selection" ]
  21. then
  22. main_selection=${words[$i]}
  23. fi
  24. done
  25. echo $main_selection
  26. if [ "$main_selection" == "databaseupdate" ]
  27. then
  28. echo
  29. echoSubTitle "Databaseupdate"
  30. echo
  31. echo "From Environment:"
  32. echo
  33. echoSelect "[live] " "Live"
  34. echoSelect "[stage] " "Stage"
  35. echo
  36. env=$(readConsole "Select: " "Invalid selection" "live stage")
  37. echo
  38. confirm=$(readConsole "You want to copy the database from $env to local ($env)? [y,n]: " "Invalid selection" "y n")
  39. if [ "$confirm" == "y" ]
  40. then
  41. source "$app_dir/bin/commands/import_db.sh" "$env"
  42. else
  43. echo "Aborted"
  44. fi
  45. fi
  46. if [ "$main_selection" == "files" ]
  47. then
  48. echo
  49. echoSubTitle "Fetching Files"
  50. echo
  51. echo "From Environment:"
  52. echo
  53. echoSelect "[live] " "Live"
  54. echoSelect "[stage] " "Stage"
  55. env=$(readConsole "Select: " "Invalid selection" "live stage")
  56. echoSubTitle "Select a directory:"
  57. echo
  58. echoSelect "[1] " "/files"
  59. echoSelect "[2] " "/public/media"
  60. echoSelect "[3] " ".. custom .."
  61. files_selection=$(readConsole "Select: " "Invalid selection" "1 2 3")
  62. values=(
  63. "/files"
  64. "/public/media"
  65. )
  66. if [ "$files_selection" -gt "${#values[@]}" ]
  67. then
  68. files_selection=$(readConsole "Please give a subpath to the shopware root on $env: ", "Invalid selection", true)
  69. else
  70. for i in "${!values[@]}"
  71. do
  72. ((cur=i+1))
  73. if [ "$cur" == "$files_selection" ]
  74. then
  75. files_selection="${values[$i]}"
  76. fi
  77. done
  78. fi
  79. echo
  80. confirm=$(readConsole "You want to copy the /files from $env to local ($env)? [y,n]: " "Invalid selection" "y n")
  81. if [ "$confirm" == "y" ]
  82. then
  83. source "$app_dir/bin/commands/import_media.sh" "$env" "$files_selection"
  84. else
  85. echo "Aborted"
  86. fi
  87. fi