Merge pull request #248 from femtofox/new_working

Move firstboot flag to /etc/femto.conf
This commit is contained in:
noon92 2025-01-24 20:39:48 +02:00 • committed by GitHub
commit 2f45ecc263
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
6 changed files with 15 additions and 11 deletions

View file

@ -1 +0,0 @@
# File to tell rc.local that this is the first boot. Will be deleted automatically.

View file

@ -1,2 +1,2 @@
firstboot=false
act_led=disable
firstboot=true
act_led=enable

View file

@ -1,4 +1,9 @@
#!/bin/bash
if grep -qE '^first_boot=true' /etc/femto.conf; then
log_message "First boot, skipping \`boot complete\` tasks."
exit 1
fi
echo "Boot complete"
femto-utils.sh -a &

View file

@ -4,7 +4,7 @@ log_message() {
logger "First boot: $1" # Log to the system log
}
if [ ! -e "/etc/.firstboot" ]; then
if grep -qE '^first_boot=false' /etc/femto.conf; then
who | grep -q . || exit 0
@ -20,14 +20,14 @@ Re-running this script after first boot should not cause any harm, but may not w
\n\
Proceed?" 14 60
if [ $? -eq 1 ]; then #if cancel/no
exit 1
exit 0
fi
fi
echo -e "\e[32m******* First boot *******\e[0m"
# Disable LED to prevent boot codes from showing during this boot
sh -c "echo 34 > /sys/class/gpio/unexport"
#sh -c "echo 34 > /sys/class/gpio/unexport"
# Perform filesystem resize
log_message "Resizing filesystem. This can take up to 10 minutes, depending on microSD card size and speed"
@ -86,7 +86,7 @@ fi
#systemctl restart meshtasticd
# remove first boot flag
rm /etc/.firstboot
sed -i -E 's/^first_boot=.*/first_boot=false/' /etc/femto.conf
log_message "Removing first boot flag and rebooting in 5 seconds..."
sleep 5
reboot

View file

@ -14,7 +14,7 @@ log_message() {
echo "$(date +"%Y-%m-%d %H:%M:%S") $1" >> /tmp/femtofox-config.log
}
if [ -e "/etc/.firstboot" ]; then
if grep -qE '^first_boot=true' /etc/femto.conf; then
log_message "First boot, skipping USB Configuration Tool."
exit 0
fi

View file

@ -25,12 +25,12 @@ fi
act_led() {
if [ "$1" = "disable" ]; then
echo "none" > /sys/class/leds/work/trigger
grep -qE '^act_led=' /etc/femto.conf && sudo sed -i -E 's/^act_led=.*/act_led=disable/' /etc/femto.conf || echo 'act_led=disable' | sudo tee -a /etc/femto.conf > /dev/null
grep -qE '^act_led=' /etc/femto.conf && sed -i -E 's/^act_led=.*/act_led=disable/' /etc/femto.conf || echo 'act_led=disable' | tee -a /etc/femto.conf > /dev/null
echo "Disabled activity LED."
exit 0
elif [ "$1" = "enable" ]; then
echo "activity" > /sys/class/leds/work/trigger
grep -qE '^act_led=' /etc/femto.conf && sudo sed -i -E 's/^act_led=.*/act_led=enable/' /etc/femto.conf || echo 'act_led=enable' | sudo tee -a /etc/femto.conf > /dev/null
grep -qE '^act_led=' /etc/femto.conf && sed -i -E 's/^act_led=.*/act_led=enable/' /etc/femto.conf || echo 'act_led=enable' | tee -a /etc/femto.conf > /dev/null
echo "Enabled activity LED."
exit 0
elif [ "$1" = "check" ]; then
@ -68,7 +68,7 @@ system_info() {
local os_version="Foxbuntu v$(grep -oP 'major=\K[0-9]+' /etc/foxbuntu-release).$(grep -oP 'minor=\K[0-9]+' /etc/foxbuntu-release)$(output=$(grep -o 'patch=[1-9][0-9]*' /etc/foxbuntu-release | cut -d= -f2) && [ -n "$output" ] && echo ".$output")$(grep -oP 'hotfix=\K[a-z]+' /etc/foxbuntu-release) ($(lsb_release -d | awk -F'\t' '{print $2}') $(lsb_release -c | awk -F'\t' '{print $2}'))"
local system_uptime="$(uptime -p | awk '{$1=""; print $0}' | sed -e 's/ day\b/d/g' -e 's/ hour\b/h/g' -e 's/ hours\b/h/g' -e 's/ minute\b/m/g' -e 's/ minutes\b/m/g' | sed 's/,//g')"
local logging_enabled="$(logging "check" | sed 's/\x1b\[[0-9;]*m//g')"
local act_led="$(femto-utils.sh -l "check" | sed -r 's/\x1B\[[0-9;]*[mK]//g')" #remove color from output
local act_led="$(femto-utils.sh -a "check" | sed -r 's/\x1B\[[0-9;]*[mK]//g')" #remove color from output
local kernel_active_modules="$(lsmod | awk 'NR>1 {print $1}' | tr '\n' ' ' && echo)"
local kernel_boot_modules="$(modules=$(sed -n '6,$p' /etc/modules | sed ':a;N;$!ba;s/\n/, /g;s/, $//'); [ -z "$modules" ] && echo "none" || echo "$modules")"