-
Notifications
You must be signed in to change notification settings - Fork 1
/
junos-space-packer.sh
48 lines (33 loc) · 1.41 KB
/
junos-space-packer.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
47
#!/bin/sh
export GOPATH=$HOME/go
export PATH=$PATH:$GOPATH/bin
cwd=$(pwd)
if [ ! -d "$GOPATH/src/github.com/mitchellh/packer" ]; then
go get github.com/mitchellh/packer
fi
if [ ! -f "$GOPATH/src/github.com/mitchellh/junos-space-packer.flag" ]; then
echo "true" >> $GOPATH/src/github.com/mitchellh/junos-space-packer.flag
cd $GOPATH/src/github.com/mitchellh/
sudo -E rm -rf ./packer/
git clone https://github.com/lamoni/packer packer
cd packer/
git fetch
git checkout issue2972-ssh_host-virtualbox
git pull
sudo -E make
fi
cd $cwd
mkdir -p http
if [ ! "$(ls -A http/jsnap.rpm)" ]; then
# Download JSNAP
python ./lib/juniper-support-scraper/juniper-support-scraper.py --output-name "http/jsnap.rpm" https://webdownload.juniper.net/swdl/dl/secure/site/1/record/12595.html $1 $2
fi
if [ ! "$(ls -A http/servicenow.img)" ]; then
# Download Service Now
python ./lib/juniper-support-scraper/juniper-support-scraper.py --output-name "http/servicenow.img" https://webdownload.juniper.net/swdl/dl/anon/site/1/record/60879.html $1 $2
fi
if [ ! "$(ls -A http/space.ova)" ]; then
# Download Junos Space
python ./lib/juniper-support-scraper/juniper-support-scraper.py --output-name "http/space.ova" https://webdownload.juniper.net/swdl/dl/secure/site/1/record/62382.html $1 $2
fi
$GOPATH/src/github.com/mitchellh/packer/bin/packer build -var-file=variables.json space-packer.json