Advertisement
Guest User

Untitled

a guest
Jul 29th, 2017
69
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 4.69 KB | None | 0 0
  1. #!/bin/bash
  2. # $Id: _install,v 0.1 2011/02/25 14:30:24 Bruno Alves y6ff $
  3. : ${DIALOG=dialog}
  4. : ${DIALOG_OK=0}
  5. : ${DIALOG_CANCEL=1}
  6. : ${DIALOG_ESC=255}
  7.  
  8. PROGNAME=$(basename $0)
  9.  
  10. tempfile=`tempfile 2>/dev/null` || tempfile=/tmp/installer.$$.$RANDOM
  11.  
  12. cleanup() {
  13.    rm -f $tempfile
  14.     echo "Unmounting dicas_lnx50"
  15.     sudo umount /mnt/cdrom
  16.    exit 1
  17.  
  18. }
  19.  
  20. trap "cleanup" 0 1 SIGHUP SIGINT SIGTERM
  21.  
  22.  
  23. mnt_ln50() {
  24.     echo "Mounting dicas_lnx50 in /mnt/cdrom"
  25.     sudo mount thera:/vol/vfinfr1/dicas_lnx50 /mnt/cdrom 2> /dev/null
  26. }
  27.  
  28. usage() {
  29.     echo "usage: $PROGNAME [[ vmware | acrobat | java ]] | [-h]]"
  30.     echo "Or run this installer without params."
  31. }
  32.  
  33. error_exit() {
  34.     echo "${PROGNAME}: ${1:-"Unknown error"}" 1>&2
  35.     exit 1
  36. }
  37.  
  38. vrfy_dialog() {
  39.     echo -n "Verifying dialog..."
  40.     rpm -qi dialog &> /dev/null || yum install -y dialog &> /dev/null
  41.     echo "OK"
  42. }
  43.  
  44. inst_vmware() {
  45.     mnt_ln50
  46.     if [ -e /usr/bin/vmplayer ];then
  47.         error_exit "Vmplayer já instalado."
  48.     fi
  49.     echo "Instalando VMWARE..."
  50.     sudo mkdir -p /Work/VMWARE/ && chmod 1777 /Work/VMWARE/
  51.     ssh y6ff@numenor2 "cat /imagens/VMWARE/WinXP-30GB.tgz " | tar zxvf - -C /
  52.     scp y6ff@numenor2:/imagens/VMWARE/VMware-Workstation-Full-7.1.0-261024.$(uname -i).bundle /Work/VMWARE
  53.     echo 'yes - no - no - enter enter enter :)'
  54.     sudo sh /Work/VMWARE/VMware-Workstation-Full-7.1.0-261024.$(uname -i).bundle
  55.     sudo echo "xkeymap.keycode.211 = 0x073" >> /etc/vmware/config
  56.     sudo echo "xkeymap.usekeycodeMapIfXFree86 = true" >> /etc/vmware/config
  57.     sudo echo -e '#!/bin/sh\n/usr/bin/vmplayer /Work/VMWARE/WinXP/WinXP.vmx 2> /dev/null &' > /usr/bin/vmp
  58.     sudo chmod 775 /usr/bin/vmp
  59.     echo -e  "No internet explorer, configurar os sites confiáves:
  60.          *.petrobras.com.br
  61.          *.petrobras.biz
  62.  
  63.         Alterar configuração dentro do windows em visualizar para autosubstituir.
  64.  
  65.         Abrir imagen no cd de /usr/lib/vmware/isoimages/windows.iso para instalar o vmwaretools
  66.  
  67.         Os pacotes abaixo devem ser instalados para que o Windin funfe:
  68.  
  69.         \\infra\INFRA-TIC\ATENDIMENTO\IMAGENS\_AUTOMATIZA\Pacotes\PacoteCorporativo
  70.  
  71.         \\infra\INFRA-TIC\ATENDIMENTO\IMAGENS\_AUTOMATIZA\Pacotes\Pos-Imagem
  72.  
  73.         \\infra\INFRA-TIC\ATENDIMENTO\PROGRAMAS\Automatiza\Dominio_Automatizado
  74.     "
  75.  
  76. }
  77.  
  78. inst_acrobat() {
  79.     mnt_ln50
  80.     echo -n "Instalando Adobe Acrobat Reader..."
  81.     sudo rpm -ivh /mnt/cdrom/Procedimentos/AdobeReader_enu-8.1.1-1.i486.rpm || error_exit "$LINENO: Cannot install AdobeReader_enu-8.1.1-1.i486.rpm"
  82.     echo  "OK"
  83. }
  84.  
  85. inst_python26() {
  86.     mnt_ln50
  87.     echo -n "Installing Python 2.6..."
  88.     cd /mnt/cdrom/python26
  89.     sudo rpm -ivh --nodeps  libffi-3.0.5-1.el5.kb.x86_64.rpm  python26-libs-2.6.5-2.x86_64.rpm  python26-2.6.5-2.x86_64.rpm  python26-docutils-0.6-1.noarch.rpm || error_exit "$LINENO: Cannot install "
  90.     echo "OK"
  91. }
  92.  
  93. menu(){
  94.     $DIALOG --backtitle "_InstallerAPP" \
  95.     --title "Install" --clear \
  96.         --separate-output \
  97.         --colors \
  98.        --checklist "Hi, this is a installation box.\n\
  99.        What do you like to install?" 20 61 10 \
  100.         "Adobe acrobat reader"  "Ver: 8.1.1-1" off \
  101.         "Vmware"    "Ver: 7.1.0" off \
  102.         "Java Runtime Enviroment" "Ver:1.6.0" off \
  103.         "Brownser"    "Firefox 3.x" off \
  104.         "Openoffice"    "Free office" off \
  105.         "ddd" "Data Display Debugger" off \
  106.         "Scilab" "" off \
  107.         "Octave" "" off \
  108.           "Python 2.6" "" off \
  109.         "Bibliotecas adicionais"  "libmotif," off 2> $tempfile
  110.  
  111.     retval=$?
  112.  
  113.     choice=`cat $tempfile`
  114.  
  115.     case $retval in
  116.         $DIALOG_OK)
  117.             echo "$choice chosen."
  118.             case "$choice" in
  119.                 Vmware)
  120.                     inst_vmware
  121.                     ;;
  122.                 'Adobe acrobat reader')
  123.                     inst_acrobat
  124.                     ;;
  125.                 *)
  126.                 error_exit "APP não configurado"
  127.                 ;;
  128.             esac
  129.             ;;
  130.         $DIALOG_CANCEL)
  131.             error_exit "Cancel pressed.";;
  132.         $DIALOG_ESC)
  133.             error_exit "ESC pressed.";;
  134.         *)
  135.             echo "Unexpected return code: $retval (ok would be $DIALOG_OK)";;
  136.     esac
  137.  
  138. }
  139.  
  140. ##### Main                                                                                                                                    
  141. if [ $# -gt 0 ]; then
  142.     vrfy_dialog
  143.     interactive=1
  144.  
  145.     while [ "$1" != "" ]; do
  146.         case $1 in
  147.         vmware )                      shift
  148.                                 inst_vmware
  149.                                 ;;
  150.         adobe )                   shift
  151.                                 inst_acrobat
  152.                                 ;;
  153.         python26 )                    shift
  154.                                 inst_python26
  155.                                 ;;
  156.         -h | --help )           usage
  157.                                 exit
  158.                                 ;;
  159.         * )                     usage
  160.                                 exit 1
  161.      esac
  162.     shift
  163.     done
  164. else
  165.     vrfy_dialog
  166.     menu
  167. fi
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement