in24/in32/fl32 little/big-endian QuickTime PCM audio support
[mplayer/glamo.git] / TOOLS / install-w32codecs.sh
blob89c222c5e8079c67dccdeb0e03a807eb37d68a91
1 #!/bin/sh
3 # Author: thuglife, mennucc1
6 set -e
8 arch=$(dpkg --print-installation-architecture)
10 codecsdir=/usr/lib/codecs
12 [ -d $codecsdir ] || mkdir -v $codecsdir
13 cd $codecsdir
14 [ -d mplayer_win32_codecs ] || mkdir -v mplayer_win32_codecs
16 INSTALL () {
17 filename="$1"
18 site="$2"
19 url="$site/$filename"
21 cd $codecsdir/mplayer_win32_codecs
23 if [ -r $filename.list ] ; then
24 #if we stop the script, we don't want to redownload things
25 #fixme we should check timestamps
26 echo You have already downloaded and installed $filename.
27 else
28 wget $url || return 1
29 case "$filename" in
30 *.tar.gz)
31 tar xvzf $filename > $filename.list
32 rm $filename
34 *.tgz)
35 tar xvzf $filename > $filename.list
36 rm $filename
38 *.tar.bz2)
39 tar --bzip2 -xvf $filename > $filename.list
40 rm $filename
42 esac
43 cd ..
44 ln -sbf mplayer_win32_codecs/*/* .
45 echo "Installed Succesfully!"
50 if [ `whoami` != root ]; then
51 echo "You must be root to start this script. Login as root first!"
52 exit 1
53 else
55 case "$1" in
56 install)
57 if [ "$arch" = "i386" ]; then
59 mainurl=''
61 pref=$codecsdir/mplayer_win32_codecs/bestsite
63 #distribute the load
64 if [ -r $pref ] ; then
65 mainurl=`cat $pref `
66 else
67 if [ -f /usr/bin/netselect ] ; then
68 echo Choosing best mirror using netselect....
69 /usr/bin/netselect \
70 http://www1.mplayerhq.hu/MPlayer/releases/codecs/ \
71 http://www2.mplayerhq.hu/MPlayer/releases/codecs/ \
72 http://ftp.lug.udel.edu/MPlayer/releases/codecs/ \
73 | awk '{print $2}' > $pref
74 mainurl=`cat $pref `
75 else
76 echo "(If you install 'netselect', it will select the best mirror for you."
77 echo " You may wish to stop this script and rerun after installation.)"
78 sleep 2
82 #sanity check, in case netselect fails
83 mainhost=`echo $mainurl | sed 's|http://||;s|ftp://||;s|/.*||g'`
84 echo Test if $mainhost exists and is ping-able...
85 if [ "$mainurl" = '' ] || ! ping -c1 "$mainhost" > /dev/null ; then
86 domain=`hostname -f | sed 's/.*\.//g' `
87 mainurl=http://www1.mplayerhq.hu/MPlayer/releases/codecs/
88 if [ "$domain" = 'edu' -o "$domain" = 'com' ] ; then
89 mainurl=http://ftp.lug.udel.edu/MPlayer/releases/codecs/
91 if [ "$domain" = 'de' -o "$domain" = 'it' ] ; then
92 mainurl=http://www2.mplayerhq.hu/MPlayer/releases/codecs/
96 #INSTALL win32.tar.gz http://ers.linuxforum.hu/
98 INSTALL win32codecs-lite.tar.bz2 $mainurl
99 #INSTALL w32codec.tar.bz2 http://www.mplayerhq.hu/MPlayer/releases/
100 INSTALL rp9codecs.tar.bz2 $mainurl
101 INSTALL qt6dlls.tar.bz2 $mainurl
102 elif [ "$arch" = "alpha" ]; then
103 INSTALL rp8codecs-alpha.tar.bz2 $mainurl
104 elif [ "$arch" = "powerpc" ]; then
105 INSTALL rp8codecs-ppc.tar.bz2 $mainurl
106 INSTALL xanimdlls-ppc.tar.bz2 $mainurl
107 else
108 echo "Sorry, no codecs for your arch. Sorry dude :("
109 exit 1
115 uninstall)
116 cd $codecsdir
117 rm -rf mplayer_win32_codecs
118 #FIXME we need a better clean system
119 if [ -r /usr/bin/symlinks ] ; then
120 symlinks -d .
121 else
122 echo "Please install the package 'symlinks' and run 'symlinks -d $codecsdir'."
124 echo "Uninstalled Succesfully!"
129 echo "Usage: {install|uninstall}"
130 exit 1
134 esac
137 exit 0