Skip to content

Commit

Permalink
added deb build script
Browse files Browse the repository at this point in the history
  • Loading branch information
nexusriot committed Dec 16, 2022
1 parent afcfd8f commit 2d664ad
Show file tree
Hide file tree
Showing 4 changed files with 51 additions and 0 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
etcd-walker.log
etcd-walker
build/


Expand Down
6 changes: 6 additions & 0 deletions DEBIAN/control
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
Package: etcd-walker
Version: _version_
Architecture: amd64
Maintainer: Vladislav Ananev <[email protected]>
Description: Simple free CLI tool for etcd
Installed-Size: 10230
21 changes: 21 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,27 @@ in some cases (for example for running inside containers) need to build statical
```
go build -ldflags "-linkmode external -extldflags -static"
```
to check for lib usage please use ldd command
```
ldd etcd-walker
```

building 32-bit binary
```
GOOS=linux GOARCH=386 go build -o etcd-walker_linux_i686 main.go
```

### **Building deb package**

installing required tools including golang
```
sudo apt-get install git devscripts build-essential lintian upx-ucl golang
```
run build script
```
./build-deb.sh
```


### **Running:**
```
Expand Down
23 changes: 23 additions & 0 deletions build-deb.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
#!/bin/env bash

version=0.0.8

echo "building deb for etcd-walker $version"

if ! type "dpkg-deb" > /dev/null; then
echo "please install required build tools first"
fi

project="etcd-walker_${version}_amd64"
folder_name="build/$project"
echo "crating $folder_name"
mkdir -p $folder_name
cp -r DEBIAN/ $folder_name
bin_dir="$folder_name/usr/bin"
mkdir -p $bin_dir
go build -ldflags "-linkmode external -extldflags -static" -o etcd-walker cmd/etcd-walker/main.go

mv etcd-walker $bin_dir
sed -i "s/_version_/$version/g" $folder_name/DEBIAN/control

cd build/ && dpkg-deb --build --root-owner-group $project

0 comments on commit 2d664ad

Please sign in to comment.