forked from pry0cc/axiom
-
Notifications
You must be signed in to change notification settings - Fork 81
Expand file tree
/
Copy pathaxiom-provider
More file actions
executable file
·44 lines (33 loc) · 1.08 KB
/
Copy pathaxiom-provider
File metadata and controls
executable file
·44 lines (33 loc) · 1.08 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
#!/bin/bash
AXIOM_PATH="$HOME/.axiom"
if [ -f "$AXIOM_PATH/interact/includes/vars.sh" ] ; then
source "$AXIOM_PATH/interact/includes/vars.sh"
fi
if [ -f "$AXIOM_PATH/interact/includes/functions.sh" ] ; then
source "$AXIOM_PATH/interact/includes/functions.sh"
fi
INCLUDE_PATH="$AXIOM_PATH/providers/"
SRC_FUNCTIONS="$AXIOM_PATH/interact/includes/functions.sh"
provisioner="$(jq -r '.provisioner' "$AXIOM_PATH"/axiom.json)"
options=$(ls -l "$INCLUDE_PATH" | grep "\-functions.sh" | awk '{ print $9 }' | sed 's/\-functions\.sh//g')
choice=false
if [ ! -z $1 ]
then
choice="$1"
fi
if [[ "$choice" != "false" ]]
then
CHOICE_FUNCTIONS="$INCLUDE_PATH/$choice-functions.sh"
if [ -f "$CHOICE_FUNCTIONS" ]
then
echo -e "${BWhite}Setting axiom provider to '$choice'${Color_Off}"
"$AXIOM_PATH/interact/generate_packer" "$choice" "$provisioner" > /dev/null 2>&1
if [ -f "$SRC_FUNCTIONS" ] ; then
rm "$SRC_FUNCTIONS"
fi
ln -s "$CHOICE_FUNCTIONS" "$SRC_FUNCTIONS"
echo -e "${BGreen}Provider set successfully${Color_Off}"
fi
else
echo $options | tr ' ' '\n'
fi