-
Notifications
You must be signed in to change notification settings - Fork 27
/
Copy pathget-rad-image.sh
executable file
·46 lines (41 loc) · 1.05 KB
/
get-rad-image.sh
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
41
42
43
44
45
46
#!/bin/bash
function usage() {
echo "usage: get-rad-image.sh [-hf]"
echo
echo "Download the rad-image script from https://radanalytics.io and modify it to support the optional R image"
echo
echo "Options:"
echo " -h Print this help message"
echo " -f Force download and overwrite of rad-image"
}
FORCE=false
while getopts fh option; do
case $option in
h)
usage
exit 0
;;
f)
FORCE=true
;;
*)
;;
esac
done
shift $((OPTIND-1))
if [ -f rad-image ]; then
if [ "$FORCE" == "true" ]; then
rm rad-image
else
echo rad-image is already downloaded, exiting
exit 0
fi
fi
wget https://radanalytics.io/assets/tools/rad-image
# Change the IMAGESTREAMS variable to include R
IS=$(grep "IMAGESTREAMS=" rad-image)
if ! [[ "$IS" = *"radanalytics-r-spark"* ]]; then
echo Adding R image to supported images
sed -i 's/IMAGESTREAMS="/IMAGESTREAMS="radanalytics-r-spark /' rad-image
fi
chmod +x rad-image