Commit f76c82b650d109a1ecf947d76d54d146ffa62d69
1 parent
cdb3e7da
install replaced by install.sh
Showing
1 changed file
with
0 additions
and
218 deletions
Show diff stats
anubis_distrib/linux_install/install deleted
| 1 | -#!/bin/bash | |
| 2 | -# | |
| 3 | -# The installation shell for Anubis under Linux. | |
| 4 | -# Copyright (c) Alain Proute' 2006 | |
| 5 | -# | |
| 6 | - | |
| 7 | -MUST_LDCONFIG=0 | |
| 8 | -ERROR_COUNT=0 | |
| 9 | -LIB_COUNT=0 | |
| 10 | - | |
| 11 | -# Performing a command, tracing it and counting errors | |
| 12 | -function perform () | |
| 13 | - { | |
| 14 | - echo -n " " $1 " ... " | |
| 15 | - if 2> errors_report $1; | |
| 16 | - then echo "OK" | |
| 17 | - else { echo "*** Error ***"; | |
| 18 | - if [ "$1" == "cp bin/anbexec /usr/bin/anbexec" ] | |
| 19 | - then echo -e " (Instances of anbexec maybe currently running. Stop them before installing.)"; | |
| 20 | - else echo -e ""; | |
| 21 | - fi | |
| 22 | - ((ERROR_COUNT++)) | |
| 23 | - } | |
| 24 | - fi | |
| 25 | - } | |
| 26 | - | |
| 27 | -ADD_LINES=" Add lines." | |
| 28 | -DONT_ADD_LINES=" Don't add lines." | |
| 29 | -PATH_LINE1="" | |
| 30 | -PATH_LINE2="" | |
| 31 | - | |
| 32 | -# adding a value to the 'PATH' variable (this is only for non root installations) | |
| 33 | -function add_value_to_PATH () | |
| 34 | - { | |
| 35 | - # $1 is the value to be added (for example '/home/georges/bin') | |
| 36 | - PATH_LINE1="PATH=$1:\$PATH"; | |
| 37 | - PATH_LINE2="export PATH"; | |
| 38 | - echo -e "\n--- Checking that '$1' is in the 'PATH' ---"; | |
| 39 | - if [[ $PATH == *$1* ]] | |
| 40 | - then echo -e " $1 is already in the 'PATH' variable."; | |
| 41 | - else echo -e " $1 is not in the 'PATH' variable."; | |
| 42 | - echo -e " May I add the following lines to your '.bash_profile' ?"; | |
| 43 | - echo -e $PATH_LINE1; | |
| 44 | - echo -e $PATH_LINE2; | |
| 45 | - select RESULT in "$ADD_LINES" "$DONT_ADD_LINES" ; | |
| 46 | - do if [ "$RESULT" == "$ADD_LINES" ] | |
| 47 | - then echo $PATH_LINE1 >> $HOME/.bash_profile; | |
| 48 | - echo $PATH_LINE2 >> $HOME/.bash_profile; | |
| 49 | - echo -e "The lines have been appended at the end of '.bash_profile'"; | |
| 50 | - else echo -e "'.bash_profile' is unchanged"; | |
| 51 | - fi | |
| 52 | - break; | |
| 53 | - done | |
| 54 | - fi | |
| 55 | - } | |
| 56 | - | |
| 57 | - | |
| 58 | -# The same one for the 'LD_LIBRARY_PATH' variable (this is only for non root installations) | |
| 59 | -function add_value_to_LD_LIBRARY_PATH () | |
| 60 | - { | |
| 61 | - # $1 is the value to be added (for example '/home/georges/anubis/lib') | |
| 62 | - PATH_LINE1="LD_LIBRARY_PATH=$1:\$LD_LIBRARY_PATH"; | |
| 63 | - PATH_LINE2="export LD_LIBRARY_PATH"; | |
| 64 | - echo -e "\n--- Checking that '$1' is in the 'LD_LIBRARY_PATH' ---"; | |
| 65 | - if [[ $LD_LIBRARY_PATH == *$1* ]] | |
| 66 | - then echo -e " $1 is already in the 'LD_LIBRARY_PATH' variable."; | |
| 67 | - else echo -e " $1 is not in the 'LD_LIBRARY_PATH' variable."; | |
| 68 | - echo -e " May I add the following lines to your '.bash_profile' ?"; | |
| 69 | - echo -e $PATH_LINE1; | |
| 70 | - echo -e $PATH_LINE2; | |
| 71 | - select RESULT in "$ADD_LINES" "$DONT_ADD_LINES" ; | |
| 72 | - do if [ "$RESULT" == "$ADD_LINES" ] | |
| 73 | - then echo $PATH_LINE1 >> $HOME/.bash_profile; | |
| 74 | - echo $PATH_LINE2 >> $HOME/.bash_profile; | |
| 75 | - echo -e "The lines have been appended at the end of '.bash_profile'"; | |
| 76 | - else echo -e "'.bash_profile' is unchanged"; | |
| 77 | - fi | |
| 78 | - break; | |
| 79 | - done | |
| 80 | - fi | |
| 81 | - } | |
| 82 | - | |
| 83 | - | |
| 84 | - | |
| 85 | -# Check the existence of a library | |
| 86 | -function check_library () | |
| 87 | - { | |
| 88 | - # $1 is the soname of the library | |
| 89 | - # $2 is the realname of the library | |
| 90 | - # $3 is the directory where the library must be installed | |
| 91 | - # We just test if the soname exists | |
| 92 | - #if [ -e "$3/$1" ] | |
| 93 | - #then echo " " Library "$3/$1" is installed; | |
| 94 | - #else echo " " You must install "$3/$1"; | |
| 95 | - # ((LIB_COUNT++)) | |
| 96 | - #fi | |
| 97 | - echo " " $3/$1 | |
| 98 | - } | |
| 99 | - | |
| 100 | - | |
| 101 | - | |
| 102 | -# installing Anubis as root | |
| 103 | -function install_as_root () | |
| 104 | - { | |
| 105 | - echo -e "\n---" Creating the 'anubis' directory \(if needed\) "---"; | |
| 106 | - perform "mkdir -p /usr/share/anubis"; | |
| 107 | - | |
| 108 | - echo -e "\n---" Installing the Anubis library and documentation "---"; | |
| 109 | - perform "tar -C /usr/share/anubis -xzf anubis_files.tar.gz"; | |
| 110 | - perform "chown -R root:root /usr/share/anubis"; | |
| 111 | - perform "find /usr/share/anubis -type d -exec chmod 555 {} +"; | |
| 112 | - perform "find /usr/share/anubis -type f -exec chmod 444 {} +"; | |
| 113 | - | |
| 114 | - echo -e "\n--- Installing the Anubis binaries ---"; | |
| 115 | - perform "tar -xzf anubis_binaries.tar.gz"; | |
| 116 | - perform "cp bin/anubis /usr/bin/anubis"; | |
| 117 | - perform "cp bin/anbexec /usr/bin/anbexec"; | |
| 118 | - perform "chmod a+x /usr/bin/anubis"; | |
| 119 | - perform "chmod a+x /usr/bin/anbexec"; | |
| 120 | - perform "chown root /usr/bin/anbexec"; | |
| 121 | - perform "chgrp root /usr/bin/anbexec"; | |
| 122 | - perform "chmod ug+s /usr/bin/anbexec"; | |
| 123 | - | |
| 124 | - echo -e "\n---" Please check for mandatory Linux libraries "---"; | |
| 125 | - /sbin/ldconfig # to be sure that the current libraries are configured | |
| 126 | - # Usage: check_library soname realname installation_directory | |
| 127 | - # All libraries are in ./lib | |
| 128 | - check_library "libjpeg.so.62" "libjpeg.so.62.0.0" "/usr/lib"; | |
| 129 | - check_library "libm.so.6" "libm-2.3.2.so" "/lib"; | |
| 130 | - check_library "libX11.so.6" "libX11.so.6.2" "/usr/lib"; | |
| 131 | - check_library "libdl.so.2" "libdl-2.3.2.so" "/lib"; | |
| 132 | - check_library "libstdc++.so.6" "libstdc++.so.6.0.9" "/usr/lib"; | |
| 133 | - check_library "libpthread.so.0" "libpthread-0.10.so" "/lib"; | |
| 134 | - check_library "libgcc_s.so.1" "libgcc_s.so.1" "/lib"; | |
| 135 | - } | |
| 136 | - | |
| 137 | - | |
| 138 | - | |
| 139 | -# installing Anubis as non root | |
| 140 | -function install_as_non_root () | |
| 141 | - { | |
| 142 | - echo -e "\n--- Installing Anubis for user '$USER' only. ---"; | |
| 143 | - | |
| 144 | - echo -e "\n---" Creating the 'anubis' directory \(if needed\) "---"; | |
| 145 | - perform "mkdir -p $HOME/anubis"; | |
| 146 | - | |
| 147 | - echo -e "\n---" Installing the Anubis library and documentation "---"; | |
| 148 | - perform "tar -C $HOME/anubis -xzf anubis_files.tar.gz"; | |
| 149 | - | |
| 150 | - echo -e "\n--- Installing the Anubis binaries ---"; | |
| 151 | - perform "mkdir -p $HOME/bin"; | |
| 152 | - perform "mkdir -p $HOME/anubis/lib"; | |
| 153 | - perform "tar -xzf anubis_binaries.tar.gz"; | |
| 154 | - perform "cp bin/anubis $HOME/bin/anubis"; | |
| 155 | - perform "cp bin/anbexec $HOME/bin/anbexec"; | |
| 156 | - perform "chmod a+x $HOME/bin/anubis"; | |
| 157 | - perform "chmod a+x $HOME/bin/anbexec"; | |
| 158 | - add_value_to_PATH "$HOME/bin"; | |
| 159 | - | |
| 160 | - echo -e "\n---" Please check for mandatory Linux libraries "---"; | |
| 161 | - perform "mkdir -p $HOME/anubis/lib"; | |
| 162 | - # Usage: check_library soname realname installation_directory | |
| 163 | - # All libraries are in ./lib | |
| 164 | - check_library "libjpeg.so.62" "libjpeg.so.62.0.0" "/usr/lib"; | |
| 165 | - check_library "libm.so.6" "libm-2.3.2.so" "/lib"; | |
| 166 | - check_library "libX11.so.6" "libX11.so.6.2" "/usr/lib"; | |
| 167 | - check_library "libdl.so.2" "libdl-2.3.2.so" "/lib"; | |
| 168 | - check_library "libstdc++.so.5" "libstdc++.so.5.0.7" "/usr/lib"; | |
| 169 | - check_library "libpthread.so.0" "libpthread-0.10.so" "/lib"; | |
| 170 | - check_library "libgcc_s.so.1" "libgcc_s.so.1" "/lib"; | |
| 171 | - add_value_to_LD_LIBRARY_PATH "$HOME/anubis/lib"; | |
| 172 | - } | |
| 173 | - | |
| 174 | - | |
| 175 | -# Installing Anubis | |
| 176 | -function install_anubis () | |
| 177 | - { | |
| 178 | - if [ $UID == "0" ] | |
| 179 | - then echo -e "\n---" Installing Anubis as \'root\' "---"; | |
| 180 | - install_as_root | |
| 181 | - else if [ "$1" == "non_root" ] | |
| 182 | - then install_as_non_root | |
| 183 | - else | |
| 184 | - echo -e " (1) If you have 'root' access, you should better install Anubis as 'root'."; | |
| 185 | - echo -e " Hence, become 'root' before restarting this installation shell."; | |
| 186 | - echo -e " (2) If definitely you have no 'root' access, you can still install"; | |
| 187 | - echo -e " Anubis as a non privileged user. In this case, just issue the command:"; | |
| 188 | - echo -e "install non_root"; | |
| 189 | - return | |
| 190 | - fi | |
| 191 | - fi | |
| 192 | - | |
| 193 | - if [ $ERROR_COUNT != 0 ] | |
| 194 | - then echo -e "\n--- $ERROR_COUNT errors occured. ---"; | |
| 195 | - return; | |
| 196 | - else echo -e "\n--- Installation successful. ---"; | |
| 197 | - fi | |
| 198 | - if [ $UID == "0" ] | |
| 199 | - then echo -e " Each user must execute 'anubis' at least one time to have"; | |
| 200 | - echo -e " the 'my_anubis' directory setup in his 'home' directory."; | |
| 201 | - echo -e " The documentation may be found in '/usr/share/anubis/en' or"; | |
| 202 | - echo -e " '/usr/share/anubis/fr'."; | |
| 203 | - else echo -e " You must now execute 'anubis' at least one time to have"; | |
| 204 | - echo -e " your 'my_anubis' directory setup in your 'home' directory."; | |
| 205 | - echo -e " The documentation may be found in '" $HOME"/anubis/en' or"; | |
| 206 | - echo -e " '" $HOME"/anubis/fr'."; | |
| 207 | - echo -e " If you want to be able to listen on privileged ports,"; | |
| 208 | - echo -e " you must ask 'root' to execute the following commands:"; | |
| 209 | - echo -e "chown root $HOME/bin/anbexec"; | |
| 210 | - echo -e "chmod ug+s $HOME/bin/anbexec"; | |
| 211 | - fi | |
| 212 | - } | |
| 213 | - | |
| 214 | - | |
| 215 | -install_anubis $* | |
| 216 | - | |
| 217 | - | |
| 218 | - |