summaryrefslogtreecommitdiff
path: root/utilities/noad/utilitie.sh
blob: 20347f1a5ccbc31b74ea20f95acee13c9b339f81 (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
# 02.03.2009

# noad

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

WEB="http://vdr-wiki.de/vdr/noad/noad-0.6.1.tar.bz2"
VERSION="noad-0.6.1"
LINK="noad"

VAR=`basename $WEB`
DIR=`pwd`

# install
function make_util() {
  # pre install
  status=`status_util`
  if [ "$status" != "0" ]; then
    apt_remove "noad"
  fi

  download_util
  extract_util

  # setzen des symlinks
  cd $SOURCEDIR
  rm -f $LINK
  ln -vfs $VERSION $LINK

  # install
  cd $SOURCEDIR/$LINK

  [ -f "$DIR/noad_0.6.1_all-patches.diff" ] && patch -p0 < $DIR/noad_0.6.1_all-patches.diff

  ./configure --prefix=$PREFIX \
              --with-ffmpeg \
              --with-ffmpeglibdir=$PREFIX/lib \
              --with-ffmpeginclude=$PREFIX/include/libavcodec \
              --with-mpeginclude=$PREFIX/include/mpeg2dec


  make && checkinstall --fstrans=no --install=yes --pkgname=noad --pkgversion "0.6.1-xvdr" --default

  # test
  TEST=`which noad`
  if [ "$TEST" ]; then
    log "SUCCESS - $VERSION erstellt"
  else
    log "ERROR - $VERSION konnte nicht erstellt werden"
    return 1
  fi

  # save deb file
  [ -d "$DIR/packages" ] || mkdir -p $DIR/packages
  cp -f noad*.deb $DIR/packages

  ldconfig

}

# uninstall
function clean_util() {
  # uninstall noad
  apt_remove "noad"

  # remove source
  cd $SOURCEDIR
  [ -L "$LINK" ] && rm -rf "$LINK"
  [ -d "$VERSION" ] && rm -rf "$VERSION"

  ldconfig
}

# test
function status_util() {
  TEST=`which noad`
  if [ "$TEST" ]; then
    [ -d $SOURCEDIR/$LINK ] && 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