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.

70 lines
1.5 KiB

1 year ago
  1. #!/bin/bash
  2. ### DO NOT EDIT THIS FILE
  3. source "$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." &> /dev/null && pwd)/etc/config"
  4. source "$(cd "$(dirname "${BASH_SOURCE[0]}")/../.." &> /dev/null && pwd)/etc/projects"
  5. function usage {
  6. echo
  7. echoMainTitle "Installs a plugin"
  8. echo
  9. echoSubTitle "Usage:"
  10. echo
  11. echo "install-plugin [shortname] [plugin]"
  12. echo
  13. echo "--help Prints this message"
  14. echo " "
  15. }
  16. help="$(getParameter "--help" false "$*")"
  17. if [ "$help" == true ] || [ "$1" == "" ]
  18. then
  19. usage
  20. exit
  21. fi
  22. shortname=$(getArgument "$1" "$(usage)" true)
  23. plugin=$(getArgument "$2" "$(usage)" true)
  24. customer=$(getCustomerFromShortname "$shortname")
  25. project=$(getProjectFromShortname "$shortname")
  26. project_dir="$project_manager_dir/data/$customer/$project"
  27. plugin_dir="$project_manager_dir/plugins/$plugin"
  28. if [ ! -d "$project_dir" ]
  29. then
  30. echo
  31. echoError "Could not find project dir"
  32. echo
  33. exit
  34. fi
  35. if [ ! -d "$plugin_dir" ]
  36. then
  37. echo
  38. echoError "Could not find plugin dir"
  39. echo
  40. exit
  41. fi
  42. echo
  43. echoMainTitle "Install plugin"
  44. if [ ! -d "$project_dir/etc/plugins/$plugin" ]
  45. then
  46. mkdir "$project_dir/etc/plugins/$plugin"
  47. fi
  48. etc_files=$(list "$plugin/etc")
  49. for etc_file in "${etc_files[@]}"
  50. do
  51. cp "$etc_file" "$project_dir/etc/plugins/$plugin/config"
  52. done
  53. echo
  54. echoSubTitle "Running postscripts ..."
  55. postScript "$project_manager_dir/bin/postscripts/commands/install-plugin"
  56. postScript "$project_dir/bin/postscripts/commands/install-plugin"
  57. echo
  58. echoSuccess "Plugin has been installed, please configure: $project_dir/etc/plugins/$plugin"
  59. echo