| 1 | #!/bin/bashscip-shell filesystem . . `/bin/bash`. |
| 2 | |
| 3 | if [scip-shell system . . `[`. "$1" == "" ]; then |
| 4 | echoscip-shell system . . echo. "Usage:" |
| 5 | echoscip-shell system . . echo. "$0 [clean|compile|install|nccompile|ncinstall] \"standard|standard-dep|mysql|radius|presence|stable|experimental\" [ignore|stop] [installpath]" |
| 6 | echoscip-shell system . . echo. " " |
| 7 | echoscip-shell system . . echo. " The first parameter specifies what to do: 'clean' up source tree, 'compile', or compile and 'install'.." |
| 8 | echoscip-shell system . . echo. " The 'nccompile' and 'ncinstall' do the same as compile and install respectively, but withou" |
| 9 | echoscip-shell system . . echo. " cleaning the source tree first (this will make make_and_install_output.txt easier to scan for" |
| 10 | echoscip-shell system . . echo. " errors and takes less time after you have compiled once)." |
| 11 | echoscip-shell system . . echo. " " |
| 12 | echoscip-shell system . . echo. " The second parameter controls which modules to include. It may list several group names" |
| 13 | echoscip-shell system . . echo. " separated by space (see INSTALL). If you don't know what to include, use \"standard\" (default) " |
| 14 | echoscip-shell system . . echo. " or \"standard mysql\" (if you want mysql storage support)." |
| 15 | echoscip-shell system . . echo. " " |
| 16 | echoscip-shell system . . echo. " ignore|stop(default) specifies whether to stop after found errors or ignore and just install." |
| 17 | echoscip-shell system . . echo. " If you have errors in a module with dependencies, it will allow you to install the remaining" |
| 18 | echoscip-shell system . . echo. " modules. This switch is only relevant for install and ncinstall." |
| 19 | echoscip-shell system . . echo. " " |
| 20 | echoscip-shell system . . echo. " If installpath is not supplied, ser will be installed created in /usr/local and sub-directories." |
| 21 | echoscip-shell system . . echo. " " |
| 22 | echoscip-shell system . . echo. " Groups and installpath will be stored and reused the next time you use make_and_install unless" |
| 23 | echoscip-shell system . . echo. " you specify explicitly groups and installpath on the command line." |
| 24 | echoscip-shell system . . echo. " " |
| 25 | echoscip-shell system . . echo. " Examples:" |
| 26 | echoscip-shell system . . echo. " $0 compile" |
| 27 | echoscip-shell system . . echo. " will compile the standard modules without external dependencies." |
| 28 | echoscip-shell system . . echo. " If the make_and_install_config_* files exist, groups and installpath specified there will be used." |
| 29 | echoscip-shell system . . echo. " " |
| 30 | echoscip-shell system . . echo. " $0 install \"standard mysql\" stop /tmp/ser" |
| 31 | echoscip-shell system . . echo. " will compile and install all mysql and standard modules without external dependencies to /tmp/ser" |
| 32 | echoscip-shell system . . echo. " and stop and not install if there are errors." |
| 33 | echoscip-shell system . . echo. " make_and_install_config_* files will be created to save the groups and installpath." |
| 34 | echoscip-shell system . . echo. " " |
| 35 | echoscip-shell system . . echo. " $0 ncinstall \"standard standard-dep\" ignore" |
| 36 | echoscip-shell system . . echo. " will compile without cleaning first (i.e. skip already made files and modules). All" |
| 37 | echoscip-shell system . . echo. " modules without (standard) and with (standard-dep) dependencies will be included, but" |
| 38 | echoscip-shell system . . echo. " if a module won't compile due to lack of installed dependencies, SER will still be installed" |
| 39 | echoscip-shell system . . echo. " to default directory (/usr/local)." |
| 40 | echoscip-shell system . . echo. " make_and_install_config_* files will be created to save the groups and installpath." |
| 41 | echoscip-shell system . . echo. " " |
| 42 | echoscip-shell system . . echo. " $0 clean" |
| 43 | echoscip-shell system . . echo. " will default clean ALL modules (not only standard). Specify groups to clean only those." |
| 44 | echoscip-shell system . . echo. " If the make_and_install_config_groups file exists, groups specified there will be used." |
| 45 | exit |
| 46 | fi |
| 47 | |
| 48 | action="$1" |
| 49 | groups="$2" |
| 50 | whenerrors="$3" |
| 51 | installpath="$4" |
| 52 | |
| 53 | # source the saved config |
| 54 | if [scip-shell system . . `[`. "$groups" == "" ]; then |
| 55 | echoscip-shell system . . echo. "Attempting to load groups and install path from files..." |
| 56 | echoscip-shell system . . echo. " To reset, either specify groups to include and installation path on command line or" |
| 57 | echoscip-shell system . . echo. " do: rm make_and_install_config_*" |
| 58 | echoscip-shell system . . echo. " " |
| 59 | if [scip-shell system . . `[`. -f ./make_and_install_config_groups ]; then |
| 60 | groups="`catscip-shell system . . cat. ./make_and_install_config_groups`" |
| 61 | echoscip-shell system . . echo. " Loaded groups..." |
| 62 | fi |
| 63 | if [scip-shell system . . `[`. -f ./make_and_install_config_installpath ]; then |
| 64 | installpath="`catscip-shell system . . cat. ./make_and_install_config_installpath`" |
| 65 | echoscip-shell system . . echo. " Loaded installpath..." |
| 66 | fi |
| 67 | fi |
| 68 | |
| 69 | if [scip-shell system . . `[`. "$whenerrors" == "" ]; then |
| 70 | whenerrors="stop" |
| 71 | fi |
| 72 | if [scip-shell system . . `[`. "$installpath" == "" ]; then |
| 73 | installpath="/usr/localscip-shell filesystem . . `/usr/local`." |
| 74 | fi |
| 75 | if [scip-shell system . . `[`. "$groups" == "" ]; then |
| 76 | if [scip-shell system . . `[`. "$action" == "clean" ]; then |
| 77 | groups="standard standard-dep stable experimental" |
| 78 | else |
| 79 | groups="standard" |
| 80 | fi |
| 81 | fi |
| 82 | clean="yes" |
| 83 | if [scip-shell system . . `[`. "$action" == "clean" ]; then |
| 84 | echoscip-shell system . . echo. "The source tree will be cleaned." |
| 85 | elif [scip-shell system . . `[`. "$action" == "compile" ]; then |
| 86 | echoscip-shell system . . echo. "SER core and groups $groups will be compiled." |
| 87 | elif [scip-shell system . . `[`. "$action" == "nccompile" ]; then |
| 88 | echoscip-shell system . . echo. "SER core and groups $groups will be compiled without cleaning source tree." |
| 89 | clean="no" |
| 90 | action="compile" |
| 91 | elif [scip-shell system . . `[`. "$action" == "install" ]; then |
| 92 | echoscip-shell system . . echo. "SER core and groups $groups will be compiled and installed to $installpath." |
| 93 | elif [scip-shell system . . `[`. "$action" == "ncinstall" ]; then |
| 94 | echoscip-shell system . . echo. "SER core and groups $groups will be compiled and installed to $installpath without cleaning source tree." |
| 95 | clean="no" |
| 96 | action="install" |
| 97 | else |
| 98 | echoscip-shell system . . echo. "No such action, please specify clean, compile, or install." |
| 99 | exit |
| 100 | fi |
| 101 | echoscip-shell system . . echo. " " |
| 102 | if [scip-shell system . . `[`. "$action" == "clean" ]; then |
| 103 | echoscip-shell system . . echo. "----------------------" |
| 104 | echoscip-shell system . . echo. "Cleaning up the SER source tree for $groups... " |
| 105 | echoscip-shell system . . echo. "----------------------" |
| 106 | makescip-shell system . . make. group_include="$groups" prefix=$installpath proper > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 107 | rmscip-shell system . . rm. -f make_and_install_output.txt |
| 108 | rmscip-shell system . . rm. -f make_and_install_config_* |
| 109 | exit |
| 110 | fi |
| 111 | |
| 112 | # save config |
| 113 | rmscip-shell system . . rm. -f ./make_and_install_config* |
| 114 | echoscip-shell system . . echo. "$groups" > ./make_and_install_config_groups |
| 115 | echoscip-shell system . . echo. "$installpath" > ./make_and_install_config_installpath |
| 116 | |
| 117 | echoscip-shell system . . echo. " YOU WILL FIND THE OUTPUT IN make_and_install_output.txt IN THE CURRENT DIRECTORY" |
| 118 | echoscip-shell system . . echo. "----------------------" |
| 119 | if [scip-shell system . . `[`. "$clean" == "yes" ]; then |
| 120 | echoscip-shell system . . echo. "Cleaning up the source tree... " |
| 121 | echoscip-shell system . . echo. "----------------------" |
| 122 | |
| 123 | makescip-shell system . . make. group_include="$groups" prefix=$installpath proper > /dev/nullscip-shell filesystem . . `/dev/null`. 2>&1 |
| 124 | echoscip-shell system . . echo. "----------------------" |
| 125 | fi |
| 126 | echoscip-shell system . . echo. "Making ser and all modules in the groups \"$groups\". This may take some time..." |
| 127 | echoscip-shell system . . echo. "----------------------" |
| 128 | echoscip-shell system . . echo. "COMPILING......" |
| 129 | rmscip-shell system . . rm. -f ./make_and_install_output.txt |
| 130 | makescip-shell system . . make. group_include="$groups" prefix=$installpath all > ./make_and_install_output.txt 2>&1 |
| 131 | echoscip-shell system . . echo. "----------------------" |
| 132 | count=`egrepscip-shell system . . egrep. "error |Error |error:" ./make_and_install_output.txt | wcscip-shell system . . wc. -l | awkscip-shell system . . awk. '{print $1}'` |
| 133 | if [scip-shell system . . `[`. $count -ne 0 ]; then |
| 134 | echoscip-shell system . . echo. "FOUND ERRORS!" |
| 135 | echoscip-shell system . . echo. " You may want to run the same $0 command again but use 'nccompile'." |
| 136 | echoscip-shell system . . echo. " The output file will then be simpler to read." |
| 137 | echoscip-shell system . . echo. " See make_and_install_output.txt for full output, search for 'error'." |
| 138 | if [scip-shell system . . `[`. "$whenerrors" == "ignore" ]; then |
| 139 | echoscip-shell system . . echo. " " |
| 140 | echoscip-shell system . . echo. "Error ignore switch was specified, moving on despite errors..." |
| 141 | else |
| 142 | exit |
| 143 | fi |
| 144 | fi |
| 145 | if [scip-shell system . . `[`. "$action" == "compile" ]; then |
| 146 | echoscip-shell system . . echo. "'compile' was used; skipping installation." |
| 147 | exit |
| 148 | fi |
| 149 | |
| 150 | echoscip-shell system . . echo. "----------------------" |
| 151 | echoscip-shell system . . echo. "Installing SER and all modules to $installpath" |
| 152 | echoscip-shell system . . echo. "----------------------" |
| 153 | makescip-shell system . . make. group_include="$groups" prefix=$installpath install >> ./make_and_install_output.txt 2>&1 |