Move init system detection to configure
This commit is contained in:
@@ -53,11 +53,11 @@ install-gateway:
|
|||||||
@install -m 0755 $(GATEWAY) $(GATEWAY_DIR)
|
@install -m 0755 $(GATEWAY) $(GATEWAY_DIR)
|
||||||
|
|
||||||
install-initscripts:
|
install-initscripts:
|
||||||
if [[ `systemctl` =~ -\.mount ]]; then \
|
ifeq ($(INIT_SYSTEM), systemd)
|
||||||
install -m0644 initscripts/mysgateway.systemd /etc/systemd/system/mysgateway.service && \
|
install -m0644 initscripts/mysgateway.systemd /etc/systemd/system/mysgateway.service
|
||||||
sed -i -e "s|%gateway_dir%|${GATEWAY_DIR}|g" /etc/systemd/system/mysgateway.service && \
|
@sed -i -e "s|%gateway_dir%|${GATEWAY_DIR}|g" /etc/systemd/system/mysgateway.service
|
||||||
systemctl daemon-reload; \
|
systemctl daemon-reload
|
||||||
elif [[ -f /etc/init.d/cron && ! -h /etc/init.d/cron ]]; then \
|
else ifeq ($(INIT_SYSTEM), sysvinit)
|
||||||
install -m0755 initscripts/mysgateway.sysvinit /etc/init.d/mysgateway && \
|
install -m0755 initscripts/mysgateway.sysvinit /etc/init.d/mysgateway
|
||||||
sed -i -e "s|%gateway_dir%|${GATEWAY_DIR}|g" /etc/init.d/mysgateway; \
|
@sed -i -e "s|%gateway_dir%|${GATEWAY_DIR}|g" /etc/init.d/mysgateway
|
||||||
fi
|
endif
|
||||||
|
|||||||
@@ -45,15 +45,17 @@ MySensors options:
|
|||||||
--my-controller-ip-address=<IP>
|
--my-controller-ip-address=<IP>
|
||||||
Controller or MQTT broker ip.
|
Controller or MQTT broker ip.
|
||||||
Use commas instead of points. Example: 127,0,0,1
|
Use commas instead of points. Example: 127,0,0,1
|
||||||
--my-port Controller or MQTT broker port.
|
--my-port=<PORT> Controller or MQTT broker port.
|
||||||
--my-mqtt-client-id=<ID> MQTT client id.
|
--my-mqtt-client-id=<ID> MQTT client id.
|
||||||
--my-mqtt-publish-topic-prefix=<PREFIX>
|
--my-mqtt-publish-topic-prefix=<PREFIX>
|
||||||
MQTT publish topic prefix.
|
MQTT publish topic prefix.
|
||||||
--my-mqtt-subscribe-topic-prefix=<PREFIX>
|
--my-mqtt-subscribe-topic-prefix=<PREFIX>
|
||||||
MQTT subscribe topic prefix.
|
MQTT subscribe topic prefix.
|
||||||
--my-rf24-irq-pin Pin number connected to nRF24L01 IRQ pin.
|
--my-rf24-irq-pin=<PIN> Pin number connected to nRF24L01 IRQ pin.
|
||||||
--my-rx-message-buffer-size Buffer size for incoming messages when using rf24 interrupts.
|
For RaspberryPi use BCM numbering.
|
||||||
Default set to 20.
|
--my-rx-message-buffer-size=<SIZE>
|
||||||
|
Buffer size for incoming messages when using rf24 interrupts.
|
||||||
|
Default is 20.
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -188,7 +190,7 @@ function gcc_cpu_flags {
|
|||||||
echo ${flags}
|
echo ${flags}
|
||||||
}
|
}
|
||||||
|
|
||||||
params="OS SOC CPUFLAGS CXXFLAGS LDFLAGS PREFIX CXX RF24H_LIB_DIR GATEWAY_DIR"
|
params="OS SOC CPUFLAGS CXXFLAGS LDFLAGS PREFIX CXX RF24H_LIB_DIR GATEWAY_DIR INIT_SYSTEM"
|
||||||
|
|
||||||
for opt do
|
for opt do
|
||||||
if [ "$opt" = "-h" ] || [ "$opt" = "--help" ]; then
|
if [ "$opt" = "-h" ] || [ "$opt" = "--help" ]; then
|
||||||
@@ -305,6 +307,16 @@ fi
|
|||||||
|
|
||||||
LDFLAGS="-pthread -lrf24-bcm $LDFLAGS"
|
LDFLAGS="-pthread -lrf24-bcm $LDFLAGS"
|
||||||
|
|
||||||
|
if [ -x /usr/bin/systemctl ] || [ -x /bin/systemctl ]; then
|
||||||
|
INIT_SYSTEM=systemd
|
||||||
|
echo "[OK] init system detected: systemd"
|
||||||
|
elif [ -f /etc/init.d/cron ] && [ ! -h /etc/init.d/cron ]; then
|
||||||
|
INIT_SYSTEM=sysvinit
|
||||||
|
echo "[OK] init system detected: sysvinit"
|
||||||
|
else
|
||||||
|
echo "[FAILED] unknown init system"
|
||||||
|
fi
|
||||||
|
|
||||||
echo "[SECTION] Saving configuration."
|
echo "[SECTION] Saving configuration."
|
||||||
echo -n "" > Makefile.inc
|
echo -n "" > Makefile.inc
|
||||||
for param in ${params}; do
|
for param in ${params}; do
|
||||||
|
|||||||
Reference in New Issue
Block a user