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