summaryrefslogtreecommitdiffstats
path: root/release/xdelta
blob: eb8b44a0133fcd22e3ea9e7ebbb61a0d2f5c2286 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash

test -z "$1" && { echo "parameter oldtarball required"; exit 1; }
test -z "$2" && { echo "parameter newtarball required"; exit 1; }

cleanupfiles=""

if test `basename $1 .bz2` != $1; then
  echo "bunzip2 $1"
  bunzip2 -c $1 > `basename $1 .bz2`
  cleanupfiles="$cleanupfiles `basename $1 .bz2`"
fi

if test `basename $2 .bz2` != $2; then
  echo "bunzip2 $2"
  bunzip2 -c $2 > `basename $2 .bz2`
  cleanupfiles="$cleanupfiles `basename $2 .bz2`"
fi

oldtarball=`basename $1 .bz2`
newtarball=`basename $2 .bz2`

package=`echo $newtarball | sed -e 's,-[^-]*$,,'`
oldversion=`basename $oldtarball .tar  | sed -e s,$package-,,`
newversion=`basename $newtarball .tar  | sed -e s,$package-,,`
diffname="$package-$oldversion-$newversion.tar.xdelta"

echo "xdelta $oldtarball $newtarball $diffname"
xdelta delta -9 -m 64M $oldtarball $newtarball $diffname

if test -n "$cleanupfiles"; then
  echo "rm -f $cleanupfiles"
  rm -f $cleanupfiles
fi