Skip to content

Commit c83963a

Browse files
Experimental support for runit, Devuan and Void
1 parent 3d9b9d6 commit c83963a

File tree

2 files changed

+45
-57
lines changed

2 files changed

+45
-57
lines changed

Diff for: Makefile

+36-57
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,30 @@
1+
# houseclock - A simple GPS Time Server with Web console
2+
#
3+
# Copyright 2023, Pascal Martin
4+
#
5+
# This program is free software; you can redistribute it and/or
6+
# modify it under the terms of the GNU General Public License
7+
# as published by the Free Software Foundation; either version 2
8+
# of the License, or (at your option) any later version.
9+
#
10+
# This program is distributed in the hope that it will be useful,
11+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
12+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13+
# GNU General Public License for more details.
14+
#
15+
# You should have received a copy of the GNU General Public License
16+
# along with this program; if not, write to the Free Software
17+
# Foundation, Inc., 51 Franklin Street, Fifth Floor,
18+
# Boston, MA 02110-1301, USA.
19+
20+
HAPP=houseclock
21+
HROOT=/usr/local
22+
SHARE=$(HROOT)/share/house
23+
24+
# Application build. --------------------------------------------
125

226
OBJS= hc_db.o hc_http.o hc_clock.o hc_tty.o hc_nmea.o hc_broadcast.o hc_ntp.o houseclock.o
327

4-
SHARE=/usr/local/share/house
5-
628
all: houseclock
729

830
broadcast: hc_broadcast.o
@@ -34,69 +56,26 @@ package:
3456

3557
# Distribution agnostic file installation -----------------------
3658

37-
install-files:
38-
mkdir -p /usr/local/bin
39-
rm -f /usr/local/bin/houseclock
40-
cp houseclock /usr/local/bin
41-
chown root:root /usr/local/bin/houseclock
42-
chmod 755 /usr/local/bin/houseclock
59+
install-app:
60+
mkdir -p $(HROOT)/bin
61+
rm -f $(HROOT)/bin/houseclock
62+
cp houseclock $(HROOT)/bin
63+
chown root:root $(HROOT)/bin/houseclock
64+
chmod 755 $(HROOT)/bin/houseclock
4365
mkdir -p $(SHARE)/public/ntp
4466
cp public/* $(SHARE)/public/ntp
4567
chmod 644 $(SHARE)/public/ntp/*
4668
chmod 755 $(SHARE) $(SHARE)/public $(SHARE)/public/ntp
4769

48-
uninstall-files:
70+
uninstall-app:
4971
rm -rf $(SHARE)/public/ntp
50-
rm -f /usr/local/bin/houseclock
51-
52-
purge-config:
53-
54-
# Distribution agnostic systemd support -------------------------
55-
56-
install-systemd:
57-
if [ -e /lib/systemd/system/systemd-timesyncd.service ] ; then systemctl stop systemd-timesyncd ; systemctl disable systemd-timesyncd ; fi
58-
if [ -e /etc/init.d/ntp ] ; then systemctl stop ntp ; systemctl disable ntp ; fi
59-
if [ -e /lib/systemd/system/ntp.service ] ; then systemctl stop ntp ; systemctl disable ntp ; fi
60-
if [ -e /etc/init.d/chrony ] ; then systemctl stop chrony ; systemctl disable chrony ; fi
61-
if [ -e /lib/systemd/system/chrony.service ] ; then systemctl stop chrony ; systemctl disable chrony ; fi
62-
cp systemd.service /lib/systemd/system/houseclock.service
63-
chown root:root /lib/systemd/system/houseclock.service
64-
systemctl daemon-reload
65-
systemctl enable houseclock
66-
systemctl start houseclock
67-
68-
uninstall-systemd: stop-systemd
69-
if [ -e /lib/systemd/system/systemd-timesyncd.service ] ; then systemctl enable systemd-timesyncd ; systemctl start systemd-timesyncd ; fi
70-
if [ -e /etc/init.d/ntp ] ; then systemctl enable ntp ; systemctl start ntp ; fi
71-
if [ -e /lib/systemd/system/ntp.service ] ; then systemctl enable ntp ; systemctl start ntp ; fi
72-
if [ -e /etc/init.d/chrony ] ; then systemctl enable chrony ; systemctl start chrony ; fi
73-
if [ -e /lib/systemd/system/chrony.service ] ; then systemctl start chrony ; systemctl start chrony ; fi
74-
75-
stop-systemd:
76-
if [ -e /etc/init.d/houseclock ] ; then systemctl stop houseclock ; systemctl disable houseclock ; rm -f /etc/init.d/houseclock ; fi
77-
if [ -e /lib/systemd/system/houseclock.service ] ; then systemctl stop houseclock ; systemctl disable houseclock ; rm -f /lib/systemd/system/houseclock.service ; fi
78-
79-
# Debian GNU/Linux install --------------------------------------
72+
rm -f $(HROOT)/bin/houseclock
8073

81-
install-debian: stop-systemd install-files install-systemd
74+
purge-app:
8275

83-
uninstall-debian: uninstall-systemd uninstall-files
84-
85-
purge-debian: uninstall-debian purge-config
86-
87-
# Void Linux install --------------------------------------------
88-
89-
install-void: install-files
90-
91-
uninstall-void: uninstall-files
92-
93-
purge-void: uninstall-void purge-config
94-
95-
# Default install (Debian GNU/Linux) ----------------------------
96-
97-
install: install-debian
76+
purge-config:
9877

99-
uninstall: uninstall-debian
78+
# System installation. ------------------------------------------
10079

101-
purge: purge-debian
80+
include $(SHARE)/install.mak
10281

Diff for: runit.run

+9
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
#!/bin/sh
2+
GPSOPTS=
3+
NTPOPTS=
4+
HTTPOPTS=
5+
OTHEROPTS=
6+
if [ -e /etc/default/houseclock ] ; then . /etc/default/houseclock ; fi
7+
sv start houseportal || exit 1
8+
exec /usr/local/bin/houseclock $GPSOPTS $NTPOPTS $HTTPOPTS $OTHEROPTS
9+

0 commit comments

Comments
 (0)