-
Notifications
You must be signed in to change notification settings - Fork 1
/
setup_imdb_func_sim.sh
executable file
·64 lines (52 loc) · 1.4 KB
/
setup_imdb_func_sim.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
#!/bin/sh
INSTALL="unknown"
usage() {
echo "<Usage> setup_imdb_func_sim.sh <command>
<command> <description>
--install(-i) Setup resources needed for PNM IMDB functional simulator.
--uninstall(-u) Cleanup resources needed for PNM IMDB functional simulator.
"
}
########################################################
# command-line option check
while [ "$#" -ne 0 ]
do
case "$1" in
"--install"|"-i")
echo "Setting up resources needed for PNM IMDB functional simulator."
INSTALL="true"
;;
"--uninstall"|"-u")
echo "Cleaning up resources needed for PNM IMDB functional simulator."
INSTALL="false"
;;
*)
usage
exit 1
;;
esac
shift
done
setup_sim() {
# 1. Setup imdb_resource module.
sudo modprobe -v imdb_resource
# 2. Setup shared memory for IMDB simulator. `pnm_ctl' must be in PATH.
pnm_ctl setup-shm --imdb
}
cleanup_sim() {
# 1. Remove shared memory for IMDB simulator.
pnm_ctl destroy-shm --imdb
# 2. Remove imdb_resource module.
sudo rmmod imdb_resource
}
if [ "x$INSTALL" = "xtrue" ]
then
setup_sim
elif [ "x$INSTALL" = "xfalse" ]
then
cleanup_sim
else
echo "Wrong command for simulator setup!"
usage
exit 1
fi