Skip to content

Commit d63f934

Browse files
committed
[DOC] signed binary patch
test data creation
1 parent 0edf55f commit d63f934

File tree

2 files changed

+32
-12
lines changed

2 files changed

+32
-12
lines changed

README.md

Lines changed: 24 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -29,14 +29,27 @@ based update procedure.
2929

3030
## Example
3131

32-
% go build ./cmd/binary-patch-server
33-
% go build -o binary-patch.v1 ./cmd/binary-patch
34-
% ./binary-patch.v1 --version
35-
v0.0.1
36-
% sed -i 's/v0.0.1/v0.0.2/g' ./cmd/binary-patch/main.go
37-
% go build ./cmd/binary-patch
38-
% ./binary-patch-server &
39-
% ./binary-patch.v1
40-
Update complete
41-
% ./binary-patch.v1 --version
42-
v0.0.2
32+
Create /tmp/bindata/ with 1 client application with versions v0.0.1
33+
and v0.0.2 and generate corresponding signature and sha256 checksum
34+
files:
35+
36+
% testdata/create_testdata.sh
37+
38+
Build server binary:
39+
40+
% make build.server
41+
42+
Run example:
43+
44+
% build/binary-patch version
45+
binary-patch Version: v0.0.1
46+
================================
47+
Buildtime: 2017-06-14_09:26:33PM
48+
GitHash: 0edf55ffe02f054090d81b61b84d0b9b2242b92e
49+
% build/binary-patch signed-patch-update
50+
2017/06/14 23:27:55 use http://localhost:8080/signed-patch-update
51+
% build/binary-patch version
52+
binary-patch Version: v0.0.2
53+
================================
54+
Buildtime: 2017-06-14_09:26:37PM
55+
GitHash: 0edf55ffe02f054090d81b61b84d0b9b2242b92e

testdata/create_testdata.sh

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,15 @@ p=`pwd`
1414
test -f privateKey || openssl ecparam -genkey -name prime256v1 -noout -out privateKey
1515
test -f publicKey || openssl ec -in privateKey -pubout -out publicKey
1616

17+
test -d /tmp/bindata || mkdir /tmp/bindata
18+
cd ..
19+
rm build/binary-patch
20+
VERSION=v0.0.2 make build.local
21+
mv build/binary-patch /tmp/bindata/binary-patch_v0.0.2_${GOARCH}${GOOS}
22+
VERSION=v0.0.1 make build.local
23+
cp -a build/binary-patch /tmp/bindata/binary-patch_v0.0.1_${GOARCH}${GOOS}
24+
1725
cd /tmp/bindata
18-
#cd ../bindata
1926
for f in *
2027
do
2128
if [ ${f##*.} != "sha256" ] && [ ${f##*.} != "signature" ] && [ ${f##*.} != "diff" ]

0 commit comments

Comments
 (0)