Merge pull request #5 from kfezer/patch-1
[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_11/ncsdk_redirector.txt
15 fi
16
17 download_filename=NCSDK-1.11.tar.gz
18
19 # redirector is the url from redirector text file
20 redirector=$(<ncsdk_redirector.txt)
21
22 # ncsdk_link is the url with '\r' deleted if it exists
23 # would probably be from editing in windows/dos
24 ncsdk_link=$(echo "$redirector" | tr -d '\r')
25
26 # download the payload from the redirector link
27 # and save it the download_filename no matter what the original filename was
28 wget --no-cache -O ${download_filename} $ncsdk_link
29
30 # Get the filenames, ncsdk_archive is just the download filename
31 # and ncsdk_pkg is the filename without the .tar.gz
32 #ncsdk_archive=$(echo "$ncsdk_link" | grep -o '[^/]*$')
33 ncsdk_archive=${download_filename}
34 ncsdk_pkg=${ncsdk_archive%%.tar.gz}
35
36 # now install-ncsdk.sh is doing the uninstallation if necessary.
37 # Remove older installation dirs
38 #if [ -f /opt/movidius/uninstall-ncsdk.sh ] 
39 #then
40 #       echo "Removing previous install..."
41 #       /opt/movidius/uninstall-ncsdk.sh
42 #fi
43
44 # Create Required installation dirs
45 sudo mkdir -p /opt/movidius
46 sudo cp $ncsdk_archive /opt/movidius/ncsdk.tar.gz
47 cd /opt/movidius/
48
49 # untar the new install and run the install script
50 sudo tar zxvf ./ncsdk.tar.gz
51 sudo rm -rf NCSDK
52 sudo mv $ncsdk_pkg* NCSDK
53 cd /opt/movidius/NCSDK
54 cp /tmp/ncsdk.conf .
55 ./install-ncsdk.sh
56
57 # leave the uninstall script on the target
58 #sudo cp ./uninstall-ncsdk.sh ../ncsdk/
59
60 # cleanup
61 cd ..
62 sudo rm ncsdk.tar.gz
63 #sudo rm -r NCSDK
64 sudo rm -f /tmp/${ncsdk_archive}
65
66
67
68