mirror of
https://github.com/alice-lg/birdwatcher.git
synced 2025-03-09 00:00:05 +01:00
added rpm generating makefile and startup scripts
This commit is contained in:
parent
ff788115cc
commit
a61398e21b
5 changed files with 132 additions and 0 deletions
90
Makefile
Normal file
90
Makefile
Normal file
|
@ -0,0 +1,90 @@
|
|||
|
||||
#
|
||||
# Ecix Birdseye Makefile
|
||||
#
|
||||
|
||||
PROG=birdwatcher
|
||||
ARCH=amd64
|
||||
|
||||
APP_VERSION=$(shell cat VERSION)
|
||||
VERSION=$(APP_VERSION)_$(shell git rev-parse --short HEAD)
|
||||
|
||||
BUILD_SERVER=""
|
||||
|
||||
DIST=DIST/
|
||||
REMOTE_DIST=$(PROG)-$(DIST)
|
||||
|
||||
RPM=$(PROG)-$(VERSION)-1.x86_64.rpm
|
||||
|
||||
LOCAL_RPMS=RPMS
|
||||
|
||||
# OS Detection
|
||||
UNAME=$(shell uname)
|
||||
ifeq ($(UNAME), Darwin)
|
||||
TARGET=osx
|
||||
else
|
||||
TARGET=linux
|
||||
endif
|
||||
|
||||
all: $(TARGET)
|
||||
@echo "Built $(VERSION) @ $(TARGET)"
|
||||
|
||||
osx:
|
||||
GOARCH=$(ARCH) GOOS=darwin go build -o $(PROG)-osx-$(ARCH)
|
||||
|
||||
linux:
|
||||
GOARCH=$(ARCH) GOOS=linux go build -o $(PROG)-linux-$(ARCH)
|
||||
|
||||
|
||||
dist: clean linux
|
||||
|
||||
mkdir -p $(DIST)opt/ecix/birdwatcher/bin
|
||||
mkdir -p $(DIST)etc/init
|
||||
|
||||
# Copy config and startup script
|
||||
cp etc/init/* DIST/etc/init/.
|
||||
|
||||
# Copy bin
|
||||
cp $(PROG)-linux-$(ARCH) DIST/opt/ecix/birdwatcher/bin/.
|
||||
|
||||
|
||||
rpm: dist
|
||||
|
||||
# Clear tmp failed build (if any)
|
||||
rm -f $(RPM)
|
||||
rm -fr $(LOCAL_RPMS)
|
||||
mkdir $(LOCAL_RPMS)
|
||||
|
||||
# Create RPM from dist
|
||||
fpm -s dir -t rpm -n $(PROG) -v $(VERSION) -C $(DIST) \
|
||||
opt/ etc/
|
||||
|
||||
mv $(RPM) $(LOCAL_RPMS)
|
||||
|
||||
|
||||
remote_rpm: dist
|
||||
# Copy distribution to build server
|
||||
ssh $(BUILD_SERVER) -- rm -rf $(REMOTE_DIST)
|
||||
scp -r $(DIST) $(BUILD_SERVER):$(REMOTE_DIST)
|
||||
ssh $(BUILD_SERVER) -- fpm -s dir -t rpm -n $(PROG) -v $(VERSION) -C $(REMOTE_DIST) \
|
||||
opt/ etc/
|
||||
|
||||
# Get rpm from server
|
||||
scp $(BUILD_SERVER):$(RPM) $(LOCAL_RPMS)/.
|
||||
|
||||
|
||||
staging: linux
|
||||
scp $(PROG)-linux-$(ARCH) snmp0.ber.ecix.net:.
|
||||
|
||||
|
||||
clean:
|
||||
rm -f $(PROG)-osx-$(ARCH)
|
||||
rm -f $(PROG)-linux-$(ARCH)
|
||||
rm -rf $(DIST)
|
||||
|
||||
|
||||
build_server:
|
||||
ifeq ($(BUILD_SERVER), '')
|
||||
$(error BUILD_SERVER not configured)
|
||||
endif
|
||||
|
1
VERSION
Normal file
1
VERSION
Normal file
|
@ -0,0 +1 @@
|
|||
1.0.0
|
14
etc/init/bird4watcher.conf
Normal file
14
etc/init/bird4watcher.conf
Normal file
|
@ -0,0 +1,14 @@
|
|||
|
||||
# ECIX birdwatcher
|
||||
|
||||
description "birdwatcher ipv4"
|
||||
author "Matthias Hannig <mha@ecix.net>"
|
||||
|
||||
respawn
|
||||
respawn limit 20 10
|
||||
|
||||
start on starting birdwatcher
|
||||
stop on stopping birdwatcher
|
||||
|
||||
exec /opt/ecix/birdwatcher/bin/birdwatcher-linux-amd64 -birdc bird -port 29184 2>&1 | logger -i -t 'BIRD4 WATCHER'
|
||||
|
14
etc/init/bird6watcher.conf
Normal file
14
etc/init/bird6watcher.conf
Normal file
|
@ -0,0 +1,14 @@
|
|||
|
||||
# ECIX birdwatcher
|
||||
|
||||
description "birdwatcher ipv6"
|
||||
author "Matthias Hannig <mha@ecix.net>"
|
||||
|
||||
respawn
|
||||
respawn limit 20 10
|
||||
|
||||
start on starting birdwatcher
|
||||
stop on stopping birdwatcher
|
||||
|
||||
exec /opt/ecix/birdwatcher/bin/birdwatcher-linux-amd64 -birdc bird6 -port 29185 2>&1 | logger -i -t 'BIRD6 WATCHER'
|
||||
|
13
etc/init/birdwatcher.conf
Normal file
13
etc/init/birdwatcher.conf
Normal file
|
@ -0,0 +1,13 @@
|
|||
|
||||
#
|
||||
# Birdwatcher Startup
|
||||
#
|
||||
|
||||
description "birdwatcher"
|
||||
author "Matthias Hannig <mha@ecix.net>"
|
||||
|
||||
|
||||
start on runlevel [2345]
|
||||
stop on runlevel [!2345]
|
||||
|
||||
|
Loading…
Add table
Reference in a new issue