[MPlayer-dev-eng] [PATCH] sync TOOLS/binary_codecs.sh with debian

Reinhard Tartler siretart at tauware.de
Thu Apr 23 10:57:01 CEST 2009


OK'ed parts applied as part 2, then applied the missed whitespace fixes
and comsetics missed from part 1 as part 3.

Here now propsed part 4, hopefully without other whitespace/cosmetics
changes:

Index: binary_codecs.sh
===================================================================
--- binary_codecs.sh	(revision 29223)
+++ binary_codecs.sh	(working copy)
@@ -30,16 +30,17 @@
     wget -nv -c -N $MYSITE/mirrors || true
   #fi
   if [ ! -r bestsites ] || [ mirrors -nt bestsites ] || \
-    find bestsites -mtime +20 > /dev/null ; then
+    find bestsites -mtime +20 | grep -q bestsites ; then
     if which netselect > /dev/null ; then
       echo Choosing best mirrors using netselect
-      netselect -s 5 $( cat mirrors ) | awk '{print $2}' > bestsites
+      netselect -s 5 -t 5 $( cat mirrors ) | awk '{print $2}' > bestsites
     elif which fping > /dev/null ; then
      fping -C 1  $( sed   's#.*//##;s#/.*##' mirrors ) 2>&1 | \
        egrep -v 'bytes.*loss' | sort -n -k3 | \
-       grep -v ': *-' | awk '/:/{print $1}' | head -5 > bestsites
+       grep -v ': *-' | awk '/:/{print $1}' | head -5 | ( while read mainsite ; do
+         grep $mainsite $PREFDIR/mirrors ; done ) > bestsites
     else
-      echo "(If you install 'netselect', it will select the best mirror for you"
+      echo "(If you install 'netselect' or 'fping', it will select the best mirror for you"
       echo "  you may wish to stop this script and rerun after installation)"
       sleep 3
       head -3 mirrors > bestsites
@@ -66,7 +67,6 @@
       wget -c -N $mainsite/$dir/$filename || true
       if [ -r "$filename" ] ; then
         UNPACK "$filename"
-        [ -r $filename.bak ] && rm $filename.bak
         return 0
       fi
     done
@@ -74,7 +74,6 @@
     wget -c -N $url/$dir/$filename || true
     if [ -r "$filename" ] ; then
       UNPACK "$filename"
-      [ -r $filename.bak ] && rm $filename.bak
       return 0
     fi
   fi
@@ -86,10 +85,20 @@
 UNPACK ()
 {
   filename="$1"
-  if [ ! -r $filename.bak ] || ! cmp $filename.bak $filename ; then
-    echo Installing $filename  ...
-    if [ -r $filename.list  ] ; then
-      tr '\n' '\000' < $filename.list | xargs -r0 rm  || true
+  if [ -r $filename.bak ] && cmp $filename.bak $filename && [ -r  $filename.list ] ; 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 dummy
+    fi
+    echo "Installing $filename"
+    if [ -r $filename.list ] ; then
+      tr '\n' '\000' < $filename.list | xargs -r0 rm || true
       UNLINK $filename.list
       rm $filename.list
     fi
@@ -152,15 +161,40 @@
       wget -nv -c -N $MYSITE/codecs_list || true
     #fi
 
-    if  grep -q "^$dpkgarch" $PREFDIR/codecs_list   ] ; then
+    cd $PREFDIR
+    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 | \
         while read arch url dir file info ; do
           if [ "$dpkgarch" = "$arch" ]; then
             echo Downloading and installing $file $info...
             INSTALL "$url" "$dir" "$file"
-	    n=1
           fi
         done
+      needlibstd=no
+      test "$dpkgarch" = "powerpc" && needlibstd=yes
+      test "$dpkgarch" = "i386" && needlibstd=yes
+      if test "$needlibstd" = "yes" && ! 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
       echo "Sorry, no codecs for your arch '$dpkgarch'. Sorry dude :("
       exit 1

-- 
Gruesse/greetings,
Reinhard Tartler, KeyID 945348A4



More information about the MPlayer-dev-eng mailing list