-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathso-elastic-airgap-load
executable file
·60 lines (50 loc) · 1.16 KB
/
so-elastic-airgap-load
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
47
48
49
50
51
52
53
54
55
56
57
58
59
#!/bin/bash
# Source dir
DIR="."
SOURCE=""
#########################################
# Options
#########################################
usage()
{
cat <<EOF
Security Onion Docker Airgap Load
Options:
-h This message
-d Specify destination
EOF
}
#########################################
# Call functions
#########################################
# Check to see if the user provided a source directory for the Docker images.
while getopts "hd:y:" OPTION
do
case $OPTION in
h)
usage
exit 0
;;
s)
SOURCE="$OPTARG"
;;
esac
done
if [ "$SOURCE" != "" ]; then
DIR=$SOURCE
fi
# Extract images from archive and remove archive
if [ -f $DIR/images/images.tar ]; then
tar -xvf $DIR/images/images.tar
rm -f $DIR/images/images.tar
else
echo "No file to load!"
exit 0
fi
# Load Docker images
echo "Loading Docker images from $DIR/images/..."
for i in so-elasticsearch so-kibana so-logstash so-elastalert so-freqserver so-domainstats so-curator; do
docker load < $DIR/images/$i.tar
# Remove images as they are loaded to free disk space
#rm -f $DIR/images/$i.tar
done