-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathbootstrap.sh
executable file
·91 lines (85 loc) · 2.1 KB
/
bootstrap.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
ipac()
{
echo checking for $1
if which $1; then
echo you have $1
else
echo installing $1
$paman install $1
echo $1 installed
fi
}
epip()
{
pypath=$(python3 -c "import sysconfig; print(sysconfig.get_path('stdlib'))")
if [ -f ${pypath}/EXTERNALLY-MANAGED ]; then
pip3 install -e . --break-system-packages
else
pip3 install -e .
fi
}
echo determining platform
if echo OSTYPE | grep darwin; then
echo you have a mac!
echo checking for brew
if which brew;
then
echo you have brew
else
echo you need brew!
/usr/bin/ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
echo brew installed!
fi
paman=brew
elif which apt; then
echo you have debian -- great!
paman="sudo apt"
elif which pkg; then
echo you have pkg - running bsd
paman="env ASSUME_ALWAYS_YES=yes pkg"
for pacname in libxml2 libxslt py39-lxml py39-sqlite3
do
ipac $pacname
done
elif which yum; then
echo found yum - that works
paman=yum
else
echo uh-oh -- you have $OSTYPE
echo this script only knows about Debian, Fedora, BSD, and OSX
exit 126
fi
for pacname in python3 git
do
ipac $pacname
done
if echo $paman | grep brew; then
python -c 'import magic' || {
echo you need magic!
brew install libmagic
echo magic installed
}
elif echo $paman | grep apt; then
echo updating repos
$paman update
echo installing other deps
$paman install --yes build-essential libssl-dev libffi-dev python3-dev python3-setuptools python3-pip </dev/null
fi
echo checking for cantools
if pwd | grep cantools; then
echo installing right here right now
epip
else
python3 -c 'import cantools' || {
echo "cloning (and hiding) and installing cantools"
cd ~
mkdir .ct
cd .ct
git clone https://github.com/bubbleboy14/cantools.git
cd cantools
epip
echo cantools installed
}
fi
echo installed cantools and all dependencies. happy coding.
echo goodbye