From b9a7433b7c34a9aab6875da8fdc6f27a55c00b48 Mon Sep 17 00:00:00 2001 From: PrincessPi3 Date: Tue, 3 Jun 2025 07:12:53 -0600 Subject: [PATCH] 1748956374 --- dump_configs.sh | 8 ++++---- installer1.sh | 2 +- installer2.sh | 6 +++--- installer3.sh | 24 ++++++++++++------------ installer4.sh | 21 +++++++++++---------- reconfig_full.sh | 7 ++----- 6 files changed, 33 insertions(+), 35 deletions(-) diff --git a/dump_configs.sh b/dump_configs.sh index c5cfb2f..a6e2165 100644 --- a/dump_configs.sh +++ b/dump_configs.sh @@ -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 \ No newline at end of file diff --git a/installer1.sh b/installer1.sh index 1f5f54a..359a9ce 100644 --- a/installer1.sh +++ b/installer1.sh @@ -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 diff --git a/installer2.sh b/installer2.sh index 5ba7c22..2f66c29 100644 --- a/installer2.sh +++ b/installer2.sh @@ -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 diff --git a/installer3.sh b/installer3.sh index 3b4fd67..d0c3253 100644 --- a/installer3.sh +++ b/installer3.sh @@ -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 diff --git a/installer4.sh b/installer4.sh index d65a209..64c5fd3 100644 --- a/installer4.sh +++ b/installer4.sh @@ -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!" diff --git a/reconfig_full.sh b/reconfig_full.sh index b42e2e8..6daa5d6 100644 --- a/reconfig_full.sh +++ b/reconfig_full.sh @@ -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 \ No newline at end of file +bash ./services.sh start 1>/dev/null \ No newline at end of file