4 changed files with 46 additions and 16 deletions
@ -1 +1,4 @@
|
||||
greenhouse-daemon |
||||
greenhouse-daemon |
||||
.picopublish-auth |
||||
build/* |
||||
build |
@ -0,0 +1,34 @@
|
||||
#!/bin/bash -e |
||||
|
||||
function build() { |
||||
GOOS=$1 |
||||
GOARCH=$2 |
||||
tag="0.0.0" |
||||
if git describe --tags --abbrev=0 > /dev/null 2>&1 ; then |
||||
tag="$(git describe --tags --abbrev=0)" |
||||
fi |
||||
version="$tag-$(git rev-parse --short HEAD)-$(hexdump -n 2 -ve '1/1 "%.2x"' /dev/urandom)" |
||||
|
||||
echo "building version: $version" |
||||
|
||||
rm -rf build |
||||
mkdir build |
||||
|
||||
go build -tags 'osusergo netgo' -ldflags='-extldflags=-static' -o build/greenhouse-daemon |
||||
|
||||
sha256sum build/greenhouse-daemon |
||||
|
||||
gzip_file_name="greenhouse-daemon-$version-$GOOS-$GOARCH.gz" |
||||
|
||||
gzip --stdout build/greenhouse-daemon > "build/$gzip_file_name" |
||||
|
||||
curl -X POST "https://picopublish.sequentialread.com/files/$gzip_file_name" \ |
||||
-H 'Content-Type: application/x-gzip' -H "Authorization: Basic $(cat .picopublish-auth)" \ |
||||
--data-binary "@build/$gzip_file_name" |
||||
|
||||
echo "https://picopublish.sequentialread.com/files/$gzip_file_name" |
||||
} |
||||
|
||||
#build arm |
||||
build linux amd64 |
||||
#build arm64 |
@ -1,11 +0,0 @@
|
||||
#!/bin/sh |
||||
|
||||
echo "creating greenhouse-daemon user and group" |
||||
useradd greenhouse-daemon |
||||
usermod -a -G greenhouse-daemon greenhouse-daemon |
||||
|
||||
echo "establishing greenhouse-daemon folder" |
||||
mkdir /opt/greenhouse-daemon |
||||
chown greenhouse-daemon:greenhouse-daemon /opt/greenhouse-daemon |
||||
chmod 700 /opt/greenhouse-daemon |
||||
|
Loading…
Reference in new issue