Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162
  1. #!/bin/bash
  2. # PB : TODO -- Prompt if not passed in.
  3. echo "Enter repo server URL:"
  4. read reposervername
  5. REPOSERVER=$reposervername
  6. echo "Enter default repo owner:"
  7. read defaultrepoownername
  8. DEFAULTREPOOWNER=$defaultrepoownername
  9. REPOOWNER=$DEFAULTREPOOWNER
  10. echo "Enter instance name"
  11. read instancename
  12. INSTANCENAME=$instancename
  13. echo "Enter instance type:"
  14. read instancetypename
  15. INSTANCETYPE=$instancetypename
  16. echo "Enter Git user name:"
  17. read GITUSERID
  18. GITUSER=$GITUSERID
  19. echo "Enter Git user email:"
  20. read GITEMAILID
  21. GITEMAIL=$GITEMAILID
  22. # If $GITUSER = {{"git user id"}} then set $GITUSER = $USER # TODO : pavanendar -- read from user input default as login user.
  23. #OPTIONS
  24. SKIPPREREQS=false
  25. SKIPDEVPREREQS=false
  26. if [ "$SKIPPREREQS" = "true" ]; then
  27. echo "skipping prereqs for firstrun"
  28. else
  29. sudo groupadd chessprod
  30. echo "$USER"
  31. sudo usermod -a -G chessprod $USER
  32. sudo apt update
  33. # Install prerequisites for dev environment
  34. sudo apt install git
  35. git config --global user.name "$GITUSER"
  36. git config --global user.email "$GITEMAIL"
  37. git config --global credential.helper store
  38. git clone $REPOSERVER/$REPOOWNER/bbhverse
  39. #git config --global credential.helper 'store --file ~/.git-credentials'
  40. #echo "Enter git username: "
  41. #read gitUser
  42. # git config --global user.name '${gitUser}'
  43. #echo "username=$gitUser" >> ~/.git-credentials
  44. #echo "Enter git password: "
  45. #read gitPassword
  46. #git config --global user.password '${gitPassword}'
  47. #echo "password=$gitPassword" >> ~/.git-credentials
  48. #chmod 0600 ~/.git-credentials
  49. sudo apt install python2
  50. sudo apt install build-essential
  51. sudo apt install -y make
  52. #INSTALLING NODE JS
  53. cd ~
  54. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh
  55. curl -o- https://raw.githubusercontent.com/nvm-sh/nvm/v0.39.3/install.sh | bash
  56. sleep 2
  57. touch ~/.bashrc
  58. source ~/.bashrc
  59. export NVM_DIR="$HOME/.nvm"
  60. [ -s "$NVM_DIR/nvm.sh" ] && \. "$NVM_DIR/nvm.sh" # This loads nvm
  61. [ -s "$NVM_DIR/bash_completion" ] && \. "$NVM_DIR/bash_completion" # This loads nvm bash_completion
  62. sleep 2
  63. nvm list-remote
  64. sleep 2
  65. nvm install v16.19.1
  66. sleep 2
  67. node --version
  68. npm --version
  69. # OLD version...
  70. #sudo apt install nodejs
  71. #sudo apt install npm
  72. # For production we create a npm global per user.
  73. # npm prefix is not compatible with nvm!!!
  74. # mkdir -p ~/.user_global_node_modules/
  75. # npm config set prefix '~/.user_global_node_modules'
  76. # sudo mkdir /usr/local/lib/node_modules/
  77. # sudo chown -R root:chessprod /usr/local/lib/node_modules/
  78. # sudo chmod g+w /usr/local/lib/node_modules/
  79. # grep -qxF 'export PATH=~/.user_global_node_modules/bin:$PATH' ~/.profile || echo 'export PATH=~/.user_global_node_modules/bin:$PATH' >> ~/.profile
  80. if [ "$SKIPPREREQS" = "true" ]; then
  81. echo "skipping dev prereqs for firstrun"
  82. else
  83. #install code
  84. sudo apt-get install wget gpg
  85. wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
  86. sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
  87. sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
  88. rm -f packages.microsoft.gpg
  89. sudo apt install apt-transport-https
  90. sudo apt update
  91. sudo apt install code
  92. install code
  93. sudo apt-get install wget gpg
  94. wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor > packages.microsoft.gpg
  95. sudo install -D -o root -g root -m 644 packages.microsoft.gpg /etc/apt/keyrings/packages.microsoft.gpg
  96. sudo sh -c 'echo "deb [arch=amd64,arm64,armhf signed-by=/etc/apt/keyrings/packages.microsoft.gpg] https://packages.microsoft.com/repos/code stable main" > /etc/apt/sources.list.d/vscode.list'
  97. rm -f packages.microsoft.gpg
  98. sudo apt install apt-transport-https
  99. sudo apt update
  100. sudo apt install code
  101. fi
  102. sudo mkdir -p /var/chess
  103. sudo chown $USER:$USER /var/chess
  104. mkdir -p /var/chess/$INSTANCENAME
  105. sudo chown $USER:$USER /var/chess/$INSTANCENAME
  106. ROOT=/var/chess/$INSTANCENAME/$INSTANCETYPE
  107. mkdir -p $ROOT
  108. sudo chown $USER:$USER $ROOT
  109. cd $ROOT
  110. git clone $REPOSERVER/$REPOOWNER/elxr.git
  111. cd elxr
  112. npm i
  113. npm link
  114. cd ..
  115. # Install mysql
  116. # https://dev.mysql.com/doc/refman/8.0/en/server-system-variables.html#sysvar_lower_case_table_names
  117. # sudo debconf-set-selections < "mysql-server mysql-server/lowercase-table-names select Enabled"
  118. sudo debconf-set-selections <<EOF
  119. mysql-server mysql-server/lowercase-table-names select Enabled
  120. EOF
  121. sudo debconf-show mysql-server
  122. sudo apt install mysql-server -y
  123. systemctl is-active mysql
  124. #sudo mysql -e "ALTER USER 'root'@'localhost' IDENTIFIED WITH mysql_native_password by 'mysql#minA1';"
  125. #sudo mysql_secure_installation
  126. #sudo mysql -e "FLUSH PRIVILEGES;" -u root -pmysql#minA1
  127. #systemctl status mysql.service
  128. # Init DB schema and Load Data
  129. #mysql -u root -pmysql#minA1 < cihsr-data/cihsr-dev-schema.sql
  130. ##############
  131. ###UNINSTALL MYSQL
  132. #sudo apt-get remove --purge mysql*
  133. #sudo apt-get autoremove
  134. #sudo apt-get autoclean
  135. fi
  136. echo module.exports = { instanceName : "'$INSTANCENAME'", reposerver: "'$REPOSERVER'", gitUser: "'$GITUSER'", gitEmail:"'$GITEMAIL'" } > installchoices.js
  137. elxr use elixir
  138. elxr i