| 1 | #########################################################################
|
|---|
| 2 | #
|
|---|
| 3 | # Subroutines for installing
|
|---|
| 4 | #
|
|---|
| 5 | #########################################################################
|
|---|
| 6 |
|
|---|
| 7 | getconfopts () {
|
|---|
| 8 | fconf="$1"
|
|---|
| 9 |
|
|---|
| 10 | if test -f "$fconf"
|
|---|
| 11 | then
|
|---|
| 12 | #
|
|---|
| 13 | # check if readable
|
|---|
| 14 | #
|
|---|
| 15 | cat "$fconf" >/dev/null 2>&1 || return 1
|
|---|
| 16 | #
|
|---|
| 17 | # empty string if no --enable-nocl=..., else password
|
|---|
| 18 | #
|
|---|
| 19 | is_nocl=`cat "$fconf" | tr -d '\n' | egrep "^ *'?--enable-nocl=" | sed -e "s%^ *%%" | sed -e "s%^'%%" | sed -e "s%^--enable-nocl=%%" | sed -e "s% *$%%" | sed -e "s%'$%%"`
|
|---|
| 20 | if test x"${is_nocl}" = x
|
|---|
| 21 | then
|
|---|
| 22 | is_nocl="start"
|
|---|
| 23 | else
|
|---|
| 24 | printINFO "Option --enable-nocl=${is_nocl} used."
|
|---|
| 25 | fi
|
|---|
| 26 | #
|
|---|
| 27 | #
|
|---|
| 28 | #
|
|---|
| 29 | is_xor=`cat "$fconf" | tr -d '\n' | egrep "^ *'?--enable-stealth=" | sed -e "s%^ *%%" | sed -e "s%^'%%" | sed -e "s%^--enable-nocl=%%" | sed -e "s% *$%%" | sed -e "s%'$%%"`
|
|---|
| 30 | if test x"${is_xor}" = x
|
|---|
| 31 | then
|
|---|
| 32 | is_xor="no"
|
|---|
| 33 | else
|
|---|
| 34 | printINFO "Option --enable-stealth=${is_xor} used."
|
|---|
| 35 | fi
|
|---|
| 36 | return 0
|
|---|
| 37 | else
|
|---|
| 38 | return 1
|
|---|
| 39 | fi
|
|---|
| 40 | }
|
|---|
| 41 |
|
|---|
| 42 | writerecord () {
|
|---|
| 43 | IDATE=`date +"%Y-%m-%d %H:%M:%S"`
|
|---|
| 44 | echo " <client>"
|
|---|
| 45 | echo " <client_host>${host}</client_host>"
|
|---|
| 46 | echo " <client_os_machine>${arch}</client_os_machine>"
|
|---|
| 47 | echo " <client_install_status>${install_entry}</client_install_status>"
|
|---|
| 48 | echo " <client_install_date>${IDATE}</client_install_date>"
|
|---|
| 49 | echo " <client_install_name>${SH_NAME}</client_install_name>"
|
|---|
| 50 | echo " <client_install_prefix>${SH_PREFIX}</client_install_prefix>"
|
|---|
| 51 | echo " <client_install_version>${src_version}.${realformat}</client_install_version>"
|
|---|
| 52 | echo " </client>"
|
|---|
| 53 | }
|
|---|
| 54 |
|
|---|
| 55 | FTEST=0
|
|---|
| 56 |
|
|---|
| 57 | set_flag () {
|
|---|
| 58 | case "$line" in
|
|---|
| 59 | *\</client\>*)
|
|---|
| 60 | FTEST=0;
|
|---|
| 61 | return 0;
|
|---|
| 62 | ;;
|
|---|
| 63 |
|
|---|
| 64 | *\<client_host\>${host}\</client_host\>*)
|
|---|
| 65 | FTEST=1;
|
|---|
| 66 | return 1;
|
|---|
| 67 | ;;
|
|---|
| 68 |
|
|---|
| 69 | *)
|
|---|
| 70 | return ${FTEST};
|
|---|
| 71 | ;;
|
|---|
| 72 | esac
|
|---|
| 73 | }
|
|---|
| 74 |
|
|---|
| 75 |
|
|---|
| 76 | #------------------------------------------------------------------------
|
|---|
| 77 | # Update client db
|
|---|
| 78 | #------------------------------------------------------------------------
|
|---|
| 79 | updateDB() {
|
|---|
| 80 |
|
|---|
| 81 | if test "x$1" = x
|
|---|
| 82 | then
|
|---|
| 83 | install_entry="D2_installed"
|
|---|
| 84 | else
|
|---|
| 85 | install_entry="$1"
|
|---|
| 86 | fi
|
|---|
| 87 | export install_entry
|
|---|
| 88 |
|
|---|
| 89 | if test x"$DATABASE" = x
|
|---|
| 90 | then
|
|---|
| 91 | DATABASE="${basedir}/${defdatabase}"
|
|---|
| 92 | fi
|
|---|
| 93 |
|
|---|
| 94 | updlock="${DATABASE}.lockdir"
|
|---|
| 95 | trap "rm -rf ${updlock}" 1 2 13 15
|
|---|
| 96 |
|
|---|
| 97 | #
|
|---|
| 98 | # A lockfile will not work, because 'root' can write anyway.
|
|---|
| 99 | # However, 'mkdir' an existing directory will fail even for root
|
|---|
| 100 | #
|
|---|
| 101 | until (umask 222; mkdir "${updlock}") 2>/dev/null # test & set
|
|---|
| 102 | do
|
|---|
| 103 | printINFO "Waiting for lock"
|
|---|
| 104 | sleep 1
|
|---|
| 105 | done
|
|---|
| 106 |
|
|---|
| 107 |
|
|---|
| 108 | IDATE=`date +"%Y-%m-%d %H:%M:%S"`
|
|---|
| 109 | rm -f "$tmpF"; touch "$tmpF"
|
|---|
| 110 |
|
|---|
| 111 | if test -f "$DATABASE"; then
|
|---|
| 112 | rcfile_perm=`ls -l "${DATABASE}" | \
|
|---|
| 113 | awk '{ u= substr($1,2,3); g=substr($1,5,3); o=substr($1,8,3); \
|
|---|
| 114 | gsub("-","",u); gsub("-","",g); gsub("-","",o); \
|
|---|
| 115 | print "u=" u ",g=" g ",o=" o; }'`
|
|---|
| 116 | rcfile_perm=`echo ${rcfile_perm} | sed s%g=,%g-rwx,% | sed s%,o=$%,o-rwx%`
|
|---|
| 117 | rcfile_owner=`ls -l "${DATABASE}" | \
|
|---|
| 118 | awk '{print $3 }'`
|
|---|
| 119 | rcfile_group=`ls -l "${DATABASE}" | \
|
|---|
| 120 | awk '{print $4 }'`
|
|---|
| 121 | else
|
|---|
| 122 | rcfile_perm=640;
|
|---|
| 123 | rcfile_owner=`ls -ld ${basedir} | awk '{print $3 }'`
|
|---|
| 124 | rcfile_group=`ls -ld ${basedir} | awk '{print $4 }'`
|
|---|
| 125 | fi
|
|---|
| 126 |
|
|---|
| 127 |
|
|---|
| 128 | if test -f "${DATABASE}"
|
|---|
| 129 | then
|
|---|
| 130 | SStr1=`grep '<yule_db>' "${DATABASE}"`
|
|---|
| 131 | if test "x${SStr1}" != "x"
|
|---|
| 132 | then
|
|---|
| 133 |
|
|---|
| 134 | SStr2=`grep "<client_host>${host}</client_host>" "${DATABASE}"`
|
|---|
| 135 |
|
|---|
| 136 | SStr3=
|
|---|
| 137 |
|
|---|
| 138 | if test "x${SStr2}" != "x"
|
|---|
| 139 | then
|
|---|
| 140 | # REPLACE
|
|---|
| 141 |
|
|---|
| 142 | printINFO "Replace ${host} in ${DATABASE}"
|
|---|
| 143 |
|
|---|
| 144 | exec 3<&0 <"${DATABASE}"
|
|---|
| 145 | while
|
|---|
| 146 | read line
|
|---|
| 147 | do
|
|---|
| 148 | # for some reason, var=xx only works in a function call (why?)
|
|---|
| 149 | #
|
|---|
| 150 | # here we test if we are still in the same client block
|
|---|
| 151 | # (set_flag will return 0 for </client> and following)
|
|---|
| 152 | set_flag "$line"
|
|---|
| 153 |
|
|---|
| 154 | if test "x$?" = "x1"
|
|---|
| 155 | then
|
|---|
| 156 | case "$line" in
|
|---|
| 157 | *\<client_os_machine\>*\</client_os_machine\>)
|
|---|
| 158 | echo " <client_os_machine>${arch}</client_os_machine>" >>"${tmpF}"
|
|---|
| 159 | echo " <client_install_status>${install_entry}</client_install_status>" >>"${tmpF}"
|
|---|
| 160 | echo " <client_install_date>${IDATE}</client_install_date>" >>"${tmpF}"
|
|---|
| 161 | echo " <client_install_name>${SH_NAME}</client_install_name>" >>"${tmpF}"
|
|---|
| 162 | echo " <client_install_prefix>${SH_PREFIX}</client_install_prefix>" >>"${tmpF}"
|
|---|
| 163 | echo " <client_install_version>${src_version}.${realformat}</client_install_version>" >>"${tmpF}"
|
|---|
| 164 | ;;
|
|---|
| 165 |
|
|---|
| 166 | *\<client_install_status\>*\</client_install_status\>)
|
|---|
| 167 | # echo " <client_install_status>${install_entry}</client_install_status>" >>"${tmpF}"
|
|---|
| 168 | :
|
|---|
| 169 | ;;
|
|---|
| 170 |
|
|---|
| 171 | *\<client_install_date\>*\</client_install_date\>)
|
|---|
| 172 | # echo " <client_install_date>${IDATE}</client_install_date>" >>"${tmpF}"
|
|---|
| 173 | :
|
|---|
| 174 | ;;
|
|---|
| 175 |
|
|---|
| 176 | *\<client_install_name\>*\</client_install_name\>)
|
|---|
| 177 | # echo " <client_install_name>${SH_NAME}</client_install_name>" >>"${tmpF}"
|
|---|
| 178 | :
|
|---|
| 179 | ;;
|
|---|
| 180 |
|
|---|
| 181 | *\<client_install_prefix\>*\</client_install_prefix\>)
|
|---|
| 182 | # echo " <client_install_prefix>${SH_PREFIX}</client_install_prefix>" >>"${tmpF}"
|
|---|
| 183 | :
|
|---|
| 184 | ;;
|
|---|
| 185 |
|
|---|
| 186 | *\<client_install_version\>*\</client_install_version\>)
|
|---|
| 187 | # echo " <client_install_version>${src_version}.${realformat}</client_install_version>" >>"${tmpF}"
|
|---|
| 188 | :
|
|---|
| 189 | ;;
|
|---|
| 190 |
|
|---|
| 191 | *)
|
|---|
| 192 | echo "$line" >>"${tmpF}"
|
|---|
| 193 | ;;
|
|---|
| 194 |
|
|---|
| 195 | esac
|
|---|
| 196 | else
|
|---|
| 197 | echo "$line" >>"${tmpF}"
|
|---|
| 198 | fi
|
|---|
| 199 |
|
|---|
| 200 | done
|
|---|
| 201 | exec 0<&3 3<&-
|
|---|
| 202 | cp "${tmpF}" "${DATABASE}"
|
|---|
| 203 | else
|
|---|
| 204 | # WRITE NEW CLIENT RECORD
|
|---|
| 205 |
|
|---|
| 206 | printINFO "Write record for ${host} in ${DATABASE}"
|
|---|
| 207 |
|
|---|
| 208 | exec 3<&0 <"${DATABASE}"
|
|---|
| 209 | while
|
|---|
| 210 | read line
|
|---|
| 211 | do
|
|---|
| 212 | if test "x$line" = "x<yule_db>"
|
|---|
| 213 | then
|
|---|
| 214 | echo "$line" >>"${tmpF}"
|
|---|
| 215 | writerecord >>"${tmpF}"
|
|---|
| 216 | else
|
|---|
| 217 | echo "$line" >>"${tmpF}"
|
|---|
| 218 | fi
|
|---|
| 219 | done
|
|---|
| 220 | exec 0<&3 3<&-
|
|---|
| 221 | cp "${tmpF}" "${DATABASE}"
|
|---|
| 222 | fi
|
|---|
| 223 | else
|
|---|
| 224 | # COMPLAIN
|
|---|
| 225 | printLOG "File ${DATABASE} exists, but has wrong format";
|
|---|
| 226 | fi
|
|---|
| 227 | else
|
|---|
| 228 | # WRITE XML FROM SCRATCH
|
|---|
| 229 | printINFO "Write ${DATABASE} from scratch"
|
|---|
| 230 | echo '<?xml version="1.0" encoding="ISO-8859-1"?>' >"${tmpF}"
|
|---|
| 231 | echo '<!DOCTYPE yule_db SYSTEM "http://la-samhna.de/yule_db-0.1.dtd">' \
|
|---|
| 232 | >>"${tmpF}"
|
|---|
| 233 | echo "<yule_db>" >>"${tmpF}"
|
|---|
| 234 | writerecord >>"${tmpF}"
|
|---|
| 235 | echo "</yule_db>" >>"${tmpF}"
|
|---|
| 236 | cp "${tmpF}" "${DATABASE}"
|
|---|
| 237 | fi
|
|---|
| 238 |
|
|---|
| 239 | chown ${rcfile_owner}:${rcfile_group} "${DATABASE}"
|
|---|
| 240 | if [ $? -ne 0 ]; then
|
|---|
| 241 | rm -rf "${updlock}"
|
|---|
| 242 | printFATAL "Could not chown ${rcfile_owner}:${rcfile_group} ${DATABASE}"
|
|---|
| 243 | fi
|
|---|
| 244 | chmod ${rcfile_perm} "${DATABASE}"
|
|---|
| 245 | if [ $? -ne 0 ]; then
|
|---|
| 246 | rm -rf "${updlock}"
|
|---|
| 247 | printFATAL "Could not chmod ${rcfile_perm} ${DATABASE}"
|
|---|
| 248 | fi
|
|---|
| 249 |
|
|---|
| 250 | rm -rf "${updlock}"
|
|---|
| 251 | }
|
|---|
| 252 |
|
|---|
| 253 |
|
|---|
| 254 | ageFILE() {
|
|---|
| 255 | file="$1"
|
|---|
| 256 |
|
|---|
| 257 | if test -f "${file}"
|
|---|
| 258 | then
|
|---|
| 259 | test -f "${file}.9" && { rm -f "${file}.9" || printFATAL "rm -f ${file}.9 failed."; }
|
|---|
| 260 | test -f "${file}.8" && { mv "${file}.8" "${file}.9" || printFATAL "mv ${file}.8 ${file}.9 failed."; }
|
|---|
| 261 | test -f "${file}.7" && { mv "${file}.7" "${file}.8" || printFATAL "mv ${file}.7 ${file}.8 failed."; }
|
|---|
| 262 | test -f "${file}.6" && { mv "${file}.6" "${file}.7" || printFATAL "mv ${file}.6 ${file}.7 failed."; }
|
|---|
| 263 | test -f "${file}.5" && { mv "${file}.5" "${file}.6" || printFATAL "mv ${file}.5 ${file}.6 failed."; }
|
|---|
| 264 | test -f "${file}.4" && { mv "${file}.4" "${file}.5" || printFATAL "mv ${file}.4 ${file}.5 failed."; }
|
|---|
| 265 | test -f "${file}.3" && { mv "${file}.3" "${file}.4" || printFATAL "mv ${file}.3 ${file}.4 failed."; }
|
|---|
| 266 | test -f "${file}.2" && { mv "${file}.2" "${file}.3" || printFATAL "mv ${file}.2 ${file}.3 failed."; }
|
|---|
| 267 | test -f "${file}.1" && { mv "${file}.1" "${file}.2" || printFATAL "mv ${file}.1 ${file}.2 failed."; }
|
|---|
| 268 | test -f "${file}" && { mv "${file}" "${file}.1" || printFATAL "mv ${file} ${file}.1 failed."; }
|
|---|
| 269 | fi
|
|---|
| 270 | return 0;
|
|---|
| 271 | }
|
|---|
| 272 |
|
|---|
| 273 | #------------------------------------------------------------------------
|
|---|
| 274 | # The path to yule data
|
|---|
| 275 | #------------------------------------------------------------------------
|
|---|
| 276 | pathYDATA() {
|
|---|
| 277 | if test "x${yule_data}" = x
|
|---|
| 278 | then
|
|---|
| 279 | promptINPUT "Please enter the path to your yule executable"
|
|---|
| 280 | yule_data="$INPUT"; export yule_data
|
|---|
| 281 | fi
|
|---|
| 282 | if test -d "${yule_data}"
|
|---|
| 283 | then
|
|---|
| 284 | :
|
|---|
| 285 | else
|
|---|
| 286 | printFATAL "Path to yule data directory not given."
|
|---|
| 287 | fi
|
|---|
| 288 | }
|
|---|
| 289 |
|
|---|
| 290 | #------------------------------------------------------------------------
|
|---|
| 291 | # The path to yule
|
|---|
| 292 | #------------------------------------------------------------------------
|
|---|
| 293 | pathYULE() {
|
|---|
| 294 |
|
|---|
| 295 | if test "x${yule_exec}" = x
|
|---|
| 296 | then
|
|---|
| 297 | findEXE yule
|
|---|
| 298 | if test -n "$EXECUTABLE"
|
|---|
| 299 | then
|
|---|
| 300 | yule_exec="$EXECUTABLE"
|
|---|
| 301 | export yule_exec
|
|---|
| 302 | fi
|
|---|
| 303 | else
|
|---|
| 304 | if test -f "${yule_exec}"
|
|---|
| 305 | then
|
|---|
| 306 | :
|
|---|
| 307 | else
|
|---|
| 308 | yule_exec=""
|
|---|
| 309 | findEXE yule
|
|---|
| 310 | if test -n "$EXECUTABLE"
|
|---|
| 311 | then
|
|---|
| 312 | yule_exec="$EXECUTABLE"
|
|---|
| 313 | export yule_exec
|
|---|
| 314 | fi
|
|---|
| 315 | fi
|
|---|
| 316 | fi
|
|---|
| 317 | if test "x${yule_exec}" = x
|
|---|
| 318 | then
|
|---|
| 319 | promptINPUT "Please enter the path to your yule executable"
|
|---|
| 320 | yule_exec="$INPUT"; export yule_exec
|
|---|
| 321 | fi
|
|---|
| 322 | if test -f "${yule_exec}"
|
|---|
| 323 | then
|
|---|
| 324 | if "${yule_exec}" --help 2>&1 | grep qualified >/dev/null 2>&1
|
|---|
| 325 | then
|
|---|
| 326 | :
|
|---|
| 327 | else
|
|---|
| 328 | printFATAL "${yule_exec} is not Yule, or not executable."
|
|---|
| 329 | fi
|
|---|
| 330 | else
|
|---|
| 331 | printFATAL "Path to yule executable directory not given."
|
|---|
| 332 | fi
|
|---|
| 333 | }
|
|---|
| 334 |
|
|---|
| 335 | #------------------------------------------------------------------------
|
|---|
| 336 | # Select operating system
|
|---|
| 337 | #------------------------------------------------------------------------
|
|---|
| 338 | selbinARCH() {
|
|---|
| 339 | #---------------------------------------------------------------------
|
|---|
| 340 | # Select arch to build
|
|---|
| 341 | #---------------------------------------------------------------------
|
|---|
| 342 | if test x"$arch" = x
|
|---|
| 343 | then
|
|---|
| 344 | if test x"$assumeyes" = x1
|
|---|
| 345 | then
|
|---|
| 346 | printFATAL "No operating system selected, aborting."
|
|---|
| 347 | fi
|
|---|
| 348 | cd "$basedir/archpkg" || printFATAL "Cannot cd to $basedir/archpkg !"
|
|---|
| 349 | LIST=`ls 2>/dev/null`
|
|---|
| 350 | if test x"$LIST" = x
|
|---|
| 351 | then
|
|---|
| 352 | printFATAL "No OS directories found in ${basedir}/archpkg."
|
|---|
| 353 | fi
|
|---|
| 354 |
|
|---|
| 355 | n=0
|
|---|
| 356 | command="promptMENU 'Please select operating system of host' "
|
|---|
| 357 | ALIST=""
|
|---|
| 358 | FLIST=""
|
|---|
| 359 | for ff in $LIST
|
|---|
| 360 | do
|
|---|
| 361 | haspkg=`ls $ff/samhain-* 2>/dev/null`
|
|---|
| 362 | if test x"$haspkg" = x
|
|---|
| 363 | then
|
|---|
| 364 | :
|
|---|
| 365 | else
|
|---|
| 366 | n=`expr $n + 1`
|
|---|
| 367 | osp="$ff"
|
|---|
| 368 | ALIST="$ALIST $ff"
|
|---|
| 369 | FLIST="$FLIST $ff"
|
|---|
| 370 | if test $n -lt 8
|
|---|
| 371 | then
|
|---|
| 372 | command="$command '${ff}'"
|
|---|
| 373 | fi
|
|---|
| 374 | fi
|
|---|
| 375 | done
|
|---|
| 376 | if test $n -ge 8
|
|---|
| 377 | then
|
|---|
| 378 | command="$command other"
|
|---|
| 379 | fi
|
|---|
| 380 |
|
|---|
| 381 | eval ${command}
|
|---|
| 382 | m=$?
|
|---|
| 383 | if test x$m = x1
|
|---|
| 384 | then
|
|---|
| 385 | (exit 0); exit 0;
|
|---|
| 386 | elif test x$m = "x-1"
|
|---|
| 387 | then
|
|---|
| 388 | printFATAL "Something went wrong !"
|
|---|
| 389 | else
|
|---|
| 390 | arch="$MENU"; export arch
|
|---|
| 391 | if test x"$arch" = xother
|
|---|
| 392 | then
|
|---|
| 393 | promptINPUT "Please select operating system of host from $FLIST"
|
|---|
| 394 | if test x$m = x1
|
|---|
| 395 | then
|
|---|
| 396 | (exit 0); exit 0;
|
|---|
| 397 | elif test x$m = "x-1"
|
|---|
| 398 | then
|
|---|
| 399 | printFATAL "Something went wrong !"
|
|---|
| 400 | else
|
|---|
| 401 | found=`echo $FLIST | sed -n /$INPUT/p 2>/dev/null`
|
|---|
| 402 | if test x"$found" = x
|
|---|
| 403 | then
|
|---|
| 404 | printFATAL "There is no package for $INPUT"
|
|---|
| 405 | fi
|
|---|
| 406 | arch="$INPUT"; export arch
|
|---|
| 407 | fi
|
|---|
| 408 | fi
|
|---|
| 409 | fi
|
|---|
| 410 | fi
|
|---|
| 411 | # arch selected or exited
|
|---|
| 412 | }
|
|---|
| 413 |
|
|---|
| 414 | selbinVERSION() {
|
|---|
| 415 |
|
|---|
| 416 | OKVERLIST=""
|
|---|
| 417 |
|
|---|
| 418 | #---------------------------------------------------------------------
|
|---|
| 419 | # Select version
|
|---|
| 420 | #---------------------------------------------------------------------
|
|---|
| 421 | if test x"$src_version" = x
|
|---|
| 422 | then
|
|---|
| 423 | if test x"$assumeyes" = x1
|
|---|
| 424 | then
|
|---|
| 425 | printFATAL "No version selected, aborting."
|
|---|
| 426 | fi
|
|---|
| 427 | cd "${basedir}/archpkg/${arch}" || printFATAL "Cannot cd to ${basedir}/archpkg/${arch} !"
|
|---|
| 428 | LIST=`ls samhain-* 2>/dev/null`
|
|---|
| 429 | if test x"$LIST" = x
|
|---|
| 430 | then
|
|---|
| 431 | printFATAL "No binary package found in ${basedir}/archpkg/${arch}."
|
|---|
| 432 | fi
|
|---|
| 433 |
|
|---|
| 434 | # --------------------------------------------------
|
|---|
| 435 | # Build a list of ${version}.${format}
|
|---|
| 436 | # --------------------------------------------------
|
|---|
| 437 |
|
|---|
| 438 | for ff in $LIST
|
|---|
| 439 | do
|
|---|
| 440 | sh_version=`echo "$ff" | sed 's/samhain\-//g'`
|
|---|
| 441 | if test -f "install-${sh_version}"
|
|---|
| 442 | then
|
|---|
| 443 | OKVERLIST="$OKVERLIST ${sh_version}"
|
|---|
| 444 | fi
|
|---|
| 445 | done
|
|---|
| 446 |
|
|---|
| 447 | rm -f "$tmpF" && touch "$tmpF"
|
|---|
| 448 |
|
|---|
| 449 | for dd in $OKVERLIST
|
|---|
| 450 | do
|
|---|
| 451 | echo "$dd" >>"$tmpF"
|
|---|
| 452 | done
|
|---|
| 453 |
|
|---|
| 454 | OKVERLIST=`cat "$tmpF" | sort -r`
|
|---|
| 455 |
|
|---|
| 456 | rm -f "$tmpF" && touch "$tmpF"
|
|---|
| 457 |
|
|---|
| 458 | command="promptMENU 'Please select version to install' "
|
|---|
| 459 | for word in $OKVERLIST
|
|---|
| 460 | do
|
|---|
| 461 | command="$command '${word}'"
|
|---|
| 462 | done
|
|---|
| 463 |
|
|---|
| 464 | eval ${command}
|
|---|
| 465 | m=$?
|
|---|
| 466 | if test x$m = x1
|
|---|
| 467 | then
|
|---|
| 468 | (exit 0); exit 0;
|
|---|
| 469 | elif test x$m = "x-1"
|
|---|
| 470 | then
|
|---|
| 471 | printFATAL "Something went wrong !"
|
|---|
| 472 | else
|
|---|
| 473 | first_version="$MENU";
|
|---|
| 474 | fi
|
|---|
| 475 |
|
|---|
| 476 | src_version=`echo ${first_version} | sed s%\.run%% | sed s%\.rpm%% | sed s%\.deb%% | sed s%\.tbz2%% | sed s%\.depot%% | sed s%\.pkg%%`
|
|---|
| 477 | export src_version
|
|---|
| 478 |
|
|---|
| 479 | format=`echo ${first_version} | sed '/^\(.*\)\.\([0-9a-zA-Z]*\)$/{ s//\2/; q; }'`
|
|---|
| 480 | if test "x$format" = xpkg
|
|---|
| 481 | then
|
|---|
| 482 | format="solaris-pkg"
|
|---|
| 483 | fi
|
|---|
| 484 | export format
|
|---|
| 485 |
|
|---|
| 486 | fi
|
|---|
| 487 | }
|
|---|