summaryrefslogtreecommitdiff
path: root/utilities/x264/utilitie-x264.sh
blob: 9f4a88a9224d1b68796675f660aacfcf71fcbf26 (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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
#!/bin/sh

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

# x264

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

DIR=`pwd`
DATE=`date +%Y%m%d`

# install
function make_util() {
  # pre install
  status=`status_util`
  if [ "$status" != "0" ]; then
    apt_remove "$(apt-cache search "libx264" | grep "libx264" | cut -d" " -f1)"
    apt_remove "x264"
  fi
  # make & checkinstall
  cd $SOURCEDIR
  git clone git://git.videolan.org/x264.git
  cd x264
  ./configure --prefix=$PREFIX --enable-shared
  make && checkinstall --fstrans=no --install=yes --pkgname=x264 --pkgversion "1:0.svn${DATE}-xvdr" --default && TEST=ok

  # test
  if [ "$TEST" != "ok" ]; then
    log "ERROR - x264 konnte nicht erstellt werden"
    return 1
  fi

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

  # create dummy packages
  VERSNUM=$(ls $SOURCEDIR/x264 | grep "libx264.so" | cut -f3 -d".")
  cd $DIR/packages
  echo "Section: misc
Priority: optional
Standards-Version: 3.6.2

Package: libx264-${VERSNUM}
Version: 1:0.svn${DATE}-xvdr-1
Maintainer: Musterman <Musterman@musterman.de>
Depends: x264
Provides: x264
Architecture: all
Description: Dummy-libx264-${VERSNUM}
" > ./libx264-${VERSNUM}

  equivs-build libx264-${VERSNUM}
  dpkg -i libx264-${VERSNUM}_0.svn${DATE}-xvdr-1_all.deb

  echo "Section: misc
Priority: optional
Standards-Version: 3.6.2

Package: libx264-dev
Version: 1:0.svn${DATE}-xvdr-1
Maintainer: Musterman <Musterman@musterman.de>
Depends: x264
Provides: x264
Architecture: all
Description: Dummy-libx264-dev
" > ./libx264-dev

  equivs-build libx264-dev
  dpkg -i libx264-dev_0.svn${DATE}-xvdr-1_all.deb

  ldconfig
  log "SUCCESS - x264 erstellt"
}

# uninstall
function clean_util() {
  apt_remove "$(apt-cache search "libx264" | grep "libx264" | cut -d" " -f1)"
  apt_remove "x264"

  # remove source
  cd $SOURCEDIR
  [ -d x264 ] && rm -rf x264

  ldconfig
}

# test
function status_util() {
  LIBS="x264 $(apt-cache search "libx264" | grep "libx264" | cut -d" " -f1)"
  for package in $LIBS; do
    TEST=`apt_installed $package`
    if [ "$TEST" = "xvdr" ]; then
      [ -d $SOURCEDIR/x264 ] && echo "2" && return 0
      echo "1" && return 0
    elif [ "$TEST" = "debian" ]; then
      echo "3" && return 0
    fi
  done
  echo "0"
}

# start

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

exit 0