calvinturbo

Guacamole upgrade

Nov 21st, 2017
165
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.95 KB | None | 0 0
  1. #!/bin/bash
  2.  
  3. # Version Numbers of Guacamole and MySQL Connector/J to download
  4. VERSION="0.9.13"
  5. MCJVERSION="5.1.44"
  6.  
  7. # I'm assuming tomcat7, you can change it here...
  8. TOMCAT="tomcat8"
  9.  
  10. SERVER=$(curl -s 'https://www.apache.org/dyn/closer.cgi?as_json=1' | jq --raw-output '.preferred|rtrimstr("/")')
  11.  
  12. # Stop tomcat
  13. service ${TOMCAT} stop
  14.  
  15. # Download and install Guacamole server
  16. wget ${SERVER}/incubator/guacamole/${VERSION}-incubating/source/guacamole-server-${VERSION}-incubating.tar.gz
  17. tar -xzf guacamole-server-${VERSION}-incubating.tar.gz
  18. cd guacamole-server-${VERSION}-incubating
  19. ./configure --with-init-dir=/etc/init.d
  20. make
  21. make install
  22. ldconfig
  23. systemctl enable guacd
  24. cd ..
  25.  
  26. # Download and replace Guacamole client
  27. wget ${SERVER}/incubator/guacamole/${VERSION}-incubating/binary/guacamole-${VERSION}-incubating.war
  28. mv guacamole-${VERSION}-incubating.war /etc/guacamole/guacamole.war
  29.  
  30. # Download and upgrade SQL components
  31. wget ${SERVER}/incubator/guacamole/${VERSION}-incubating/binary/guacamole-auth-jdbc-${VERSION}-incubating.tar.gz
  32. tar -xzf guacamole-auth-jdbc-${VERSION}-incubating.tar.gz
  33. cp guacamole-auth-jdbc-${VERSION}-incubating/mysql/guacamole-auth-jdbc-mysql-${VERSION}-incubating.jar /etc/guacamole/extensions/
  34.  
  35. # Upgrade the MySQL Connector/J
  36. wget https://dev.mysql.com/get/Downloads/Connector-J/mysql-connector-java-${MCJVERSION}.tar.gz
  37. tar -xzf mysql-connector-java-${MCJVERSION}.tar.gz
  38. cp mysql-connector-java-${MCJVERSION}/mysql-connector-java-${MCJVERSION}-bin.jar /etc/guacamole/lib/
  39. rm -rf mysql-connector-java-${MCJVERSION}*
  40.  
  41. # Check if there is an schema upgrade file, if there is run it (will prompt for password)
  42. if [ -f "guacamole-auth-jdbc-${VERSION}-incubating/mysql/schema/upgrade/upgrade-pre-${VERSION}.sql" ]
  43. then
  44. mysql -u root -p guacamole_db < guacamole-auth-jdbc-${VERSION}-incubating/mysql/schema/upgrade/upgrade-pre-${VERSION}.sql
  45. fi
  46.  
  47. # Start tomcat
  48. service ${TOMCAT} start
  49.  
  50. # Cleanup
  51. rm -rf guacamole*
Advertisement
Add Comment
Please, Sign In to add comment