Mercurial > mplayer.hg
comparison TOOLS/binary_codecs.sh @ 29184:5f1e8f1b3c30
whitespace cosmetics
author | diego |
---|---|
date | Thu, 23 Apr 2009 18:54:22 +0000 |
parents | ecb3c5f2fdd1 |
children | a99dc500088f |
comparison
equal
deleted
inserted
replaced
29183:edd77b4f699b | 29184:5f1e8f1b3c30 |
---|---|
4 # avoid insecure tempfile creation | 4 # avoid insecure tempfile creation |
5 umask 0022 | 5 umask 0022 |
6 | 6 |
7 # This script will download binary codecs for MPlayer unto a Debian system. | 7 # This script will download binary codecs for MPlayer unto a Debian system. |
8 | 8 |
9 # Author: thuglife, mennucc1 | 9 # Author: thuglife, mennucc1 |
10 # | 10 # |
11 | 11 |
12 CODECDIR=/usr/lib/codecs | 12 CODECDIR=/usr/lib/codecs |
13 PREFDIR=/var/lib/mplayer/prefs | 13 PREFDIR=/var/lib/mplayer/prefs |
14 MYSITE='http://people.debian.org/~mennucc1/mplayer' | 14 MYSITE='http://people.debian.org/~mennucc1/mplayer' |
33 find bestsites -mtime +20 > /dev/null ; then | 33 find bestsites -mtime +20 > /dev/null ; then |
34 if which netselect > /dev/null ; then | 34 if which netselect > /dev/null ; then |
35 echo Choosing best mirrors using netselect | 35 echo Choosing best mirrors using netselect |
36 netselect -s 5 $( cat mirrors ) | awk '{print $2}' > bestsites | 36 netselect -s 5 $( cat mirrors ) | awk '{print $2}' > bestsites |
37 elif which fping > /dev/null ; then | 37 elif which fping > /dev/null ; then |
38 fping -C 1 $( sed 's#.*//##;s#/.*##' mirrors ) 2>&1 | \ | 38 fping -C 1 $( sed 's#.*//##;s#/.*##' mirrors ) 2>&1 | \ |
39 egrep -v 'bytes.*loss' | sort -n -k3 | \ | 39 egrep -v 'bytes.*loss' | sort -n -k3 | \ |
40 grep -v ': *-' | awk '/:/{print $1}' | head -5 > bestsites | 40 grep -v ': *-' | awk '/:/{print $1}' | head -5 > bestsites |
41 else | 41 else |
42 echo "(If you install 'netselect', it will select the best mirror for you" | 42 echo "(If you install 'netselect', it will select the best mirror for you" |
43 echo " you may wish to stop this script and rerun after installation)" | 43 echo " you may wish to stop this script and rerun after installation)" |
85 | 85 |
86 UNPACK () | 86 UNPACK () |
87 { | 87 { |
88 filename="$1" | 88 filename="$1" |
89 if [ ! -r $filename.bak ] || ! cmp $filename.bak $filename ; then | 89 if [ ! -r $filename.bak ] || ! cmp $filename.bak $filename ; then |
90 echo Installing $filename ... | 90 echo Installing $filename ... |
91 if [ -r $filename.list ] ; then | 91 if [ -r $filename.list ] ; then |
92 tr '\n' '\000' < $filename.list | xargs -r0 rm || true | 92 tr '\n' '\000' < $filename.list | xargs -r0 rm || true |
93 UNLINK $filename.list | 93 UNLINK $filename.list |
94 rm $filename.list | 94 rm $filename.list |
95 fi | 95 fi |
96 | 96 |
97 tarfail () { echo FAILED $filename ; rm $filename.list ; exit 1 ; } | 97 tarfail () { echo FAILED $filename ; rm $filename.list ; exit 1 ; } |
139 exit 1 | 139 exit 1 |
140 fi | 140 fi |
141 | 141 |
142 case "$1" in | 142 case "$1" in |
143 install) | 143 install) |
144 if test -x /bin/bzip2 || test -x /usr/bin/bzip2 ; then : ; else | 144 if test -x /bin/bzip2 || test -x /usr/bin/bzip2 ; then : ; else |
145 echo You need to install bzip2 | 145 echo You need to install bzip2 |
146 exit 1 | 146 exit 1 |
147 fi | 147 fi |
148 choosemirror | 148 choosemirror |
149 cd $PREFDIR | 149 cd $PREFDIR |
150 #if [ ! -r codecs_list ] || find codecs_list -mtime +20 ; then | 150 #if [ ! -r codecs_list ] || find codecs_list -mtime +20 ; then |
151 echo 'Getting codecs list' | 151 echo 'Getting codecs list' |
152 wget -nv -c -N $MYSITE/codecs_list || true | 152 wget -nv -c -N $MYSITE/codecs_list || true |
153 #fi | 153 #fi |
154 | 154 |
155 if grep -q "^$dpkgarch" $PREFDIR/codecs_list ] ; then | 155 if grep -q "^$dpkgarch" $PREFDIR/codecs_list ] ; then |
156 egrep -v "^[[:space:]]*(#|$)" $PREFDIR/codecs_list | \ | 156 egrep -v "^[[:space:]]*(#|$)" $PREFDIR/codecs_list | \ |
157 while read arch url dir file info ; do | 157 while read arch url dir file info ; do |
158 if [ "$dpkgarch" = "$arch" ]; then | 158 if [ "$dpkgarch" = "$arch" ]; then |
159 echo Downloading and installing $file $info... | 159 echo Downloading and installing $file $info... |
160 INSTALL "$url" "$dir" "$file" | 160 INSTALL "$url" "$dir" "$file" |
161 n=1 | 161 n=1 |
162 fi | 162 fi |
163 done | 163 done |
164 else | 164 else |
165 echo "Sorry, no codecs for your arch '$dpkgarch'. Sorry dude :(" | 165 echo "Sorry, no codecs for your arch '$dpkgarch'. Sorry dude :(" |
166 exit 1 | 166 exit 1 |