Advertisement
atcasanova

Instalação agente TSM

Feb 15th, 2013
140
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 2.86 KB | None | 0 0
  1. #!/bin/bash
  2. #
  3. # Script para baixar a última versão e transformar os RPMs do TSM em .deb
  4. # E depois proceder as alterações necessárias para a conclusão da instalação.
  5. # O script pegará sempre a versão mais atual do release v5r5.
  6. # Desenvolvido por Alfredo Tristão Casanova
  7. # alfredo.casanova@serpro.gov.br
  8. # atcasanova at gmail dot com
  9. #
  10.  
  11. # verifica privilégios de root
  12. [ $(id -u) -eq 0 ] || { echo "E necessario ter privilegio de root para
  13. executar esse script." && exit 1; }
  14.  
  15. # função para criação do arquivo control da API e do backup agent
  16.  
  17. control(){
  18.     modo=$1
  19.     path="TIVsm-${modo^^}-$version/DEBIAN/control"
  20.     echo "Source: tivsm-$modo
  21. Section: non-free
  22. Priority: extra
  23. Maintainer: root <root@localhost>
  24. Package: tivsm-$modo
  25. Architecture: all
  26. Depends:
  27. Description: the ${modo^^} IBM Tivoli Storage Manager
  28. Version: $version
  29. "  > $path
  30. }
  31.  
  32. # verifica arquitetura do SO
  33. [ $(getconf LONG_BIT) = "64" ] && arch=IA64 || arch=X86
  34. echo "Arquitetura do sistema: $arch"
  35.  
  36. # pesquisa do build mais recente da versão v5r5 do client
  37. # e monta URL para download do pacote
  38. echo "Buscando versão mais recente do Client Release v5r5"
  39. curl=$(which curl)
  40.  
  41. # lista de mirrors
  42. mirror1=ftp.software.ibm.com/storage/tivoli-storage-management/maintenance/client/v5r5/Linux/Linux$arch/
  43. mirror2=ftp.wu-wien.ac.at/mirrors/tsm/maintenance/client/v5r5/Linux/Linux$arch/
  44.  
  45. # sorteio randomico de mirror
  46. rand=$RANDOM
  47. RANGE=2
  48. let "rand %= $RANGE"
  49.  
  50. case $rand in
  51.     0) url=$mirror1 ;;
  52.     1) url=$mirror2 ;;
  53. esac
  54.  
  55. echo Mirror $url selecionado
  56.  
  57. latestversion=$($curl -s $url | grep -oE "v[0-9]{3}" | tail -1)
  58. version=${latestversion:1:1}.${latestversion:2:1}.${latestversion:3:1}
  59. filename=$version.0-TIV-TSMBAC-Linux$arch.tar
  60. echo -e "\n\nVersão mais recente encontrada: $version\nBaixando $filename\n\n\n"
  61.  
  62. # download da versão mais recente
  63. wget -c $url/$latestversion/$filename
  64.  
  65. # verifica se o arquivo existe
  66. if [ -s $filename ]
  67. then
  68.     tar xvf $filename
  69. else
  70.     echo "Arquivo $filename invalido"
  71.     exit 1
  72. fi
  73.  
  74. # verificação de ferramentas necessárias
  75. echo Verificando ferramentas necessárias
  76. [ $(dpkg -s alien 2&> /dev/null) ] || apt-get install alien gawk libstdc++5
  77.  
  78. # conversão dos RPMs em .deb
  79. [ "$arch" = "X86" ] && ext=i386.rpm || ext=ia64.rpm
  80. alien -g TIVsm-API.$ext
  81. alien -g TIVsm-BA.$ext
  82.  
  83. mv TIVsm-API-$version/debian TIVsm-API-$version/DEBIAN
  84. mv TIVsm-BA-$version/debian TIVsm-BA-$version/DEBIAN
  85. chmod 0775 TIVsm*/DEBIAN/postinst
  86.  
  87. control api
  88. control ba
  89.  
  90. dpkg -b TIVsm-API-$version
  91. dpkg -b TIVsm-BA-$version
  92. dpkg -i TIVsm-API-$version.deb
  93. dpkg -i TIVsm-BA-$version.deb
  94.  
  95. echo "/opt/tivoli/tsm/client/ba/bin" >> /etc/ld.so.conf
  96. ldconfig
  97. ln -s /opt/tivoli/tsm/client/lang/en_US /opt/tivoli/tsm/client/ba/bin/
  98.  
  99. echo "A instalação do agente está concluída. Proceda com a configuração do agente em /opt/tivoli/tsm/client/ba/bin"
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement