-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathsetup_mac
executable file
·68 lines (59 loc) · 2.5 KB
/
setup_mac
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
#!/bin/bash
echo '################################################################'
echo '# #'
echo '# ECE391 Localized Development Environment #'
echo '# #'
echo '# Created by DukeGaGa #'
echo '# #'
echo '# 2015.08.27 #'
echo '# #'
echo '################################################################'
#homebrew_check=$(which brew)
pkgconfig_check=$(which pkg-config)
qemu_check=$(which qemu-img)
current_dir=$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)
vm_dir="${current_dir}/work/vm"
image_dir="${current_dir}/image/ece391.qcow"
kernel_dir="${current_dir}/work/source/linux-2.6.22.5/bzImage"
# if [ "${homebrew_check}" == "" ]; then
# echo "Installing homebrew..."
# ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"
# fi
if [ "${pkgconfig_check}" == "" ]; then
echo "Installing pkg-config..."
brew install pkg-config
fi
if [ "${qemu_check}" == "" ]; then
echo "Compiling qemu..."
brew install glib
brew install pixman
cd "${current_dir}/qemu_mac"
./configure
make
echo "Installing qemu..."
sudo make install
else
qemu_ver_check=$(qemu-img --v | grep 1.5.0)
if [ "${qemu_ver_check}" == "" ]; then
echo "Wrong version of qemu is installed"
echo "Please uninstall it, then run this script again"
exit 1
fi
fi
if [ ! -d "${vm_dir}" ]; then
mkdir -p "${vm_dir}"
fi
if [ ! -f "${vm_dir}/devel.qcow" ]; then
qemu-img create -b "${image_dir}" -f qcow2 "${vm_dir}/devel.qcow"
fi
if [ ! -f "${vm_dir}/test.qcow" ]; then
qemu-img create -b "${image_dir}" -f qcow2 "${vm_dir}/test.qcow"
fi
# echo '#!/bin/bash' > ~/Desktop/devel
# echo "qemu-system-i386 -hda \"${vm_dir}/devel.qcow\" -m 512 -name devel" >> ~/Desktop/devel
# echo '#!/bin/bash' > ~/Desktop/test_debug
# echo "qemu-system-i386 -hda \"${vm_dir}/test.qcow\" -m 512 -name test -gdb tcp:127.0.0.1:1234 -S -kernel \"${kernel_dir}\"" >> ~/Desktop/test_debug
# echo '#!/bin/bash' > ~/Desktop/test_nodebug
# echo "qemu-system-i386 -hda \"${vm_dir}/test.qcow\" -m 512 -name test -kernel \"${kernel_dir}\"" >> ~/Desktop/test_nodebug
#
# chmod a+x ~/Desktop/devel ~/Desktop/test_debug ~/Desktop/test_nodebug