cdde6eff077a458f2f2e3ec493fba6182b112fb1
[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_installer_supported $INSTALLER_TYPE; then
19         die $LINENO"INSTALLER_TYPE=$INSTALLER_TYPE is not supported."
20     fi
21
22     source $TOP_DIR/lib/installers/$INSTALLER_TYPE
23
24     if ! is_set INSTALLER_IP; then
25         get_installer_ip
26     fi
27
28     installer_get_ssh_keys
29     installer_apply_patches
30 }
31
32 function cleanup_installer {
33     cleanup_installer_$INSTALLER_TYPE
34 }