summaryrefslogtreecommitdiff
path: root/utilities/dvb/s2-liplianin/dvb-driver.sh
blob: 3f64d541cd89e2a84305dc51e7e7ded1244ffba0 (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
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
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/bin/sh

# x-vdr (Installations-Skript fuer einen VDR mit Debian als Basis)
# von Marc Wernecke - www.zulu-entertainment.de
# 09.02.2009

# v4l-dvb

source ./../../../x-vdr.conf
source ./../../../setup.conf
source ./../../../functions


VERSION="s2-liplianin"
WEB="http://mercurial.intuxication.org/hg/$VERSION"
LINK="DVB"

DIR=`pwd`

# install
function make_util() {

  apt-get update
  apt_install "mercurial"
  apt_install "linux-headers-`uname -r`"
  [ -L /usr/src/linux ] && rm -f /usr/src/linux
  if [ ! -d /usr/src/linux ]; then
    cd /usr/src
    ln -vfs /usr/src/linux-headers-`uname -r` linux
  fi

  # download und symlink
  cd $SOURCEDIR
  hg clone $WEB

  rm -f $LINK
  ln -vfs $VERSION $LINK

  cd $SOURCEDIR/$LINK/linux/include/linux
  if [ -f /usr/src/linux/include/linux/compiler.h ]; then
    ln -s /usr/src/linux/include/linux/compiler.h compiler.h
  elif [ -f /usr/src/$(uname -r)/include/linux/compiler.h ]; then
    ln -s /usr/src/$(uname -r)/include/linux/compiler.h compiler.h
  elif [ -f /usr/src/linux-headers-$(uname -r)/include/linux/compiler.h ]; then
    ln -s /usr/src/linux-headers-$(uname -r)/include/linux/compiler.h compiler.h
  else
    log "ERROR - /usr/src/linux/include/linux/compiler.h nicht gefunden"
  fi

  # install
  cd $SOURCEDIR/$LINK

  # search for *.diff
  for i in `ls $DIR/patches | grep ".diff$"`; do
    log "apply $i"
    patch -p 1 < $DIR/patches/$i
  done

  make menuconfig
  make
  if [ $? = 0 ] ; then
    log "SUCCESS - $VERSION erstellt"
  else
    log "ERROR - $VERSION konnte nicht erstellt werden"
    return 1
  fi

  dialog --title " x-vdr - $VERSION " --yesno "Die DVB-Treiber wurden in $SOURCEDIR/$VERSION erstellt. \nSollen sie jetzt installiert werden?" 19 70
  [ $? = 0 ] || return 0
  make install && cp -rf $SOURCEDIR/$VERSION/linux/include/linux/dvb /usr/include/linux && log "SUCCESS - $VERSION installiert"
}

# uninstall
function clean_util() {
  # remove source
  cd $SOURCEDIR
  rm -rf $LINK
  rm -rf $VERSION
}

# test
function status_util() {
  if [ -d "$SOURCEDIR/$VERSION" ]; then
    [ -d "$SOURCEDIR/$VERSION" ] && echo "2" && return 0
    echo "1"
  else
    echo "0"
  fi
}

# start

# plugin commands
if [ $# \> 0 ]; then
  cmd=$1
  cmd_util
else
  make_util
  status_util
fi

exit 0