Skip to content

Commit

Permalink
Created packager for release
Browse files Browse the repository at this point in the history
Updated to listen on 0.0.0.0
  • Loading branch information
webhat committed Aug 26, 2018
1 parent b8928d6 commit 6e51920
Show file tree
Hide file tree
Showing 4 changed files with 67 additions and 1 deletion.
18 changes: 18 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@

all:
go build

release: all git-tag
tar jcf modbus-demo-`cat VERSION`.tar.bz2 modbustcp modbustcpd LICENSE README.md

git-tag: bump
git tag `cat VERSION`
git push --tags

bump:
echo `cat VERSION`+.1 |bc > VERSION.new
rm VERSION
mv VERSION.new VERSION

upload:
scp modbus-demo-`cat VERSION`.tar.bz2 oplerno:/var/lib/lxd/containers/ateps-updates/rootfs/var/www/portage/distfiles/
1 change: 1 addition & 0 deletions VERSION
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
1.5
2 changes: 1 addition & 1 deletion modbusserver.go
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ func main() {
serv.RegisterFunctionHandler(4, ReadRegisters)
serv.RegisterFunctionHandler(6, WriteRegisters)

err := serv.ListenTCP("127.0.0.1:502")
err := serv.ListenTCP(":502")
if err != nil {
log.Printf("%v\n", err)
}
Expand Down
47 changes: 47 additions & 0 deletions modbustcpd
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
#!/sbin/openrc-run
# Copyright 1999-2015 Gentoo Foundation, Daniel Crompton
# Distributed under the terms of the GNU General Public License v2

extra_commands="checkconfig"
extra_started_commands="reload"

: ${MODBUSD_PIDFILE:=/var/run/${SVCNAME}.pid}
: ${MODBUSD_BINARY:=/usr/sbin/modbustcp}

depend() {
use logger dns
}

checkconfig() {
return 0
}

start() {
checkconfig || return 1

ebegin "Starting ${SVCNAME}"
start-stop-daemon -b --start --exec "${MODBUSD_BINARY}" \
--pidfile "${MODBUSD_PIDFILE}" \
-- ${MODBUSD_OPTS}
eend $?
}

stop() {
if [ "${RC_CMD}" = "restart" ] ; then
checkconfig || return 1
fi

ebegin "Stopping ${SVCNAME}"
start-stop-daemon --stop --exec "${MODBUSD_BINARY}" \
--pidfile "${MODBUSD_PIDFILE}" --quiet
eend $?
}

reload() {
checkconfig || return 1
ebegin "Reloading ${SVCNAME}"
start-stop-daemon --signal HUP \
--exec "${MODBUSD_BINARY}" --pidfile "${MODBUSD_PIDFILE}"
eend $?
}

0 comments on commit 6e51920

Please sign in to comment.