[244] | 1 | #!/bin/bash |
---|
| 2 | |
---|
| 3 | compil_mode="prod" |
---|
| 4 | svnbranch="/trunk" |
---|
| 5 | doc="F" |
---|
| 6 | extdir="." |
---|
| 7 | |
---|
[246] | 8 | interactive=false |
---|
| 9 | |
---|
| 10 | has_interactive=false |
---|
| 11 | has_rev=false |
---|
| 12 | has_user=false |
---|
| 13 | has_branch=false |
---|
| 14 | has_compil_mode=false |
---|
| 15 | has_arch=false |
---|
| 16 | has_doc=false |
---|
| 17 | has_extdir=false |
---|
| 18 | |
---|
| 19 | |
---|
[304] | 20 | echo -e "Installing XIOS library... " |
---|
[244] | 21 | |
---|
| 22 | # Traitement de la ligne de commande |
---|
| 23 | while (($# > 0)) |
---|
| 24 | do |
---|
| 25 | case $1 in |
---|
| 26 | "-h") |
---|
| 27 | # A modifier |
---|
| 28 | exit;; |
---|
[246] | 29 | "--interactive") interactive=true ; has_interactive=true; shift ;; |
---|
| 30 | "--rev") svnrev=$2 ; has_rev="true"; shift; shift ;; |
---|
| 31 | "--user") svnuser=$2 ; has_user="true"; shift; shift ;; |
---|
| 32 | "--branch") svnbranch=$2 ; has_branch="true"; shift; shift ;; |
---|
| 33 | "--prod") compil_mode="prod" ; has_compil_mode="true"; shift ;; |
---|
| 34 | "--dev") compil_mode="dev" ; has_compil_mode="true"; shift ;; |
---|
| 35 | "--debug") compil_mode="debug" ; has_compil_mode="true"; shift ;; |
---|
| 36 | "--arch") arch=$2 ; has_arch="true"; shift; shift ;; |
---|
| 37 | "--doc") withdoc="Y" ; has_doc="true"; shift ;; |
---|
| 38 | *) extdir="$1" ; has_extdir=true; shift ;; |
---|
[244] | 39 | esac |
---|
| 40 | done |
---|
| 41 | |
---|
| 42 | # Récupération du répertoire local d'installation |
---|
[246] | 43 | if [[ $interactive == "true" && $has_extdir == "false" ]] |
---|
| 44 | then |
---|
[304] | 45 | read -p "insert directory path to extract XIOS library : "$PWD"/" extdir |
---|
[244] | 46 | fi |
---|
[246] | 47 | |
---|
[244] | 48 | install_dir=$PWD/$extdir |
---|
[368] | 49 | mkdir -p $install_dir |
---|
[244] | 50 | |
---|
| 51 | # Documentation de la distribution |
---|
[246] | 52 | if [[ $interactive == "true" && $has_doc == "false" ]] |
---|
| 53 | then |
---|
[304] | 54 | read -p "Do you want to extract documentation ? [Y/N]: " withdoc |
---|
[244] | 55 | fi |
---|
| 56 | |
---|
| 57 | # Architecture de compilation |
---|
[246] | 58 | if [[ $interactive == "true" && $has_arch == "false" ]] |
---|
| 59 | then |
---|
[304] | 60 | echo -e "\r\n XIOS may be install on different computing architecture, choose witch one...\r\n " |
---|
| 61 | echo -e "\tIA64_PLATINE => Configuration for CCRT supercomputer Platine\r\n" |
---|
| 62 | echo -e "\tX86_LOCGNU_FEDORA => Local configuration for gnu compiler under fedora\r\n" |
---|
| 63 | echo -e "\tX86_LOCINTEL_FEDORA => Local configuration for intel compiler under fedora \r\n" |
---|
| 64 | echo -e "\tX64_TITANE => Configuration for CCRT supercomputer Titane \r\n" |
---|
[250] | 65 | |
---|
[304] | 66 | read -p "On which architecture do you want to work ? (default : none): " arch |
---|
[244] | 67 | fi |
---|
| 68 | |
---|
| 69 | case $arch in |
---|
| 70 | IA64_PLATINE) |
---|
[304] | 71 | echo "=> Configuration for CCRT supercomputer Platine" ;; |
---|
[244] | 72 | X86_LOCGNU_FEDORA) |
---|
[304] | 73 | echo "=> Local configuration for gnu compiler under fedora" ;; |
---|
[244] | 74 | X86_LOCINTEL_FEDORA) |
---|
[304] | 75 | echo "=> Local configuration for intel compiler under fedora" ;; |
---|
[250] | 76 | X64_TITANE) |
---|
[304] | 77 | echo "=> Configuration for CCRT supercomputer Titane " ;; |
---|
[244] | 78 | *) |
---|
[304] | 79 | echo "=> no specific architecture choosen" |
---|
[244] | 80 | arch= |
---|
| 81 | esac |
---|
| 82 | |
---|
| 83 | # Récupération du login de connexion svn |
---|
[246] | 84 | if [[ $interactive == "true" && $has_user == "false" ]] |
---|
| 85 | then |
---|
[304] | 86 | echo -e -n "insert your svn login" |
---|
| 87 | read -p " forge.ipsl.jussieu.fr (nothing if anonymous) : " svnuser |
---|
[244] | 88 | fi |
---|
| 89 | |
---|
| 90 | # Récupération de la branche svn de travail |
---|
[246] | 91 | if [[ $interactive == "true" && $has_branch == "false" ]] |
---|
| 92 | then |
---|
[304] | 93 | read -p "Which branch do tou want to extract ? (default : /trunk): " svnbranch |
---|
[244] | 94 | fi |
---|
| 95 | |
---|
| 96 | if [[ -z $svnbranch ]] |
---|
| 97 | then |
---|
| 98 | svnbranch="/trunk" |
---|
| 99 | fi |
---|
| 100 | |
---|
| 101 | if [[ -z $svnuser ]] |
---|
| 102 | then |
---|
[307] | 103 | connect="http://forge.ipsl.jussieu.fr/ioserver/svn/XIOS"$svnbranch |
---|
[244] | 104 | else |
---|
[307] | 105 | connect="svn+ssh://"$svnuser"@forge.ipsl.jussieu.fr/ipsl/forge/projets/ioserver/svn/XIOS"$svnbranch |
---|
[244] | 106 | fi |
---|
| 107 | |
---|
| 108 | # Extraction de la distribution |
---|
[304] | 109 | echo -e "=> Connecting to svn server via \""$connect"\"..." |
---|
[244] | 110 | |
---|
| 111 | |
---|
[246] | 112 | if [[ $withdoc == [Yy]* ]] |
---|
[244] | 113 | then |
---|
| 114 | installopt=$installopt" --doc" |
---|
| 115 | fi |
---|
| 116 | |
---|
[246] | 117 | svn -q co $connect $install_dir |
---|
[244] | 118 | |
---|
[304] | 119 | echo -e "- uncompress archives ..." |
---|
[244] | 120 | cd $install_dir |
---|
| 121 | for tarname in $install_dir/tools/archive/*.tar.gz; do |
---|
[368] | 122 | gunzip -f "$tarname" |
---|
| 123 | tar -xf ${tarname%.gz} |
---|
[244] | 124 | done |
---|
| 125 | |
---|
| 126 | if [[ !(-z $arch) && -f $install_dir/make_xios ]] |
---|
| 127 | then |
---|
[304] | 128 | echo -e "Running installation script for architecture \""$arch"\" ..." |
---|
[244] | 129 | installopt=$installopt" --"$compil_mode" --arch "$arch |
---|
| 130 | cd $install_dir && ./make_xios $installopt |
---|
| 131 | fi |
---|
| 132 | |
---|
| 133 | |
---|