Repository navigation
Expand file tree
/
Copy pathcan_stuff_install.sh
More file actions
139 lines (118 loc) · 2.31 KB
/
Copy pathcan_stuff_install.sh
File metadata and controls
139 lines (118 loc) · 2.31 KB
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
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
#! /bin/bash
#=================================================================================
# A script to install ICSim by Craig Smith, can-utils, and dependancies.
# Author: David Lambert MCSE, BSCS DavidLambertCyber@gmail.com
#
# run as root
# tested on ubuntu 14.04 LTS amd64
# the sleep commands are overkill as a simple wait command
#================================================================================
# The directory you want to install can-utils and ICSim
# use full path with training slash
# a change here will require a change in icsim_start.sh
INSTALLDIR='/usr/share/'
#===== functions =================================================================
install_icsim()
{
# get icsim
cd $INSTALLDIR
git clone https://github.com/zombieCraig/ICSim.git
cd "$INSTALLDIR"'ICSim/'
make
sleep 1
make install
}
install_can_utils()
{
# clone can-utils
cd $INSTALLDIR
git clone https://git.gitorious.org/linux-can/can-utils.git
sleep 1
# make can-utils
cd "$INSTALLDIR"'can-utils/'
sleep 1
make
sleep 1
make install
sleep 1
}
update_can_utils()
{
cd "$INSTALLDIR"'can-utils/'
git pull
sleep 1
make clean
sleep 1
make
sleep 1
make install
}
update_icsim()
{
cd "$INSTALLDIR"'ICSim/'
git pull
sleep 1
make clean
sleep 1
make
}
first_install()
{
# dependancies
apt-get install -y libsdl2-2.0-0 libsdl2-dev libsdl2-image-2.0-0 libsdl2-image-dev git make gcc
sleep 1
install_icsim
install_can_utils
}
complete()
{
# done
echo " $0 is complete"
echo ' You should now reboot'
exit 0
}
usage()
{
echo ''
echo " Usage: $0 [-ChI] "
echo ''
echo ' -C pull can-utils from gitorious and compile'
echo ' -h this help'
echo ' -I pull ICSim from github and compile'
echo ''
echo ' No arguments does a first install'
echo ''
echo ' This script must be run as root (sudo su)'
echo ''
exit 1
}
#==== run =============================================================================
# check if root
if [[ $EUID -ne 0 ]]; then
usage
exit 1
fi
if [[ -z $1 ]]; then
first_install
complete
exit 0
fi
while getopts “hIC” OPTION
do
case $OPTION in
h)
usage
;;
I)
update_icsim
;;
C)
update_can_utils
;;
?)
usage
exit 0
;;
esac
done
exit 0