Changeset 6219


Ignore:
Timestamp:
05/17/12 12:59:31 (12 years ago)
Author:
wmerlotto
Message:

Ticket #2557 - Correacao na identificacao do SO. Agora o instalador seleciona o SO automaticamente

Location:
trunk/INSTALL
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/INSTALL/arquivos/scripts/aux.sh

    r6207 r6219  
    4949} 
    5050 
     51# Detects which OS and if it is Linux then it will detect which Linux 
     52# Distribution. 
     53# http://linuxmafia.com/faq/Admin/release-files.html 
     54msg_erro () 
     55{ 
     56        echo "Sistema operacional ($1) não suportado!" 
     57        exit 1 
     58} 
     59 
     60qualSO () 
     61{ 
     62        OS=`uname -s` 
     63        REV=`uname -r` 
     64        MACH=`uname -m` 
     65 
     66        DIST="Desconhecido" 
     67        PSEUDONAME="Desconhecido" 
     68        REV="Desconhecido" 
     69 
     70        if [ "${OS}" = "SunOS" ] ; then 
     71                OS=Solaris 
     72                ARCH=`uname -p`  
     73                OSSTR="${OS} ${REV}(${ARCH} `uname -v`)" 
     74                msg_erro $OSSTR 
     75        elif [ "${OS}" = "AIX" ] ; then 
     76                OSSTR="${OS} `oslevel` (`oslevel -r`)" 
     77                msg_erro $OSSTR 
     78        elif [ "${OS}" = "Linux" ] ; then 
     79                KERNEL=`uname -r` 
     80                # RedHat ou Centos 
     81                if [ -f /etc/redhat-release ] ; then 
     82                        DIST=`cat /etc/redhat-release | cut -d' ' -f1` 
     83                        PSUEDONAME=`cat /etc/redhat-release | sed s/.*\(// | sed s/\)//` 
     84                        REV=`cat /etc/redhat-release | sed s/.*release\ // | sed s/\ .*//` 
     85                # Debian, Ubuntu e variantes, que possuem o LSB 
     86                elif [ -f /etc/debian_version ] ; then 
     87                        DIST=`lsb_release -si` 
     88                        PSEUDONAME=`lsb_release -sc` 
     89                        REV=`lsb_release -sr` 
     90                # TODO: Validar do suse 
     91                elif [ -f /etc/SuSE-release ] ; then 
     92                        DIST=`cat /etc/SuSE-release | tr "\n" ' '| sed s/VERSION.*//` 
     93                        REV=`cat /etc/SuSE-release | tr "\n" ' ' | sed s/.*=\ //` 
     94                fi 
     95 
     96                OSSTR="${OS} ${DIST} ${REV} (${PSEUDONAME} ${KERNEL} ${MACH})" 
     97        fi 
     98} 
     99 
     100validaSO () 
     101{ 
     102        R=1 
     103        #if [ "$DIST" == "$1" ] && [ `echo $REV | grep -q "$2"` ] 
     104        echo $REV | grep -q "$2" 
     105        if [ $? -eq 0 ] && [ "$DIST" == "$1" ] 
     106        then 
     107                R=0 
     108        fi 
     109 
     110        return $R 
     111} 
  • trunk/INSTALL/expressoInstall.sh

    r6207 r6219  
    4747[ $UID != 0 ] && { echo "Este script deve ser executado como superusuario (root) ou com sudo"; exit 1; } 
    4848 
    49 # Instala o dialog 
    50 # Se o arquivo existir, eh Debian ou variante ( ls /etc/*[-_]{release,version} ) 
    51 if [ -f /etc/lsb-release ]  
    52 then 
    53         apt-get -y install dialog || { echo "Falha ao instalar o dialog! Por favor, instale manualmente."; exit 1; } 
    54 else 
    55         yum -y install dialog || { echo "Falha ao instalar o dialog! Por favor, instale manualmente."; exit 1; } 
    56 fi 
    5749 
    5850# Telas da instalacao 
     
    7264dialog --backtitle "$BACKTITLE" --cr-wrap --yesno "$INTRO" 18 80 || exit 0 
    7365 
    74 # Menu de selecao do SO 
    75 SO=$( dialog --backtitle "$BACKTITLE" --stdout --menu 'Em qual sistema operacional (SO) o ExpressoLivre será instalado?' 13 70 10 \ 
    76         rhel6 'GNU/Linux Red Hat (v6.x) ou CentOS (v6.x)' \ 
    77         debian-squeeze 'GNU/Linux Debian Squeeze (v6.x)'  \ 
    78         ubuntu-11.10 'GNU/Linux Ubuntu Server (11.10)' ) 
    79          
    80         # TODO: Precio de ajuda para implementar e testar nestas distros 
    81         #sles10 'GNU/Linux SuSe Enterprise Linux (v10.x)' \ 
    82         #sles11 'GNU/Linux SuSe Enterprise Linux (v11.x)' \  
     66# Identifica o SO 
     67qualSO 
     68# Verifica se o SO eh compativel com o instalador 
     69if ( validaSO "Debian" "6.0" ) 
     70then 
     71        INSTALL="debian-squeeze" 
     72elif ( validaSO "Ubuntu" "11.10" ) 
     73then 
     74        INSTALL="ubuntu-11.10" 
     75elif ( validaSO "CentOS" "6." || validaSO "RedHat" "6." ) 
     76then 
     77        INSTALL="rhel6" 
     78else 
     79        echo "Sistema operacional desconhecido ou incompativel com o instalador do Expresso Livre!" 
     80        echo "$OSSTR" 
     81        echo "Por favor, utilize uma distribuição GNU/Linux compatível: Debian 6.x, Ubuntu 11.10 ou CentOS/RedHat 6.x" 
     82        exit 1 
     83fi 
    8384 
    84 BACKTITLE="$BACKTITLE, para $SO" 
     85BACKTITLE="$BACKTITLE, para $INSTALL" 
    8586 
    8687# Inicializacao basica de instalacao, como atualização de repositório e criação de variáveis de ambiente 
    87 ini_$SO 
     88ini_$INSTALL 
    8889 
    8990# Inicia a escolha/instalacao e configuracao dos servicos nessarios ao ExpressoLivre 
     
    99100for I in $SERVICOS 
    100101do 
    101         $I\_$SO 
     102        $I\_$INSTALL 
    102103done 
    103104 
Note: See TracChangeset for help on using the changeset viewer.