-
Notifications
You must be signed in to change notification settings - Fork 0
/
nonfree.sh
executable file
·109 lines (102 loc) · 2.49 KB
/
nonfree.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
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
#!/bin/bash
source $(dirname $0)/env.sh
function chmdirs {
while true
do
dlist=$(2>/dev/null find ${MPLAB_C30_WIN32} -type d ! -executable )
if [ -n "${dlist}" ]
then
chmod 755 ${dlist}
else
return 0
fi
done
}
function chmfils {
if flist=$(find ${MPLAB_C30_WIN32} -type f ) && [ -n "${flist}" ]
then
if chmod 644 ${flist}
then
return 0
else
return 1
fi
else
return 1
fi
}
if [ -d ${MPLAB_C30_WIN32} ]
then
if [ -e ${MPLAB_C30_WIN32}/examples ]
then
sudo rm -rf ${MPLAB_C30_WIN32}/examples
fi
if [ -e ${MPLAB_C30_WIN32}/docs ]
then
sudo rm -rf ${MPLAB_C30_WIN32}/docs
fi
if chmdirs
then
if chmfils
then
if sudo mkdir -p ${C30_INSTALL}
then
if sudo cp -r ${MPLAB_C30_WIN32}/support ${C30_INSTALL}
then
if sudo cp -r ${MPLAB_C30_WIN32}/include ${C30_INSTALL}
then
if sudo cp -r ${MPLAB_C30_WIN32}/lib ${C30_INSTALL}
then
if sudo cp -p ${MPLAB_C30_WIN32}/bin/c30_device.info ${C30_INSTALL}/lib
then
if sudo ln -s ${C30_INSTALL}/lib/c30_device.info ${C30_INSTALL}/bin
then
if sudo ln -s ${C30_INSTALL}/lib/c30_device.info ${C30_INSTALL}/lib/gcc
then
if sudo ln -s ${C30_INSTALL}/lib/c30_device.info ${C30_INSTALL}/libexec/gcc/pic30-coff/4.0.2
then
exit 0
else
echo "$0 Error in 'ln -s ${C30_INSTALL}/lib/c30_device.info ${C30_INSTALL}/libexec/gcc/pic30-coff/4.0.2'."
exit 1
fi
else
echo "$0 Error in 'ln -s ${C30_INSTALL}/lib/c30_device.info ${C30_INSTALL}/lib/gcc'."
exit 1
fi
else
echo "$0 Error in 'ln -s ${C30_INSTALL}/lib/c30_device.info ${C30_INSTALL}/bin'."
exit 1
fi
else
echo "$0 Error in 'cp -p ${MPLAB_C30_WIN32}/bin/c30_device.info ${C30_INSTALL}/lib'."
exit 1
fi
else
echo "$0 Error in 'cp -r ${MPLAB_C30_WIN32}/lib ${C30_INSTALL}'."
exit 1
fi
else
echo "$0 Error in 'cp -r ${MPLAB_C30_WIN32}/include ${C30_INSTALL}'."
exit 1
fi
else
echo "$0 Error in 'cp -r ${MPLAB_C30_WIN32}/support ${C30_INSTALL}'."
exit 1
fi
else
echo "$0 Error unable to create directory ${C30_INSTALL}."
exit 1
fi
else
echo "$0 Error missing files under MPLAB_C30_WIN32=${MPLAB_C30_WIN32}."
exit 1
fi
else
echo "$0 Error missing directories under MPLAB_C30_WIN32=${MPLAB_C30_WIN32}."
exit 1
fi
else
echo "$0 Error directory not found MPLAB_C30_WIN32=${MPLAB_C30_WIN32}"
exit 1
fi