Skip to content

Commit 6e51920

Browse files
committed
Created packager for release
Updated to listen on 0.0.0.0
1 parent b8928d6 commit 6e51920

File tree

4 files changed

+67
-1
lines changed

4 files changed

+67
-1
lines changed

Diff for: Makefile

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
2+
all:
3+
go build
4+
5+
release: all git-tag
6+
tar jcf modbus-demo-`cat VERSION`.tar.bz2 modbustcp modbustcpd LICENSE README.md
7+
8+
git-tag: bump
9+
git tag `cat VERSION`
10+
git push --tags
11+
12+
bump:
13+
echo `cat VERSION`+.1 |bc > VERSION.new
14+
rm VERSION
15+
mv VERSION.new VERSION
16+
17+
upload:
18+
scp modbus-demo-`cat VERSION`.tar.bz2 oplerno:/var/lib/lxd/containers/ateps-updates/rootfs/var/www/portage/distfiles/

Diff for: VERSION

+1
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
1.5

Diff for: modbusserver.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ func main() {
3737
serv.RegisterFunctionHandler(4, ReadRegisters)
3838
serv.RegisterFunctionHandler(6, WriteRegisters)
3939

40-
err := serv.ListenTCP("127.0.0.1:502")
40+
err := serv.ListenTCP(":502")
4141
if err != nil {
4242
log.Printf("%v\n", err)
4343
}

Diff for: modbustcpd

+47
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,47 @@
1+
#!/sbin/openrc-run
2+
# Copyright 1999-2015 Gentoo Foundation, Daniel Crompton
3+
# Distributed under the terms of the GNU General Public License v2
4+
5+
extra_commands="checkconfig"
6+
extra_started_commands="reload"
7+
8+
: ${MODBUSD_PIDFILE:=/var/run/${SVCNAME}.pid}
9+
: ${MODBUSD_BINARY:=/usr/sbin/modbustcp}
10+
11+
depend() {
12+
use logger dns
13+
}
14+
15+
checkconfig() {
16+
return 0
17+
}
18+
19+
start() {
20+
checkconfig || return 1
21+
22+
ebegin "Starting ${SVCNAME}"
23+
start-stop-daemon -b --start --exec "${MODBUSD_BINARY}" \
24+
--pidfile "${MODBUSD_PIDFILE}" \
25+
-- ${MODBUSD_OPTS}
26+
eend $?
27+
}
28+
29+
stop() {
30+
if [ "${RC_CMD}" = "restart" ] ; then
31+
checkconfig || return 1
32+
fi
33+
34+
ebegin "Stopping ${SVCNAME}"
35+
start-stop-daemon --stop --exec "${MODBUSD_BINARY}" \
36+
--pidfile "${MODBUSD_PIDFILE}" --quiet
37+
eend $?
38+
}
39+
40+
reload() {
41+
checkconfig || return 1
42+
ebegin "Reloading ${SVCNAME}"
43+
start-stop-daemon --signal HUP \
44+
--exec "${MODBUSD_BINARY}" --pidfile "${MODBUSD_PIDFILE}"
45+
eend $?
46+
}
47+

0 commit comments

Comments
 (0)