mirror of
https://github.com/femtofox/femtofox.git
synced 2026-11-20 23:16:30 -05:00
Move meshtasticd -h argument to service override
This commit is contained in:
parent
86bdb71578
commit
fae26cc178
5 changed files with 42 additions and 25 deletions
|
|
@ -53,8 +53,10 @@ echo "femtofox" | tee /etc/hostname > /dev/null
|
|||
echo "Configuring autostart of systemd services..."
|
||||
|
||||
systemctl enable button
|
||||
systemctl enable meshtasticd
|
||||
systemctl enable femto-runonce.service
|
||||
systemctl enable femto-usb-config-tool.service
|
||||
systemctl enable femto-boot-complete.service
|
||||
systemctl enable wifi-mesh-control
|
||||
|
||||
systemctl disable NetworkManager
|
||||
|
|
|
|||
|
|
@ -26,18 +26,18 @@ echo 34 > /sys/class/gpio/export && echo out > /sys/class/gpio/gpio34/direction
|
|||
#/usr/local/bin/femto-usb-config-tool.sh
|
||||
|
||||
# boot complete
|
||||
(
|
||||
echo "Disabling ACT LED..."
|
||||
echo "none" > /sys/class/leds/work/trigger &
|
||||
sleep 1
|
||||
|
||||
# blink successful boot code
|
||||
for i in $(seq 1 5); do
|
||||
echo 1 > /sys/class/gpio/gpio34/value;
|
||||
sleep 0.5;
|
||||
echo 0 > /sys/class/gpio/gpio34/value;
|
||||
sleep 0.5;
|
||||
done
|
||||
) &
|
||||
#(
|
||||
# echo "Disabling ACT LED..."
|
||||
# echo "none" > /sys/class/leds/work/trigger &
|
||||
# sleep 1
|
||||
#
|
||||
# # blink successful boot code
|
||||
# for i in $(seq 1 5); do
|
||||
# echo 1 > /sys/class/gpio/gpio34/value;
|
||||
# sleep 0.5;
|
||||
# echo 0 > /sys/class/gpio/gpio34/value;
|
||||
# sleep 0.5;
|
||||
# done
|
||||
#) &
|
||||
|
||||
exit 0
|
||||
|
|
|
|||
|
|
@ -0,0 +1,14 @@
|
|||
[Unit]
|
||||
Description=Boot Complete
|
||||
After=serial-getty@ttyFIQ0.service
|
||||
DefaultDependencies=no
|
||||
|
||||
[Service]
|
||||
ExecStart=/usr/local/bin/femto-boot-complete.sh
|
||||
Type=oneshot
|
||||
Restart=no
|
||||
StandardOutput=journal+console
|
||||
StandardError=journal+console
|
||||
|
||||
[Install]
|
||||
WantedBy=default.target
|
||||
|
|
@ -1,6 +1,9 @@
|
|||
[Service]
|
||||
ExecStartPost=/bin/sh -c 'renice -n -20 -p $(pgrep meshtasticd)'
|
||||
ExecStart=
|
||||
ExecStart=/bin/sh -c '/usr/sbin/meshtasticd -h $(sed -n "/Serial/ s/^.*: \(.*\)$/\U\1/p" /proc/cpuinfo | bc | tail -c 9)'
|
||||
|
||||
[Unit]
|
||||
After=rc-local.service
|
||||
Wants=rc-local.service
|
||||
After=network-online.target
|
||||
|
|
@ -14,7 +14,7 @@ if [ ! -e "/etc/.firstboot" ]; then
|
|||
export LANG=C.UTF-8
|
||||
dialog --title "Femtofox run once utility" --yesno "\
|
||||
This does not appear to be this system's first boot.\n\
|
||||
Re-running this script will restore RTC support, set the Meshtastic nodeid and eth0 MAC address to be derivative of the CPU serial number, set the Meshtastic wifi status to \`enabled\` and then reboot.\n\
|
||||
Re-running this script will resize the filesystem to fit the SD card, allocate a swap file, add RTC support, add terminal type to .bashrc, set the eth0 MAC address to be derivative of the CPU serial number and then reboot.\n\
|
||||
\n\
|
||||
Re-running this script after first boot should not cause any harm, but may not work as expected.\n\
|
||||
\n\
|
||||
|
|
@ -31,13 +31,13 @@ fi
|
|||
sudo resize2fs /dev/mmcblk1p7
|
||||
|
||||
# allocate swap file
|
||||
if [ ! -f /etc/.filesystem_swap ]; then # check if swap file already exists
|
||||
if [ ! -f /swapfile ]; then # check if swap file already exists
|
||||
sudo fallocate -l 1G /swapfile
|
||||
sudo chmod 600 /swapfile
|
||||
sudo mkswap /swapfile > /dev/null
|
||||
sudo swapon /swapfile > /dev/null
|
||||
echo '/swapfile none swap sw 0 0' | tee -a /etc/fstab > /dev/null
|
||||
touch /etc/.filesystem_swap
|
||||
# touch /etc/.filesystem_swap # no longer used
|
||||
log_message "Swap file allocated."
|
||||
else
|
||||
log_message "Swap file already allocated, skipping."
|
||||
|
|
@ -64,9 +64,7 @@ fi
|
|||
lines="export NCURSES_NO_UTF8_ACS=1
|
||||
export TERM=xterm-256color
|
||||
export LANG=C.UTF-8"
|
||||
|
||||
# Check if the lines are already in .bashrc
|
||||
if ! grep -Fxq "$lines" /home/femto/.bashrc; then
|
||||
if ! grep -Fxq "$lines" /home/femto/.bashrc; then # Check if the lines are already in .bashrc
|
||||
echo "$lines" >> /home/femto/.bashrc
|
||||
echo "Added TERM, LANG and NCURSES_NO_UTF8_ACS to .bashrc"
|
||||
else
|
||||
|
|
@ -74,13 +72,13 @@ else
|
|||
fi
|
||||
|
||||
# set meshtastic nodeid to derivative of CPU serial number (unique to this board)
|
||||
seed=$(sed -n '/Serial/ s/^.*: \(.*\)$/\U\1/p' /proc/cpuinfo | bc | tail -c 9)
|
||||
#seed=$(sed -n '/Serial/ s/^.*: \(.*\)$/\U\1/p' /proc/cpuinfo | bc | tail -c 9)
|
||||
#seed=$((0x$(awk '/Serial/ {print $3}' /proc/cpuinfo) & 0x3B9AC9FF)) #alternate method for generating seed - not in use
|
||||
sed -i "s|^ExecStart=/usr/sbin/meshtasticd.*|ExecStart=/usr/sbin/meshtasticd -h $seed|" /usr/lib/systemd/system/meshtasticd.service
|
||||
log_message "Using Luckfox CPU S/N to generate nodeid for Meshtastic."
|
||||
systemctl daemon-reload
|
||||
systemctl enable meshtasticd
|
||||
systemctl restart meshtasticd
|
||||
#sed -i "s|^ExecStart=/usr/sbin/meshtasticd.*|ExecStart=/usr/sbin/meshtasticd -h $seed|" /usr/lib/systemd/system/meshtasticd.service
|
||||
#log_message "Using Luckfox CPU S/N to generate nodeid for Meshtastic."
|
||||
#systemctl daemon-reload
|
||||
#systemctl enable meshtasticd
|
||||
#systemctl restart meshtasticd
|
||||
|
||||
# remove first boot flag
|
||||
rm /etc/.firstboot
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue