summaryrefslogtreecommitdiff
path: root/extra/i2c_pseudo/install
blob: f4fbecedc9f64023552212110239a8d7a4b00d9e (plain)
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
#!/bin/sh
#
# This attempts to build and install the i2c-pseudo Linux kernel module.

set -e

make clean
make
ret=0
sudo make modules_install || ret="$?"

if [ "$ret" -eq 0 ]; then
  make clean
  sudo depmod -a
  sudo modprobe i2c-pseudo
  echo "SUCCESS: installed and loaded i2c-pseudo module"
else
  echo 1>&2 "WARNING: make modules_install failed with exit status $ret."
  echo 1>&2 "The module has not been installed for future reuse."
  echo 1>&2 "Will still attempt to load the module, using insmod instead of "\
"modprobe."
  ret=0
  sudo insmod i2c-pseudo.ko || ret="$?"
  if [ "$ret" -ne 0 ]; then
    make clean
    exit "$ret"
  fi
  echo "PARTIAL SUCCESS: loaded i2c-pseudo module (not installed)"
  make clean
fi