forked from justintemp/Pintos_Starter
-
Notifications
You must be signed in to change notification settings - Fork 1
/
install.sh
executable file
·58 lines (46 loc) · 1.47 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
#!/bin/bash
SCRIPT=`realpath -s $BASH_SOURCE[0]`
SCRIPTPATH=`dirname $SCRIPT`
RED="\033[31m"
GREEN="\033[32m"
YELLOW="\033[33m"
NC="\033[0m"
run () {
STATUS=0
./.check_reqs.sh
if [[ $? != 0 ]]; then
echo 'FATAL: Requirements not met, please follow recommended installation'
echo 'commands before continuing.'
return 1
fi
# Do *not* write to the bashrc directly. This can create problems when
# people try to reinstall Pintos.
printf "${YELLOW}Add the following two lines to the end of your ~/.bashrc:${NC}\n"
printf "export PINTOS=$SCRIPTPATH\n"
printf "export PATH=\$PATH:\$PINTOS/utils\n\n"
printf "${YELLOW}Run the following command:${NC}\n"
printf "source ~/.bashrc\n\n"
printf "${YELLOW}Then, re-run this script to make sure qemu is in your path.${NC}\n\n"
# Install QEMU
which qemu &> /dev/null
if [[ $? != 0 ]]; then
printf 'Symlinking qemu-system-i386 -> qemu ... '
QEMU_SYSTEM=`which qemu-system-i386`
QEMU_PATH=`dirname $QEMU_SYSTEM`
ln -s $QEMU_SYSTEM utils/qemu &> /dev/null
which qemu &> /dev/null
if [[ $? != 0 ]]; then
printf "${RED}failed!${NC}\n"
STATUS=1
else
printf "${GREEN}done.${NC}\n"
fi
fi
if [[ $STATUS != 0 ]]; then
printf "${RED}Installation unsuccessful.${NC}\n"
else
printf "${GREEN}Installation successful.${NC}\n"
fi
return $STATUS
}
run