Skip to content

Commit

Permalink
[DOC] signed binary patch
Browse files Browse the repository at this point in the history
test data creation
  • Loading branch information
szuecs committed Jun 14, 2017
1 parent 0edf55f commit d63f934
Show file tree
Hide file tree
Showing 2 changed files with 32 additions and 12 deletions.
35 changes: 24 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,27 @@ based update procedure.

## Example

% go build ./cmd/binary-patch-server
% go build -o binary-patch.v1 ./cmd/binary-patch
% ./binary-patch.v1 --version
v0.0.1
% sed -i 's/v0.0.1/v0.0.2/g' ./cmd/binary-patch/main.go
% go build ./cmd/binary-patch
% ./binary-patch-server &
% ./binary-patch.v1
Update complete
% ./binary-patch.v1 --version
v0.0.2
Create /tmp/bindata/ with 1 client application with versions v0.0.1
and v0.0.2 and generate corresponding signature and sha256 checksum
files:

% testdata/create_testdata.sh

Build server binary:

% make build.server

Run example:

% build/binary-patch version
binary-patch Version: v0.0.1
================================
Buildtime: 2017-06-14_09:26:33PM
GitHash: 0edf55ffe02f054090d81b61b84d0b9b2242b92e
% build/binary-patch signed-patch-update
2017/06/14 23:27:55 use http://localhost:8080/signed-patch-update
% build/binary-patch version
binary-patch Version: v0.0.2
================================
Buildtime: 2017-06-14_09:26:37PM
GitHash: 0edf55ffe02f054090d81b61b84d0b9b2242b92e
9 changes: 8 additions & 1 deletion testdata/create_testdata.sh
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,15 @@ p=`pwd`
test -f privateKey || openssl ecparam -genkey -name prime256v1 -noout -out privateKey
test -f publicKey || openssl ec -in privateKey -pubout -out publicKey

test -d /tmp/bindata || mkdir /tmp/bindata
cd ..
rm build/binary-patch
VERSION=v0.0.2 make build.local
mv build/binary-patch /tmp/bindata/binary-patch_v0.0.2_${GOARCH}${GOOS}
VERSION=v0.0.1 make build.local
cp -a build/binary-patch /tmp/bindata/binary-patch_v0.0.1_${GOARCH}${GOOS}

cd /tmp/bindata
#cd ../bindata
for f in *
do
if [ ${f##*.} != "sha256" ] && [ ${f##*.} != "signature" ] && [ ${f##*.} != "diff" ]
Expand Down

0 comments on commit d63f934

Please sign in to comment.