[pdftex] Little helper script to do pdftex binary update

Steffen Evers mlone at forevers.de
Fri Dec 14 01:35:06 CET 2001


On Thu, Dec 13, 2001 at 18:36, Jens-Uwe Morawski wrote:
> If you use Linux you should find pre-built binary-packages for 14h.
> As i remember, the package is dated 2001-04-17.
Yes, that are the ones I have download. 14h not 14f as I have written in
my last mail.

> The only think to do after download is the rebuilt of the format files.
> I don't know where to find binaries of the 1.0-pretest version, maybe
> they are also available.
Thanks! That was the hint I have looked for. Now the new version works!

I have written a little helper script to find and replace the files that
are stored in the archive. As it is a quick hack in bash shell it might
not run everywhere (especially the sed expressions and the locate
command). However, maybe someone can make use of it. So, attached.

Usage: pdftex-update PDFTEX-BINARYS.zip

Bye, Steffen

#!/bin/bash

EXCLUDE_REGEXP='/\(other\|src\|ftp\)/'
TMP_DIR=/tmp
ARCHIVE=$1
NEW_FILES=`unzip -l "$ARCHIVE" | sed -n "s/^[[:space:]]*[0-9]\+[[:space:]]\+[0-9-]\+[[:space:]]\+[0-9:]\+[[:space:]]\+\([^[:space:]]\+.*\)$/\1/p"`

questionYN() {
   local response
   local default
   while true; do
      if [ "$2" = "yes" ]
      then
         echo -n "$1" "[y]"
         default=yes
      else
         echo -n "$1" "[n]"
         default=no
      fi
      read response </dev/tty
      case $response in
         y*|Y*) RESPONSE=yes; return ;;
         n*|N*) RESPONSE=no; return ;;
         "") RESPONSE=$default; return ;;
         *) echo Please respond with y or n.
      esac
   done
}

for new_file in $NEW_FILES
do
   #echo "Processing $new_file"
   #echo "Excluded: $EXCLUDE_REGEXP"
   #LOCATED=`locate $new_file | grep "/$new_file$" | grep -v "/\(other\|src\|ftp\)/"`
   LOCATED=`locate $new_file | grep "/$new_file$" | grep -v "$EXCLUDE_REGEXP"`
   #echo "Located files:"
   #echo "$LOCATED"
   RESULTS=
   COUNT=0
   for match in $LOCATED
   do 
      FOUND=`ls -G -l $match | tail -n 1 | grep "^-.*/$new_file"`
      if [ -n "$FOUND" ]
      then
         COUNT=`expr $COUNT + 1`
         if [ $COUNT == 1 ]
         then
            RESULTS="$RESULTS$FOUND"
         else
            RESULTS="$RESULTS\n$FOUND"
         fi
      fi
   done
   if [ $COUNT == 0 ]
   then
      echo "No match for '$new_file'. "
      echo
   elif [ $COUNT == 1 ]
   then
      echo "Unique match for '$new_file':"
      echo "$RESULTS"
      FILE=`echo $RESULTS | sed -n "s|[^/]*\(/.*\)$|\1|p"`
      questionYN "Replace '$FILE'?" no
      if [ "$RESPONSE" = "yes" ]
      then
         rm -f $TMP_DIR/$new_file \
         && unzip -q -d $TMP_DIR $ARCHIVE $new_file \
         && cp $TMP_DIR/$new_file $FILE \
         && rm -f $TMP_DIR/$new_file \
         && echo "Replacement succeded" \
         || echo "Replacement failed!"
      fi
      echo
   else
      echo "No unique match for '$new_file'. Results:"
      echo -e "$RESULTS"
      echo
   fi 
done


--- StripMime Report -- processed MIME parts ---
multipart/mixed
  text/plain (text body -- kept)
  text/plain (text body -- kept)
---



More information about the pdftex mailing list