Merge pull request #14 from nealvis/aws_workaround
[platform/adaptation/npu/intel-libmvnc.git] / install.sh
1 #! /bin/bash
2
3 # download the file
4 cp ncsdk.conf /tmp
5
6 rm -f /tmp/ncsdk_redirector.txt
7
8 if [ -f ncsdk_redirector.txt ]
9 then
10         cp ncsdk_redirector.txt /tmp
11         cd /tmp
12 else
13         cd /tmp
14         #wget --no-cache http://ncs-forum-uploads.s3.amazonaws.com/ncsdk/ncsdk_01_12/ncsdk_redirector.txt
15         wget --no-cache -O ncsdk_redirector.txt "https://ncs-forum-uploads.s3-us-west-1.amazonaws.com/ncsdk/ncsdk_01_012_B/ncsdk_redirector.txt?X-Amz-Algorithm=AWS4-HMAC-SHA256&X-Amz-Credential=AKIAJPV7SAH5YZ2U3ARA/20180314/us-west-1/s3/aws4_request&X-Amz-Date=20180314T233615Z&X-Amz-Expires=604800&X-Amz-SignedHeaders=host&X-Amz-Signature=8886c9b49d0017ef736c9d226ff6763552f46fa501163fcbe769035c63b84456"
16 fi
17
18 download_filename=NCSDK-1.12.tar.gz
19
20 # redirector is the url from redirector text file
21 redirector=$(<ncsdk_redirector.txt)
22
23 # ncsdk_link is the url with '\r' deleted if it exists
24 # would probably be from editing in windows/dos
25 ncsdk_link=$(echo "$redirector" | tr -d '\r')
26
27 # download the payload from the redirector link
28 # and save it the download_filename no matter what the original filename was
29 wget --no-cache -O ${download_filename} $ncsdk_link
30
31 # Get the filenames, ncsdk_archive is just the download filename
32 # and ncsdk_pkg is the filename without the .tar.gz
33 #ncsdk_archive=$(echo "$ncsdk_link" | grep -o '[^/]*$')
34 ncsdk_archive=${download_filename}
35 ncsdk_pkg=${ncsdk_archive%%.tar.gz}
36
37 # now install-ncsdk.sh is doing the uninstallation if necessary.
38 # Remove older installation dirs
39 #if [ -f /opt/movidius/uninstall-ncsdk.sh ] 
40 #then
41 #       echo "Removing previous install..."
42 #       /opt/movidius/uninstall-ncsdk.sh
43 #fi
44
45 # Create Required installation dirs
46 sudo mkdir -p /opt/movidius
47 sudo cp $ncsdk_archive /opt/movidius/ncsdk.tar.gz
48 cd /opt/movidius/
49
50 # untar the new install and run the install script
51 sudo tar zxvf ./ncsdk.tar.gz
52 sudo rm -rf NCSDK
53 sudo mv $ncsdk_pkg* NCSDK
54 cd /opt/movidius/NCSDK
55 cp /tmp/ncsdk.conf .
56 ./install-ncsdk.sh
57
58 # leave the uninstall script on the target
59 #sudo cp ./uninstall-ncsdk.sh ../ncsdk/
60
61 # cleanup
62 cd ..
63 sudo rm ncsdk.tar.gz
64 #sudo rm -r NCSDK
65 sudo rm -f /tmp/${ncsdk_archive}
66
67
68
69