-
Notifications
You must be signed in to change notification settings - Fork 14
/
Copy pathinstall.sh
executable file
·83 lines (68 loc) · 1.83 KB
/
install.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
SCRIPT=`realpath -s $BASH_SOURCE[0]`
SCRIPTPATH=`dirname $SCRIPT`
run () {
./.check_reqs.sh
if [[ $? != '0' ]]; then
echo 'FATAL: Requirements not met, please follow recommended installation'
echo 'commands before continuing.'
return 1
fi
# Install pintos
which pintos &> /dev/null
if [[ $? != '0' ]]; then
echo 'Installing pintos to PATH ...'
echo "export PATH=\$PATH:$SCRIPTPATH/utils" > .PINTOS_PATH
# No bashrc yet? Just make a blank
touch ~/.bashrc
# Backup bashrc
cp ~/.bashrc ~/.bashrc.PINTOS.BAK
echo >> ~/.bashrc
echo "# Put pintos in PATH" >> ~/.bashrc
echo "source $SCRIPTPATH/.PINTOS_PATH" >> ~/.bashrc
# alias pintos-gdb while we're at it
MACROS_PATH=$SCRIPTPATH/misc/gdb-macros
echo "alias pintos-gdb='GDBMACROS=$MACROS_PATH pintos-gdb'" >> ~/.bashrc
source ~/.bashrc
if [[ $? != '0' ]]; then
echo "Installing pintos to PATH failed!"
cp -f ~/.bashrc.PINTOS.BAK ~/.bashrc
return 1
fi
source .PINTOS_PATH
which pintos &> /dev/null
if [[ $? != '0' ]]; then
echo "Installing pintos to PATH failed!"
cp -f ~/.bashrc.PINTOS.BAK ~/.bashrc
return 1
fi
echo "DONE"
echo
fi
# Build pintos utils
echo "Making pintos utils ..."
pushd utils &> /dev/null
make &> /dev/null
if [[ $? != '0' ]]; then
echo "Building pintos utils failed!"
popd &> /dev/null
return 1
fi
popd &> /dev/null
echo "DONE"
echo
# Install QEMU
which qemu &> /dev/null
if [[ $? != '0' ]]; then
echo 'Symlinking qemu-system-i386 -> qemu ...'
QEMU_SYSTEM=`which qemu-system-i386`
QEMU_PATH=`dirname $QEMU_SYSTEM`
ln -s $QEMU_SYSTEM utils/qemu
which qemu &> /dev/null
if [[ $? != '0' ]]; then
echo "Symlinking qemu failed!"
return 1
fi
echo "DONE"
fi
}
run