improve cleanup() in run.sh
[doctor.git] / tests / lib / installer
1 #!/bin/bash
2
3 INSTALLER_TYPE=${INSTALLER_TYPE:-local}
4 INSTALLER_IP=${INSTALLER_IP:-none}
5 ssh_opts_cpu="$ssh_opts"
6
7 function is_installer_supported {
8     local installer="$1"
9     [[ -f $TOP_DIR/lib/installers/$installer ]]
10 }
11
12 function is_installer {
13     local installer="$1"
14     [[ $installer == $INSTALLER_TYPE ]]
15 }
16
17 function setup_installer {
18     if ! is_set INSTALLER_IP; then
19         get_installer_ip
20     fi
21
22     installer_get_ssh_keys
23     installer_apply_patches
24 }
25
26 function cleanup_installer {
27     cleanup_installer_$INSTALLER_TYPE
28 }
29
30
31 if ! is_installer_supported $INSTALLER_TYPE; then
32     die $LINENO"INSTALLER_TYPE=$INSTALLER_TYPE is not supported."
33 fi
34
35 source $TOP_DIR/lib/installers/$INSTALLER_TYPE