Skip to content

Commit

Permalink
Added deb packages.
Browse files Browse the repository at this point in the history
  • Loading branch information
nuttmeister committed Jun 9, 2017
1 parent 2ff17ee commit 4b38c3c
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 26 deletions.
57 changes: 32 additions & 25 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,13 @@
appname := kmsdecryptenv
version := 1.0.0
debversion := $(version)-1

sources := $(wildcard *.go)

build = GOOS=$(1) GOARCH=$(2) go build -o build/$(appname)$(3)
tar = cd build && tar -cvzf $(1)_$(2).tar.gz $(appname)$(3) && rm $(appname)$(3)
zip = cd build && zip $(1)_$(2).zip $(appname)$(3) && rm $(appname)$(3)
build = GOOS=$(1) GOARCH=$(2) go build -o build/$(appname)
deb = ./create_deb_pkg.sh $(appname) $(2) $(debversion)
tar = cd build && tar -cvzf $(1)_$(2).tar.gz $(appname) && rm $(appname)
zip = cd build && zip $(1)_$(2).zip $(appname) && rm $(appname)

.PHONY: all windows darwin linux clean

Expand All @@ -13,39 +16,43 @@ all: windows darwin linux
clean:
rm -rf build/

##### LINUX BUILDS #####
linux: build/linux_arm.tar.gz build/linux_arm64.tar.gz build/linux_386.tar.gz build/linux_amd64.tar.gz
# Linux
linux: linux_arm linux_arm64 linux_386 linux_amd64

build/linux_386.tar.gz: $(sources)
$(call build,linux,386,)
linux_386: $(sources)
$(call build,linux,386)
$(call deb,linux,386)
$(call tar,linux,386)

build/linux_amd64.tar.gz: $(sources)
$(call build,linux,amd64,)
linux_amd64: $(sources)
$(call build,linux,amd64)
$(call deb,linux,amd64)
$(call tar,linux,amd64)

build/linux_arm.tar.gz: $(sources)
$(call build,linux,arm,)
linux_arm: $(sources)
$(call build,linux,arm)
$(call deb,linux,arm)
$(call tar,linux,arm)

build/linux_arm64.tar.gz: $(sources)
$(call build,linux,arm64,)
linux_arm64: $(sources)
$(call build,linux,arm64)
$(call deb,linux,arm64)
$(call tar,linux,arm64)

##### DARWIN (MAC) BUILDS #####
darwin: build/darwin_amd64.tar.gz
# Darwin
darwin: darwin_amd64

build/darwin_amd64.tar.gz: $(sources)
$(call build,darwin,amd64,)
darwin_amd64: $(sources)
$(call build,darwin,amd64)
$(call tar,darwin,amd64)

##### WINDOWS BUILDS #####
windows: build/windows_386.zip build/windows_amd64.zip
# Windows
windows: windows_386 windows_amd64

build/windows_386.zip: $(sources)
$(call build,windows,386,.exe)
$(call zip,windows,386,.exe)
windows_386: $(sources)
$(call build,windows,386)
$(call zip,windows,386)

build/windows_amd64.zip: $(sources)
$(call build,windows,amd64,.exe)
$(call zip,windows,amd64,.exe)
windows_amd64: $(sources)
$(call build,windows,amd64)
$(call zip,windows,amd64)
29 changes: 28 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,33 @@ The program uses the following ENV vars for configuration
Either download any of the binaries provided in the list below or build yourself.
The binaries are self contained and have no dependencies.

You will find them here:
There is also deb packages for debian/ubuntu.

### Debian deb pkgs

[Debian/Ubuntu amd64](https://github.com/dwtechnologies/kmsdecryptenv/releases/download/1.0.0/kmsdecryptenv_1.0.0-1-amd64.deb)
[Debian/Ubuntu 386](https://github.com/dwtechnologies/kmsdecryptenv/releases/download/1.0.0/kmsdecryptenv_1.0.0-1-386.deb)
[Debian/Ubuntu arm](https://github.com/dwtechnologies/kmsdecryptenv/releases/download/1.0.0/kmsdecryptenv_1.0.0-1-arm.deb)
[Debian/Ubuntu arm64](https://github.com/dwtechnologies/kmsdecryptenv/releases/download/1.0.0/kmsdecryptenv_1.0.0-1-arm64.deb)

### Linux binaries

[Linux amd64](https://github.com/dwtechnologies/kmsdecryptenv/releases/download/1.0.0/linux_amd64.tar.gz)
[Linux 386](https://github.com/dwtechnologies/kmsdecryptenv/releases/download/1.0.0/linux_386.tar.gz)
[Linux arm](https://github.com/dwtechnologies/kmsdecryptenv/releases/download/1.0.0/linux_arm.tar.gz)
[Linux arm64](https://github.com/dwtechnologies/kmsdecryptenv/releases/download/1.0.0/linux_arm64.tar.gz)

### Mac binaries

[Linux amd64](https://github.com/dwtechnologies/kmsdecryptenv/releases/download/1.0.0/darwin_amd64.tar.gz)

### Windows binaries

[Windows amd64](https://github.com/dwtechnologies/kmsdecryptenv/releases/download/1.0.0/windows_amd64.zip)
[Windows 386](https://github.com/dwtechnologies/kmsdecryptenv/releases/download/1.0.0/windows_386.zip)


You will find the whole first release here:
[github.com/dwtechnologies/kmsdecryptenv/releases/tag/1.0.0](https://github.com/dwtechnologies/kmsdecryptenv/releases/tag/1.0.0)

## Bulding
Expand All @@ -68,6 +94,7 @@ go build
```

You can also use the supplied Makefile for building and cross-compiling. You will need to have run `go get` beforehand, becasue the Makefile will not do this step.
Please note that docker is required for the Makefile to work propperly, it will use ubuntu:16.04 image to build the deb packages.

## Usage

Expand Down
28 changes: 28 additions & 0 deletions create_deb_pkg.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
#!/bin/bash
FILE="$1"
ARCH="$2"
VERSION="$3"

CONTROL="build/deb/${FILE}_${VERSION}-${ARCH}/DEBIAN/control"
BINDIR="build/deb/${FILE}_${VERSION}-${ARCH}/usr/local/bin"

mkdir -p build/deb/${FILE}_${VERSION}-${ARCH}/usr/local/bin
mkdir -p build/deb/${FILE}_${VERSION}-${ARCH}/DEBIAN

cp $FILE $BINDIR

echo "Package: kmsdecryptenv" > $CONTROL
echo "Version: 1.0.0-1" >> $CONTROL
echo "Section: base" >> $CONTROL
echo "Priority: optional" >> $CONTROL
echo "Architecture: $ARCH" >> $CONTROL
echo "Maintainer: Anders Wallin <anders.wallin@danielwellington.com>" >> $CONTROL
echo "Description: KMS Decrypt ENV" >> $CONTROL
echo " Decrypts all or specific ENV variables using AWS KMS." >> $CONTROL
echo " It run all calls concurrently so decrypting 100s or keys" >> $CONTROL
echo " usally takes less than a couple of 100 ms." >> $CONTROL

docker run -v $(pwd)/build:/build -w /build ubuntu:16.04 dpkg-deb --build /build/deb/${FILE}_${VERSION}-${ARCH}
mv build/deb/${FILE}_${VERSION}-${ARCH}.deb build/${FILE}_${VERSION}-${ARCH}.deb

rm -rf build/deb

0 comments on commit 4b38c3c

Please sign in to comment.