blob: d99dd3ccfc252f8bc2b726f510e922ca7a11cd0f (
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
36
37
38
39
40
41
42
43
44
45
46
47
|
o=$(basename $1)
u=$2
CARCH="i686"
cached_file=""
if [[ "$o" =~ "pkg.tar.gz" ]]
then
pkgname=${o%-*-[0-9]-${CARCH}.pkg.tar.gz.part}
newend=${o##$pkgname-}
new_version=${newend%-${CARCH}.pkg.tar.gz.part}
url=${u%/*}
for cached_file in $(ls -r /var/cache/pacman/pkg/${pkgname}-*-${CARCH}.pkg.tar.gz 2>/dev/null); do
oldend=${cached_file##*/$pkgname-}
old_version=${oldend%-${CARCH}.pkg.tar.gz}
if [ "$old_version" = "$new_version" ]; then
cached_file=""
fi
break
done
fi
if [ "$cached_file" != "" ]; then
delta_name=$pkgname-${old_version}_to_${new_version}-${CARCH}.delta
if wget --passive-ftp -c $url/$delta_name; then
echo Applying delta...
if xdelta patch $delta_name $cached_file $o; then
rm $delta_name
else
rm $delta_name
wget --passive-ftp -c -O $o $u
fi
else
wget --passive-ftp -c -O $o $u
fi
else
wget --passive-ftp -c -O $o $u
fi
|