1748956374

This commit is contained in:
2025-06-03 07:12:53 -06:00
parent 9fabc93055
commit b9a7433b7c
6 changed files with 33 additions and 35 deletions
+4 -4
View File
@@ -7,7 +7,7 @@ else
username=$USER
fi
echo "Backing up configs"
echo "Backing up configs..."
dname=./conf-$(date +%s)
@@ -22,15 +22,15 @@ sudo cp /etc/influxdb/influxdb.conf $dname/influxdb.conf
sudo cp /etc/telegraf/telegraf.conf $dname/telegraf.conf
if [ -f /etc/udev/rules.d/50-tty.rules ]; then
echo "/etc/udev/rules.d/50-tty.rules found, copying as well"
echo "/etc/udev/rules.d/50-tty.rules found, copying as well..."
sudo cp /etc/udev/rules.d/50-tty.rules $dname/50-tty.rules
fi
echo "Fixing permissions in $dname"
echo "Fixing permissions in $dname..."
sudo chown -R $username:$username $dname
sudo chmod 775 $dname
sudo chmod 664 $dname/*
echo "Compressing up and deleting $dname to $dname.tar.gz"
echo "Compressing up and deleting $dname to $dname.tar.gz..."
tar czf $dname.tar.gz $dname
rm -rf $dname
+1 -1
View File
@@ -1,6 +1,6 @@
#!/bin/bash
# updoot this
echo "Updating this repo"
echo "Updating this repo..."
git pull 2>/dev/null 1>/dev/null
# run da raspberry pi config script
+3 -3
View File
@@ -3,13 +3,13 @@ set -e
# updoot
echo "Updating software lists..."
sudo apt update 2>/dev/null 1>/dev/null
sudo apt update 1>/dev/null
echo "Fully upgrading, this may take a while..."
sudo apt dist-upgrade -y 2>/dev/null 1>/dev/null
sudo apt dist-upgrade -y 1>/dev/null
echo "Cleaning up..."
sudo apt autoremove -y 2>/dev/null 1>/dev/null
sudo apt autoremove -y 1>/dev/null
echo "Rebooting now!"
sudo reboot
+12 -12
View File
@@ -2,13 +2,13 @@
# set -e
# grafana repo and install
echo "Add Grafana repo"
echo "Add Grafana repo..."
sudo mkdir -p /etc/apt/keyrings/
wget -q -O - https://apt.grafana.com/gpg.key | gpg --dearmor | sudo tee /etc/apt/keyrings/grafana.gpg > /dev/null
echo "deb [signed-by=/etc/apt/keyrings/grafana.gpg] https://apt.grafana.com stable main" | sudo tee /etc/apt/sources.list.d/grafana.list
# telegraf repo and install
echo "Add Telegraf repo"
echo "Add Telegraf repo..."
curl --silent --location -O \
https://repos.influxdata.com/influxdata-archive.key \
&& echo "943666881a1b8d9b849b74caebf02d3465d6beb716510d86a39f6c8e8dac7515 influxdata-archive.key" \
@@ -20,18 +20,18 @@ https://repos.influxdata.com/influxdata-archive.key \
# remove dat key file thing
if [ -f ./influxdata-archive.key ]; then
echo "Removing ./influxdata-archive.key"
echo "Removing ./influxdata-archive.key..."
rm -f ./influxdata-archive.key
else
echo "./influxdata-archive.key not found, skipping delete"
echo "./influxdata-archive.key not found, skipping delete..."
fi
# install em
echo "Getting new software lists..."
sudo apt update 2>/dev/null 1>/dev/null
sudo apt update 1>/dev/null
echo "Installing packages, this may take a while..."
sudo apt install telegraf grafana influxdb pps-tools gpsd gpsd-clients chrony syslog-ng gh lynx btop htop iptraf iotop neovim netcat-traditional -y 2>/dev/null 1>/dev/null
sudo apt install telegraf grafana influxdb pps-tools gpsd gpsd-clients chrony syslog-ng gh lynx btop htop iptraf iotop neovim netcat-traditional -y 1>/dev/null
# check if /boot/firmware/config.txt is configured yet
grep -q -e "GPS PPS signals" /boot/firmware/config.txt
@@ -39,9 +39,9 @@ grepconfig=$?
# configure the overlay
if [ $grepconfig -eq 0 ]; then
echo "/boot/firmware/config.txt already updated, skipping"
echo "/boot/firmware/config.txt already updated, skipping..."
else
echo "Adding lines to /boot/firmware/config.txt to enable pps and gpio uart"
echo "Adding lines to /boot/firmware/config.txt to enable pps and gpio uart..."
sudo bash -c "echo '# the next 3 lines are for GPS PPS signals' >> /boot/firmware/config.txt"
sudo bash -c "echo 'dtoverlay=pps-gpio,gpiopin=18' >> /boot/firmware/config.txt"
sudo bash -c "echo 'enable_uart=1' >> /boot/firmware/config.txt"
@@ -54,14 +54,14 @@ gerppps=$?
# add pps-gpio to modules
if [ $gerppps -eq 0 ]; then
echo "pps-gpio already in /etc/modules, skipping"
echo "pps-gpio already in /etc/modules, skipping..."
else
echo "Adding pps-gpio to /etc/modules"
echo "Adding pps-gpio to /etc/modules..."
sudo bash -c "echo 'pps-gpio' >> /etc/modules"
fi
echo "Cleaning up"
sudo apt autoremove 2>/dev/null 1>/dev/null # cleanup
echo "Cleaning up..."
sudo apt autoremove 1>/dev/null # cleanup
echo "Rebooting now!"
sudo reboot
+11 -10
View File
@@ -8,25 +8,26 @@ fi
# handle users serial shit
## self
echo "Giving $username the right permissions"
echo "Giving $username the right permissions..."
sudo usermod -aG dialout $username
## service users
echo "Giving service users the right permissions"
echo "Giving service users the right permissions..."
sudo usermod -aG dialout gpsd
sudo usermod -aG dialout _chrony
# reconfigure to normal mode
echo "Starting configure script"
echo "Starting configure script..."
bash ./reconfig_full.sh ./working-normal-level-conf
# enable services
echo "Enabling Services"
sudo systemctl enable gpsd
sudo systemctl enable chrony
sudo systemctl enable influxdb
sudo systemctl enable telegraf
sudo systemctl enable grafana-server
sudo systemctl enable syslog-ng
echo "Enabling Services..."
sudo systemctl enable gpsd 1>/dev/null
sudo systemctl enable chrony 1>/dev/null
sudo systemctl enable influxdb 1>/dev/null
sudo systemctl enable grafana-server 1>/dev/null
sudo systemctl enable telegraf 1>/dev/null
sudo systemctl enable grafana-server 1>/dev/null
sudo systemctl enable syslog-ng 1>/dev/null
# reboot rq
echo "Rebooting now!"
+2 -5
View File
@@ -24,7 +24,7 @@ telegraf_new="$1/telegraf.conf"
udev_new="$1/50-tty.rules"
# stop da services
bash ./services.sh stop
bash ./services.sh stop 1>/dev/null
# backup conf
bash ./dump_configs.sh
@@ -39,7 +39,4 @@ sudo bash -c "cat $telegraf_new > $telegraf"
sudo bash -c "cat $udev_new > $udev_rule"
# start da services
bash ./services.sh start
# show services status
# bash ./services.sh status
bash ./services.sh start 1>/dev/null