Advertisement
albertmatyi

install lib-svn 1.7

Dec 20th, 2011
3,450
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.64 KB | None | 0 0
  1. #!/bin/bash +x
  2. # WANdisco Subversion Installer V0.1
  3. # opensource@wandisco.com
  4.  
  5. echo 'WANdisco Subversion Installer v0.1 for Ubuntu 9.10, 10.04, 10.10'
  6. echo 'Please report problems and bugs to opensource@wandisco.com'
  7. echo
  8. echo 'Gathering some information about your system…'
  9.  
  10. MINVERSION='1'
  11. SVNVER='1.7.0'
  12. ARCH=`uname -m`
  13. SVNSTATUS=`dpkg -l|grep " libsvn1 " | awk '{print $1}'`
  14.  
  15. #functions
  16. check_is_root ()
  17. {
  18. if [[ $EUID -ne 0 ]]; then
  19. echo "This script must be run as root" 1>&2
  20. exit 1
  21. fi
  22. }
  23. svn_remove_old ()
  24. {
  25. echo Removing old packages…
  26. apt-get -y remove libsvn1 subversion libapache2-svn libsvn-dev libsvn-doc libsvn-perl subversion-tools
  27. }
  28. add_repo_config ()
  29. {
  30. echo Adding repository configuration to /etc/apt/sources.list.d/
  31. if [ -f /etc/apt/sources.list.d/WANdisco.list ]; then
  32. rm /etc/apt/sources.list.d/WANdisco.list
  33. fi
  34. echo "Installing Apt repo…."
  35. echo "# WANdisco Open Source Repo" > /etc/apt/sources.list.d/WANdisco.list
  36. echo "deb http://opensource.wandisco.com/ubuntu lucid svn17" >> /etc/apt/sources.list.d/WANdisco.list
  37. echo "Importing GPG key"
  38. wget http://opensource.wandisco.com/wandisco-debian.gpg -O /tmp/wandisco-debian.gpg &>/dev/null
  39. apt-key add /tmp/wandisco-debian.gpg
  40. rm -rf /tmp/wandisco-debian.gpg
  41. apt-get update
  42. }
  43. install_svn ()
  44. {
  45. echo Checking to see if you already have Subversion installed via dpkg
  46. if [ "$SVNSTATUS" == "ii" ]; then
  47. echo
  48. echo Subversion is already installed on the system.
  49. echo Do you wish to replace the version of subversion currently installed with the WANdisco version?
  50. echo This action will remove the previous version from your system
  51. echo \[y/n\]:
  52. read svn_install_confirm
  53. if [ "$svn_install_confirm" == "y" -o "$svn_install_confirm" == "Y" ]; then
  54. svn_remove_old
  55. add_repo_config
  56. echo
  57. echo Installing Subversion $SVNVER-$MINVERSION
  58. echo
  59. apt-get -y -force=yes install subversion libsvn-perl subversion-tools libsvn-java
  60. echo Would you like to install apache and the apache SVN modules? \[y/n\]
  61. read dav_svn_confirm
  62. if [ "$dav_svn_confirm" == "y" -o "$dav_svn_confirm" == "Y" ]; then
  63. echo Installing apache and subversion modules
  64. apt-get -y -force=yes install apache2 libapache2-svn
  65. echo Installation complete. Restart apache? \[y/n\]
  66. read apache_restart_confirm
  67. if [ $apache_restart_confirm == "y" -o $apache_restart_confirm == "Y" ]; then
  68. /etc/init.d/apache2 restart
  69. fi
  70. fi
  71.  
  72. else
  73. echo "Install Cancelled"
  74. exit 1
  75. fi
  76.  
  77. else
  78. # Install SVN
  79. echo "Subversion is not currently installed"
  80. echo "Starting installation, are you sure you wish to continue? [y/n]"
  81. read svn_install_confirm
  82. if [ "$svn_install_confirm" == "y" -o "$svn_install_confirm" == "Y" ]; then
  83. add_repo_config
  84. echo
  85. echo Installing Subversion $SVNVER-$MINVERSION
  86. echo
  87. apt-get -y -force=yes install subversion libsvn-perl subversion-tools
  88. echo Would you like to install apache and the apache SVN modules? \[y/n\]
  89. read dav_svn_confirm
  90. if [ "$dav_svn_confirm" == "y" -o "$dav_svn_confirm" == "Y" ]; then
  91. echo Installing apache and subversion modules
  92. apt-get -y -force=yes install apache2 libapache2-svn libsvn-dev
  93. echo Installation complete. Restart apache? \[y/n\]
  94. read apache_restart_confirm
  95. if [ $apache_restart_confirm == "y" -o $apache_restart_confirm == "Y" ]; then
  96. /etc/init.d/apache2 restart
  97. fi
  98. fi
  99.  
  100. else
  101. echo "Install Cancelled"
  102. exit 1
  103. fi
  104.  
  105. fi
  106.  
  107. }
  108.  
  109. install_32 ()
  110. {
  111. echo Installing for $ARCH
  112. install_svn
  113. }
  114. install_64 ()
  115. {
  116. echo Installing for $ARCH
  117. install_svn
  118. }
  119.  
  120. #Main
  121. check_is_root
  122.  
  123. echo Checking your system arch
  124. if [ "$ARCH" == "i686" -o "$ARCH" == "i386" ]; then
  125. install_32
  126. elif [ "$ARCH" == "x86_64" ];
  127. then
  128. install_64
  129. else
  130. echo Unsupported platform: $ARCH
  131. exit 1
  132. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement