Skip to content

Commit

Permalink
Merge branch 'release/v0.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
matteocarnelos committed Apr 28, 2022
2 parents 122273a + a60b794 commit 40f9485
Show file tree
Hide file tree
Showing 7 changed files with 25 additions and 31 deletions.
27 changes: 10 additions & 17 deletions Automation_Custom_Script.sh
Original file line number Diff line number Diff line change
@@ -1,32 +1,25 @@
. /boot/dietpi/func/dietpi-globals

# Set WiFi Country Code
/boot/dietpi/func/dietpi-set_hardware wificountrycode "$(sed -n '/^[[:blank:]]*AUTO_SETUP_NET_WIFI_COUNTRY_CODE=/{s/^[^=]*=//p;q}' /boot/dietpi.txt)"
# Remove unused services
G_EXEC rm /etc/systemd/system/dietpi-vpn.service
G_EXEC rm /etc/systemd/system/dietpi-cloudshell.service

# Uninstall OpenSSH Client
dietpi-software uninstall 0
/boot/dietpi/dietpi-software uninstall 0

# Configure RTC Module
G_AGP fake-hwclock
G_CONFIG_INJECT "dtoverlay=i2c-rtc,ds3231" "dtoverlay=i2c-rtc,ds3231" /boot/config.txt
G_EXEC sed -i "/systemd/,/fi/s/^/#/" /lib/udev/hwclock-set
G_EXEC sed -i "/--systz/s/^/#/" /lib/udev/hwclock-set

# Install packages
# Install Telegraf
G_AGI telegraf
G_EXEC pip3 install -r /boot/sailtrack/requirements.txt

# Enable services
for s in /etc/systemd/system/sailtrack*.service; do
servicename=$(basename "$s" .service)
G_CONFIG_INJECT "+ $servicename" "+ $servicename" /boot/dietpi/.dietpi-services_include_exclude
/boot/dietpi/dietpi-services dietpi_controlled "$servicename"
done
G_CONFIG_INJECT "+ telegraf" "+ telegraf" /boot/dietpi/.dietpi-services_include_exclude
G_CONFIG_INJECT "+ sailtrack-lora2mqtt" "+ sailtrack-lora2mqtt" /boot/dietpi/.dietpi-services_include_exclude
G_EXEC /boot/dietpi/dietpi-services dietpi_controlled telegraf
G_EXEC /boot/dietpi/dietpi-services dietpi_controlled sailtrack-lora2mqtt

# Configure DietPi Banner
settings=(1 1 1 0 0 1 0 1 0 0 0 0 0 0 0 0)
for i in "${!settings[@]}"; do
echo "aENABLED[$i]=${settings[$i]}" >> /boot/dietpi/.dietpi-banner
G_CONFIG_INJECT "aENABLED\[$i]=" "aENABLED[$i]=${settings[$i]}" /boot/dietpi/.dietpi-banner
done

# Reboot after first boot is completed
Expand Down
2 changes: 0 additions & 2 deletions dietpi.txt
Original file line number Diff line number Diff line change
Expand Up @@ -131,8 +131,6 @@ AUTO_SETUP_GLOBAL_PASSWORD=dietpi
# - DietPi will automatically install all dependencies, like ALSA/X11 for desktops etc.
# - E.g. the following (without the leading "#") will install the LXDE desktop automatically on first boot:
#AUTO_SETUP_INSTALL_SOFTWARE_ID=23
AUTO_SETUP_INSTALL_SOFTWARE_ID=130 # Python 3 + Pip
AUTO_SETUP_INSTALL_SOFTWARE_ID=72 # I2C
AUTO_SETUP_INSTALL_SOFTWARE_ID=60 # WiFi Hotspot
AUTO_SETUP_INSTALL_SOFTWARE_ID=123 # Mosquitto
AUTO_SETUP_INSTALL_SOFTWARE_ID=74 # InfluxDB
Expand Down
8 changes: 8 additions & 0 deletions rootfs/etc/systemd/system/sailtrack-timesync.service
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
[Unit]
Description=SailTrack-TimeSync

[Service]
ExecStart=/boot/sailtrack/sailtrack-timesync

[Install]
WantedBy=multi-user.target
15 changes: 4 additions & 11 deletions rootfs/etc/telegraf/telegraf.conf
Original file line number Diff line number Diff line change
Expand Up @@ -25,20 +25,13 @@ omit_hostname = true
[outputs.influxdb.tagpass]
topic = ["status/*"]

[[outputs.influxdb]]
urls = ["${INFLUX_URL}"]
database = "logs-data"
username = "${INFLUX_USER}"
password = "${INFLUX_PASSWORD}"
[outputs.influxdb.tagpass]
topic = ["log/*"]

[[inputs.mqtt_consumer]]
servers = ["${MQTT_SERVER}"]
topics = ["#"]
client_id = "ground-telegraf"
client_id = "sailtrack-ground"
username = "${MQTT_USER}"
password = "${MQTT_PASSWORD}"
data_format = "json"
json_name_key = "measurement"
json_string_fields = ["message"]
[[inputs.mqtt_consumer.topic_parsing]]
topic = "#"
measurement = "_/measurement"
Empty file removed sailtrack/requirements.txt
Empty file.
2 changes: 1 addition & 1 deletion sailtrack/sailtrack-lora2mqtt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
#!/usr/bin/env python3
#!/bin/bash


2 changes: 2 additions & 0 deletions sailtrack/sailtrack-timesync
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
#!/bin/bash

0 comments on commit 40f9485

Please sign in to comment.