install.sh 1.6 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #/*************************************************
  2. #* install.sh write by echo at Changsha. Hunan, 2021年 05月 24日 星期一 11:33:25 CST
  3. #*************************************************/
  4. #!/bin/sh
  5. function echo_dbg_p(){
  6. echo "echo_dbg, $@"
  7. }
  8. function usage(){
  9. echo -e "usages: $0 [H|h|help] [-h] [-s]
  10. [H|h|help]: check the usages\n
  11. []"
  12. }
  13. #main
  14. #maven install check
  15. cmd_package=yum
  16. if ! mvn -v >/dev/null;then
  17. sudo $cmd_package install -y maven
  18. fi
  19. #java install check
  20. if ! java -version &>/dev/null;then
  21. sudo $cmd_package install -y java
  22. fi
  23. if ! mysql -V>/dev/null;then
  24. sudo wget https://dev.mysql.com/get/mysql57-community-release-el7-9.noarch.rpm;
  25. sudo rpm -ivh mysql57-community-release-el7-9.noarch.rpm
  26. sudo yum install -y mysql-server
  27. fi
  28. #build path check
  29. #build_root_path=./
  30. settingDir=file-common/src/main/resources/conf/settings.xml
  31. mvn clean install -s $settingDir
  32. sed -i "s#D:/temp_db#/tmp/#g" release/conf/config/application-dev.properties
  33. echo_dbg_p "warning, PLS create mysql with name file, and set the password follow the file qiwen-file/file-web/src/main/resources/config/application-prod.properties"
  34. case $1 in
  35. H|h|help)
  36. usage
  37. ;;
  38. *)
  39. # getopts :s:h表示这个命令接受2个带参数选项,分别是-h和-s
  40. while getopts :s:h opt
  41. do
  42. case $opt in
  43. s)
  44. echo "-s=$OPTARG"
  45. ;;
  46. :)
  47. echo "-$OPTARG needs an argument"
  48. ;;
  49. h)
  50. echo "-h is set"
  51. ;;
  52. *)
  53. echo "-$opt not recognized"
  54. ;;
  55. esac
  56. done
  57. ;;
  58. esac