Advertisement
Kossak

/usr/share/doc/libdvdread4/install-css.sh

Apr 18th, 2015
398
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 3.46 KB | None | 0 0
  1. #!/bin/sh
  2. # Shell script to install libdvdcss under Debian GNU Linux
  3. # Many DVDs use css for encryption.  To play these discs, a special library
  4. # is needed to decode them, libdvdcss.  Due to legal problems, Debian and most
  5. # Linux distibutions cannot distribute libdvdcss
  6. # Use this shell script to install the libdvdcss under DEBIAN GNU/Linux
  7. # --------------------------------------------------------------------------
  8. # Refer url for more info:
  9. # Copyright info -  http://www.dtek.chalmers.se/~dvd/
  10. # -------------------------------------------------------------------------
  11. # This script is part of nixCraft shell script collection (NSSC)
  12. # Visit http://bash.cyberciti.biz/ for more information.
  13. # -------------------------------------------------------------------------
  14. # Addition of checking for current version.  Gene Cumm <gene.cumm@gmail.com>
  15. # -------------------------------------------------------------------------
  16.  
  17. set -e
  18.  
  19. if [ ! -w /etc/passwd ]; then
  20.     echo "Super-user privileges are required.  Please run this with 'sudo'." >&2
  21.     exit 1
  22. fi
  23.  
  24. sitert=http://download.videolan.org/
  25. site=${sitert}pub/debian/stable/
  26. arch=$(dpkg --print-architecture)
  27.  
  28. soname=2
  29. uversion=1.2.13
  30. available="i386 amd64"
  31. version=${uversion}-0
  32.  
  33. do_dyn=T
  34. dist=$(lsb_release -cs)
  35.  
  36. if ! type wget > /dev/null ; then
  37.     echo "Install wget and run this script again" >&2
  38.     exit 1
  39. fi
  40.  
  41. CSSTMP=$(mktemp -t -d dvdcss-XXXXXX)
  42.  
  43. # Attempt to dymanically fetch the current version
  44. # dep: grep sed
  45. if [ "$do_dyn" = "T" ];then
  46.     for a in grep sed head; do
  47.     if ! type "$a" > /dev/null ; then
  48.         echo "Can not find ${a}; Needed for dymanic fetch"
  49.         do_dyn=F
  50.     fi
  51.     done
  52. fi
  53. if [ "$do_dyn" = "T" ];then
  54.     set +e  # prevent this from stopping everything
  55.     wget "${site}/Packages" -O "$CSSTMP"/Packages && \
  56.     url=${site}$(grep "Filename: .*libdvdcss${soname}.*${arch}.*\.deb" "$CSSTMP"/Packages|sed  's/Filename: //'|head -n 1) && \
  57.     wget "${url}" -O "$CSSTMP"/libdvdcss.deb && \
  58.     dpkg -i "$CSSTMP"/libdvdcss.deb && \
  59.     exit 0
  60.     echo "Dynamic fetch failed; Falling back to static fetch"
  61.     set -e  # undo
  62. else
  63.     echo "Skipping dynamic fetch"
  64. fi
  65.  
  66. for a in $available; do
  67.     if [  "$a" = "$arch" ]; then
  68.     wget ${site}libdvdcss${soname}_${version}_${arch}.deb -O "$CSSTMP"/libdvdcss.deb
  69.     dpkg -i "$CSSTMP"/libdvdcss.deb
  70.     exit $?
  71.     fi
  72. done
  73.  
  74. echo "No prebuilt binary available.  Will try to build and install it."
  75. echo "You need to have build-essential, debhelper and fakeroot installed."
  76. echo "If not, interrupt now, install them and rerun this script."
  77. echo ""
  78. echo "This is higly experimental, look out for what happens below."
  79. echo "If you want to stop, interrupt now (control-c), else press"
  80. echo "return to proceed"
  81. read dum
  82.  
  83. if ! type dh_testdir > /dev/null || ! type fakeroot > /dev/null; then
  84.     echo "Attempting to install build-essential, debhelper and fakeroot..." >&2
  85.     apt-get update && apt-get install build-essential debhelper fakeroot
  86. fi
  87.  
  88. if ! type dh_testdir > /dev/null || ! type fakeroot > /dev/null ||
  89. ! type make > /dev/null ; then
  90.     echo "Failed to install build-essential, debhelper and fakeroot, exiting now." >&2
  91.     exit 1
  92. fi
  93.  
  94. cd "$CSSTMP"
  95. wget ${site}libdvdcss_${uversion}.orig.tar.gz
  96. wget ${site}libdvdcss_${version}.debian.tar.gz
  97. wget ${site}libdvdcss_${version}.dsc
  98. dpkg-source -x libdvdcss_${version}.dsc
  99. cd libdvdcss-${uversion}
  100. fakeroot ./debian/rules binary
  101. dpkg -i ../libdvdcss${soname}_${version}_${arch}.deb
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement