forked from nodejs/node
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathupdate-cares.sh
executable file
·56 lines (43 loc) · 1.35 KB
/
update-cares.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
43
44
45
46
47
48
49
50
51
52
53
54
55
56
#!/bin/sh
set -e
# Shell script to update c-ares in the source tree to a specific version
BASE_DIR="$( pwd )"/
DEPS_DIR="$BASE_DIR"deps/
ARES_VERSION=$1
if [ "$#" -le 0 ]; then
echo "Error: please provide an c-ares version to update to"
echo " e.g. $0 1.18.1"
exit 1
fi
echo "Making temporary workspace"
WORKSPACE=$(mktemp -d 2> /dev/null || mktemp -d -t 'tmp')
cleanup () {
EXIT_CODE=$?
[ -d "$WORKSPACE" ] && rm -rf "$WORKSPACE"
exit $EXIT_CODE
}
trap cleanup INT TERM EXIT
ARES_REF="cares-$(echo "$ARES_VERSION" | tr . _)"
ARES_TARBALL="c-ares-$ARES_VERSION.tar.gz"
cd "$WORKSPACE"
echo "Fetching c-ares source archive"
curl -sL -o "$ARES_TARBALL" "https://github.com/c-ares/c-ares/releases/download/$ARES_REF/$ARES_TARBALL"
gzip -dc "$ARES_TARBALL" | tar xf -
rm "$ARES_TARBALL"
mv "c-ares-$ARES_VERSION" cares
echo "Removing tests"
rm -rf "$WORKSPACE/cares/test"
echo "Copying existing .gitignore, config and gyp files"
cp -R "$DEPS_DIR/cares/config" "$WORKSPACE/cares"
cp "$DEPS_DIR/cares/.gitignore" "$WORKSPACE/cares"
cp "$DEPS_DIR/cares/cares.gyp" "$WORKSPACE/cares"
echo "Replacing existing c-ares"
rm -rf "$DEPS_DIR/cares"
mv "$WORKSPACE/cares" "$DEPS_DIR/"
echo "All done!"
echo ""
echo "Please git add c-ares, commit the new version:"
echo ""
echo "$ git add -A deps/cares"
echo "$ git commit -m \"deps: update c-ares to $ARES_VERSION\""
echo ""