-
Notifications
You must be signed in to change notification settings - Fork 1
/
update_zlib.sh
executable file
·42 lines (32 loc) · 1.09 KB
/
update_zlib.sh
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
#!/bin/bash
# Run with no arguments from any directory, with no special setup required.
# Abort if any command returns an error exit status, or if an undefined
# variable is used.
set -e
set -u
base_dir=$(realpath $(dirname $0))
# Extract the latest version from the web page.
new_version=$(wget -O - --no-verbose -q http://zlib.net/ | \
grep 'http://zlib.net/zlib-[0-9].*.tar.gz' | \
sed 's/.*zlib-\(.*\)\.tar\.gz.*/\1/')
tgz_file="zlib-$new_version.tar.gz"
echo "Upgrading zlib to version $new_version..."
echo "-------------------------------------------------------------------"
echo "Downloading $tgz_file..."
wget -O /tmp/$tgz_file --no-verbose "http://zlib.net/$tgz_file"
echo "Cleaning out old version..."
src_dir=$base_dir/src
rm -rf $src_dir
echo "Unpacking new version..."
cd $base_dir
tar zxf /tmp/$tgz_file
mv zlib-$new_version src
echo "Configuring new version..."
cd src
./configure
rm Makefile configure.log
cd ..
echo "Fixing NOTICE file..."
grep -A21 'Copyright notice:' src/README | tail -20 > NOTICE
md5_sum=$(md5sum /tmp/$tgz_file)
echo "MD5: $md5_sum"