]>
Commit | Line | Data |
---|---|---|
07d339d4 | 1 | #!/bin/bash |
2 | ||
3 | prog=check.sh | |
4 | spl_module=../modules/spl/spl.ko | |
5 | splat_module=../modules/splat/splat.ko | |
6 | splat_cmd=../cmd/splat | |
7 | ||
8 | die() { | |
9 | echo "${prog}: $1" >&2 | |
10 | exit 1 | |
11 | } | |
12 | ||
13 | warn() { | |
14 | echo "${prog}: $1" >&2 | |
15 | } | |
16 | ||
17 | if [ $(id -u) != 0 ]; then | |
18 | die "Must run as root" | |
19 | fi | |
20 | ||
21 | if /sbin/lsmod | egrep -q "^spl|^splat"; then | |
22 | die "Must start with spl modules unloaded" | |
23 | fi | |
24 | ||
25 | if [ ! -f ${spl_module} ] || [ ! -f ${splat_module} ]; then | |
26 | die "Source tree must be built, run 'make'" | |
27 | fi | |
28 | ||
29 | echo "Loading ${spl_module}" | |
30 | /sbin/insmod ${spl_module} || die "Failed to load ${spl_module}" | |
31 | ||
32 | echo "Loading ${splat_module}" | |
33 | /sbin/insmod ${splat_module} || die "Unable to load ${splat_module}" | |
34 | ||
35 | sleep 5 | |
36 | $splat_cmd -a | |
37 | ||
38 | echo "Unloading ${splat_module}" | |
39 | /sbin/rmmod ${splat_module} || die "Failed to unload ${splat_module}" | |
40 | ||
41 | echo "Unloading ${spl_module}" | |
42 | /sbin/rmmod ${spl_module} || die "Unable to unload ${spl_module}" | |
43 | ||
44 | exit 0 |