Revert previous broken rename of binary-codecs.sh that had random changes.

git-svn-id: svn://svn.mplayerhq.hu/mplayer/trunk@27383 b3059339-0415-0410-9bf9-f77b7e298cf2
This commit is contained in:
diego 2008-07-31 22:38:34 +00:00
parent 26a047a816
commit 8b9c830dc3
2 changed files with 23 additions and 67 deletions

View File

@ -429,15 +429,15 @@ Note: You will need the libwww-perl stuff and the cabextract utility
which can be found at http://www.kyz.uklinux.net/cabextract.php3. which can be found at http://www.kyz.uklinux.net/cabextract.php3.
binary_codecs.sh binary-codecs.sh
Author: Andrea Menucci, thuglife Author: Andrea Menucci, thuglife
Description: Downloads binary codecs from mplayerhq.hu and installs them Description: Downloads binary codecs from mplayerhq.hu and installs them
on a Debian system. on a Debian system.
Usage: binary_codecs.sh install Usage: binary-codecs.sh install
binary_codecs.sh uninstall binary-codecs.sh uninstall
vobshift.py vobshift.py

View File

@ -1,6 +1,5 @@
#!/bin/sh #!/bin/sh
set -e set -e
umask 0022
# This script will download binary codecs for MPlayer unto a Debian system. # This script will download binary codecs for MPlayer unto a Debian system.
@ -25,30 +24,24 @@ choosemirror ()
#if [ ! -r mirrors ] || find mirrors -mtime +20 ; then #if [ ! -r mirrors ] || find mirrors -mtime +20 ; then
echo Downloading mirrors list.. echo Downloading mirrors list..
wget -nv -N $MYSITE/mirrors || true wget -nv -c -N $MYSITE/mirrors || true
#fi #fi
if [ ! -r bestsites ] || [ mirrors -nt bestsites ] || \ if [ ! -r bestsites ] || [ mirrors -nt bestsites ] || \
find bestsites -mtime +20 | grep -q bestsites ; then find bestsites -mtime +20 > /dev/null ; then
if which netselect > /dev/null ; then if which netselect > /dev/null ; then
echo Choosing best mirrors using netselect.... echo Choosing best mirrors using netselect....
netselect -s 5 -t 5 $( cat mirrors ) | awk '{print $2}' > bestsites netselect -s 5 $( cat mirrors ) | awk '{print $2}' > bestsites
elif which fping > /dev/null ; then elif which fping > /dev/null ; then
fping -C 1 $( sed 's#.*//##;s#/.*##' mirrors ) 2>&1 | \ fping -C 1 $( sed 's#.*//##;s#/.*##' mirrors ) 2>&1 | \
egrep -v 'bytes.*loss' | sort -n -k3 | \ egrep -v 'bytes.*loss' | sort -n -k3 | \
grep -v ': *-' | awk '/:/{print $1}' | head -5 | ( while read mainsite ; do grep -v ': *-' | awk '/:/{print $1}' | head -5 > bestsites
grep $mainsite $PREFDIR/mirrors ; done ) > bestsites
else else
echo "(If you install 'netselect' or 'fping', it will select the best mirror for you" echo "(If you install 'netselect', it will select the best mirror for you"
echo " you may wish to stop this script and rerun after installation)" echo " you may wish to stop this script and rerun after installation)"
sleep 3 sleep 5
head -3 mirrors > bestsites head -3 mirrors > bestsites
fi fi
fi fi
#sometimes the above fails
if ! test -s bestsites ; then
head -3 mirrors > bestsites
fi
} }
@ -67,16 +60,18 @@ INSTALL () {
if [ "$url" = @MAINSITE@ ] ; then if [ "$url" = @MAINSITE@ ] ; then
cat $PREFDIR/bestsites | while read mainsite ; do cat $PREFDIR/bestsites | while read mainsite ; do
echo Downloading $filename from $mainsite ... echo Downloading $filename from $mainsite ...
wget -c -N $mainsite/$dir/$filename || true wget -v -c -N $mainsite/$dir/$filename || true
if [ -r "$filename" ] ; then if [ -r "$filename" ] ; then
UNPACK "$filename" UNPACK "$filename"
[ -r $filename.bak ] && rm $filename.bak
return 0 return 0
fi fi
done done
else else
wget -c -N $url/$dir/$filename || true wget -v -c -N $url/$dir/$filename || true
if [ -r "$filename" ] ; then if [ -r "$filename" ] ; then
UNPACK "$filename" UNPACK "$filename"
[ -r $filename.bak ] && rm $filename.bak
return 0 return 0
fi fi
fi fi
@ -88,17 +83,7 @@ INSTALL () {
UNPACK () UNPACK ()
{ {
filename="$1" filename="$1"
if [ -r $filename.bak ] && cmp $filename.bak $filename && [ -r $filename.list ] ; then if [ ! -r $filename.bak ] || ! cmp $filename.bak $filename ; then
echo It appears that $filename was already succesfully installed
[ -r $filename.bak ] && rm $filename.bak
else
if grep -q " $filename$" $PREFDIR/MD5SUMS ; then
echo Checking MD5 for $filename
grep " $filename$" $PREFDIR/MD5SUMS | md5sum -c -
else
echo Warning: no MD5 for $filename were found. Hit enter to continue.
read
fi
echo Installing $filename ... echo Installing $filename ...
if [ -r $filename.list ] ; then if [ -r $filename.list ] ; then
tr '\n' '\000' < $filename.list | xargs -r0 rm || true tr '\n' '\000' < $filename.list | xargs -r0 rm || true
@ -106,23 +91,20 @@ UNPACK ()
rm $filename.list rm $filename.list
fi fi
tarfail () { echo FAILED $filename ; rm $filename.list ; exit 1 ; }
case "$filename" in case "$filename" in
*.tar.gz) *.tar.gz)
tar xvzf $filename > $filename.list || tarfail tar xvzf $filename > $filename.list
#rm $filename #rm $filename
;; ;;
*.tgz) *.tgz)
tar xvzf $filename > $filename.list || tarfail tar xvzf $filename > $filename.list
#rm $filename #rm $filename
;; ;;
*.tar.bz2) *.tar.bz2)
tar --bzip2 -xvf $filename > $filename.list || tarfail tar --bzip2 -xvf $filename > $filename.list
#rm $filename #rm $filename
;; ;;
esac esac
[ -r $filename.bak ] && rm $filename.bak
LINK $filename.list LINK $filename.list
echo "Installed $filename Succesfully!" echo "Installed $filename Succesfully!"
fi fi
@ -153,48 +135,22 @@ fi
case "$1" in case "$1" in
install) install)
if test -x /bin/bzip2 || test -x /usr/bin/bzip2 ; then : ; else
echo You need to install bzip2
exit 1
fi
choosemirror choosemirror
cd $PREFDIR cd $PREFDIR
#if [ ! -r codecs_list ] || find codecs_list -mtime +20 ; then #if [ ! -r codecs_list ] || find codecs_list -mtime +20 ; then
echo 'Getting codecs list ...' echo 'Getting codecs list ...'
wget -nv -N $MYSITE/codecs_list || true wget -nv -c -N $MYSITE/codecs_list || true
#fi #fi
cd $PREFDIR if grep -q "^$dpkgarch" $PREFDIR/codecs_list ] ; then
echo Downloading MD5 sums from main site
[ -r MD5SUMS ] && mv MD5SUMS MD5SUMS.bak
if wget -nv -N http://www.mplayerhq.hu/MPlayer/releases/codecs/MD5SUMS ; then
[ -r MD5SUMS.bak ] && rm MD5SUMS.bak
else
echo failed...
if [ -r MD5SUMS.bak ] ; then
echo trying to use backup ... ;
mv MD5SUMS.bak MD5SUMS
fi
fi
if grep -q "^$dpkgarch" $PREFDIR/codecs_list ; then
egrep -v "^[[:space:]]*(#|$)" $PREFDIR/codecs_list | \ egrep -v "^[[:space:]]*(#|$)" $PREFDIR/codecs_list | \
while read arch url dir file info ; do while read arch url dir file info ; do
if [ "$dpkgarch" = "$arch" ]; then if [ "$dpkgarch" = "$arch" ]; then
echo Downloading and installing $file $info... echo Installing $file $info...
INSTALL "$url" "$dir" "$file" INSTALL "$url" "$dir" "$file"
n=1
fi fi
done done
if test "$dpkgarch" = powerpc && ! test -r /usr/lib/libstdc++.so.5 ; then
echo 'Warning: you need to install libstdc++ 5 libraries'
echo -n 'Do it now? '
read R
case $R in
y*) apt-get install libstdc++5 ;;
*) echo 'If you change your mind, use the command'
echo ' apt-get install libstdc++5' ;;
esac
fi
else else
echo "Sorry, no codecs for your arch '$dpkgarch'. Sorry dude :(" echo "Sorry, no codecs for your arch '$dpkgarch'. Sorry dude :("
exit 1 exit 1