From e8d21436d0e05c5fca84fbd6977b59f43a776dee Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 2 Jan 2025 09:50:01 +0200 Subject: [PATCH 1/2] Add a couple comments to femto-config --- .../out/rootfs_uclibc_rv1106/usr/local/bin/femto-config | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 5a30fa7..26d319c 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -379,13 +379,13 @@ help_menu() { dialog --msgbox "$(femto-license.sh -a)" 0 0 ;; 2) - femto_pinouts + femto_pinouts #local function ;; 3) dialog --msgbox "$(femto-license.sh -f)" 28 60 ;; 4) - femto-license.sh -F + femto-license.sh -F #echoed outside of dialog, as it's just too much for dialog to handle pause ;; 5) From 90087fb55b5a998826400e34e22c8be26949279a Mon Sep 17 00:00:00 2001 From: nagumii Date: Thu, 2 Jan 2025 17:43:58 +0200 Subject: [PATCH 2/2] Migrate usb-config script to use the new architecture --- .../overlay-luckfox-ubuntu/etc/rc.local | 2 +- .../usr/local/bin/button.sh | 2 +- .../usr/local/bin/femto-config | 42 ++++-- .../usr/local/bin/femto-meshtasticd-config.sh | 27 +++- .../usr/local/bin/femto-network-config.sh | 14 +- .../bin/{runonce.sh => femto-runonce.sh} | 0 ...{usbconfig.sh => femto-usb-config-tool.sh} | 125 +++++++----------- .../usr/local/bin/femto-wifi-config.sh | 81 ++++++++++++ 8 files changed, 188 insertions(+), 105 deletions(-) rename foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/{runonce.sh => femto-runonce.sh} (100%) mode change 100755 => 100644 rename foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/{usbconfig.sh => femto-usb-config-tool.sh} (62%) mode change 100755 => 100644 create mode 100644 foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-wifi-config.sh diff --git a/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local b/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local index 83ca210..198fdd4 100755 --- a/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local +++ b/foxbuntu/project/cfg/BoardConfig_IPC/overlay/overlay-luckfox-ubuntu/etc/rc.local @@ -7,7 +7,7 @@ luckfox-config load #run only on first boot if [ -e "/usr/local/bin/.firstboot" ]; then - /usr/local/bin/runonce.sh + /usr/local/bin/femto_runonce.sh fi # try enable RTC diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/button.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/button.sh index 1adc0d3..a5024e1 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/button.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/button.sh @@ -29,7 +29,7 @@ evtest --grab /dev/input/event0 | while read line; do else logger "$duration second button press detected. Rebooting." echo 1 > /sys/class/gpio/gpio34/value; - sudo reboot + reboot fi fi done diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config index 26d319c..87f433d 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -250,7 +250,7 @@ set_lora_radio() { ;; esac if [ -n "$radio" ]; then #if a radio was selected - femto-meshtasticd-config.sh -l "$radio" + femto-meshtasticd-config.sh -l "$radio" -s # set the radio, then restart. return fi done @@ -261,7 +261,7 @@ meshtasticd_settings() { local title="Meshtasticd Settings" while true; do local option="" - option=$(dialog --menu "$title" 19 50 4 \ + option=$(dialog --menu "$title" 22 50 4 \ 1 "View current configuration URL & QR code" \ 2 "Set new configuration URL" \ 3 "View current lora radio selection" \ @@ -271,9 +271,12 @@ meshtasticd_settings() { 7 "Clear admin keys" \ 8 "Enable legacy admin channel" \ 9 "Disable legacy admin channel" \ - 10 "Upgrade/install Meshtasticd" \ - 11 "Uninstall Meshtasticd" \ - 12 "Back to Main Menu" 3>&1 1>&2 2>&3) + 10 "Meshtasticd service status" \ + 11 "Start/restart Meshtasticd service" \ + 12 "Stop Meshtasticd service" \ + 13 "Upgrade/install Meshtasticd" \ + 14 "Uninstall Meshtasticd" \ + 15 "Back to Main Menu" 3>&1 1>&2 2>&3) exit_status=$? # This line checks the exit status of the dialog command if [ $exit_status -ne 0 ]; then # Exit the loop if the user selects "Cancel" or closes the dialog @@ -333,21 +336,38 @@ meshtasticd_settings() { pause fi ;; - 10) #Upgrade meshtasticd) + 10) #check meshtasticd service status) + dialog --msgbox "$(systemctl status meshtasticd)" 0 0 + ;; + 11) #start/restart meshtasticd) + dialog --title "$title" --yesno "Start/restart Meshtasticd service?" 0 0 + if [ $? -eq 0 ]; then #unless cancel/no + femto-meshtasticd-config.sh -s + dialog --msgbox "Meshtasticd service started/restarted." 0 0 + fi + ;; + 12) #stop meshtasticd) + dialog --title "$title" --yesno "Stop Meshtasticd service?" 0 0 + if [ $? -eq 0 ]; then #unless cancel/no + femto-meshtasticd-config.sh -t + dialog --msgbox "Meshtasticd service stopped." 0 0 + fi + ;; + 13) #Upgrade meshtasticd) dialog --title "$title" --yesno "Upgrade Meshtasticd?\nRequires internet connection." 0 0 if [ $? -eq 0 ]; then #unless cancel/no femto-meshtasticd-config.sh -u pause fi ;; - 11) + 14) #uninstall meshtasticd) dialog --title "$title" --yesno "Uninstall Meshtasticd?\n\nFoxbuntu was designed with Meshtasticd integration in mind, and may behave unexpectedly if Meshtasticd is removed." 0 0 if [ $? -eq 0 ]; then - femto-meshtasticd-config.sh -r + femto-meshtasticd-config.sh -x dialog --msgbox "Meshtasticd uninstalled. To purge all remnants, run \`sudo apt purge\`.\nAfter reinstallation but before first launch, run \`sudo runonce.sh\`." 8 40 fi ;; - 12) + 15) return ;; esac @@ -379,13 +399,13 @@ help_menu() { dialog --msgbox "$(femto-license.sh -a)" 0 0 ;; 2) - femto_pinouts #local function + femto_pinouts ;; 3) dialog --msgbox "$(femto-license.sh -f)" 28 60 ;; 4) - femto-license.sh -F #echoed outside of dialog, as it's just too much for dialog to handle + femto-license.sh -F pause ;; 5) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh index 3cbe06f..eb10722 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-meshtasticd-config.sh @@ -16,8 +16,11 @@ Options are: -c Clear admin keys -e Enable legacy admin channel -d Disable legacy admin channel +-o "true" Set legacy admin channel state (true/false), case sensitive +-s Start/restart Meshtasticd Service +-t Stop Meshtasticd Service -u Upgrade Meshtasticd --r Uninstall Meshtasticd +-x Uninstall Meshtasticd -m Meshtastic update tool. Syntax: \`femto-meshtasticd-config.sh -m \"--set security.admin_channel_enabled false\" 10 \"Disable legacy admin\"\` Will retry the \`--set security.admin_channel_enabled false\` command until successful or up to 10 times, and tag status reports with \`Disable legacy admin\` via echo and to system log. EOF @@ -40,23 +43,24 @@ meshtastic_update() { logger $output if echo "$output" | grep -qiE "Abort|invalid|Error|refused|Errno"; then if [ "$retries" -lt $attempts ]; then - local msg="${ref:+$ref }Meshtastic update failed, retrying ($(($retries + 1))/$attempts)..." + local msg="${ref:+$ref}Meshtastic update failed, retrying ($(($retries + 1))/$attempts)..." echo "$msg" logger "$msg" sleep 2 # Add a small delay before retrying fi else local success="true" - msg="${ref:+$ref }Meshtastic update successful!" + msg="${ref:+$ref}Meshtastic update successful!" echo "$msg" logger "$msg" if [ -n "$external" ]; then exit 0 fi + return fi done if [ -z "$success" ]; then - msg="${ref:+$ref }Meshtastic update failed." + msg="${ref:+$ref}Meshtastic update FAILED." echo "$msg" logger "$msg" if [ -n "$external" ]; then @@ -66,7 +70,7 @@ meshtastic_update() { } # Parse options -while getopts ":hgkl:q:va:cedurm" opt; do +while getopts ":hgkl:q:va:cedo:struxm" opt; do case ${opt} in h) # Option -h (help) echo -e "$help" @@ -118,11 +122,22 @@ while getopts ":hgkl:q:va:cedurm" opt; do d) # Option -d (disable legacy admin) meshtastic_update "--set security.admin_channel_enabled false" 10 "Disable legacy admin" ;; + o) # Option -o (set legacy admin true/false) + meshtastic_update "--set security.admin_channel_enabled $OPTARG" 10 "Disable legacy admin" + ;; + s) # Option -s (start/restart Meshtasticd service) + systemctl restart meshtasticd + echo "Meshtasticd service started/restarted." + ;; + t) # Option -t (stop Meshtasticd service) + systemctl stop meshtasticd + echo "Meshtasticd service stopped." + ;; u) # Option -u (upgrade meshtasticd) apt update apt install --only-upgrade meshtasticd ;; - r) # Option -r (uninstall meshtasticd) + x) # Option -x (uninstall meshtasticd) apt remove meshtasticd ;; m) diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh index 1af4d6e..6c0203d 100644 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-network-config.sh @@ -121,11 +121,11 @@ if [ "$updated_wifi" = true ]; then timeout 30s dhclient -v echo " Wifi restarted. Enabling Meshtastic wifi setting." femto-meshtasticd-config.sh -m "--set network.wifi_enabled true" 10 "USB config" #| tee -a /tmp/femtofox-config.log - if [ $? -eq 1 ]; then - echo "Update of Meshtastic FAILED." - exit 1 - else - echo "Updated Meshtastic successfully." - exit 0 - fi + # if [ $? -eq 1 ]; then + # echo "Update of Meshtastic FAILED." + # exit 1 + # else + # echo "Updated Meshtastic successfully." + # exit 0 + # fi fi diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/runonce.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh old mode 100755 new mode 100644 similarity index 100% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/runonce.sh rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-runonce.sh diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/usbconfig.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh old mode 100755 new mode 100644 similarity index 62% rename from foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/usbconfig.sh rename to foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh index 517d043..1b5490e --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/usbconfig.sh +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-usb-config-tool.sh @@ -1,13 +1,11 @@ #!/bin/bash +mount_point="/mnt/usb" # Set the mount point -# Set the mount point -mount_point="/mnt/usb" - -# Function to log both to the screen and syslog +# Function to log to screen, syslog and logfile to be saved to usb drive log_message() { - echo "USB config: $1" # Echo to the screen - logger "USB config: $1" # Log to the system log - echo "$(date +"%Y-%m-%d %H:%M:%S") $1" >> /tmp/femtofox-config.log # Log to file + echo "USB config: $1" + logger "USB config: $1" + echo "$(date +"%Y-%m-%d %H:%M:%S") $1" >> /tmp/femtofox-config.log } exit_script() { @@ -39,11 +37,6 @@ escape_sed() { usb_path=$(lsblk -o NAME,FSTYPE,SIZE,TYPE,MOUNTPOINT | grep -E "vfat|ext4|ntfs|exfat" | grep -E "sd[a-z]([0-9]*)" | awk '{print $1}' | sed 's/[^a-zA-Z0-9]//g' | head -n 1) full_device_path="/dev/$usb_path" # Construct the full device path -#if [ -d "$mount_point" ]; then -# rmdir "$mount_point" -# log_message "/mnt/usb deleted." -#fi - # If no USB device is found, exit if [ -z "$usb_path" ]; then message="No USB drive found." @@ -92,8 +85,8 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then meshtastic_lora_radio="" found_config="false" update_wifi="false" - update_meshtastic_url="" - update_meshtastic_security="" + wifi_command="femto-network-config.sh" + meshtastic_security_command="femto-meshtasticd-config.sh" # Escape and read the fields from the USB config file if they exist while IFS='=' read -r key value; do @@ -113,30 +106,25 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then # Update wpa_supplicant.conf with the new values, if specified if [[ -n "$wifi_country" ]]; then - # Update or add the country field - if grep -q "^country=" "$wpa_supplicant_conf"; then - sed -i "s/^country=.*/country=$wifi_country/" "$wpa_supplicant_conf" - log_message "Updated Wi-Fi country in wpa_supplicant.conf to $wifi_country." - else - echo "country=$wifi_country" >> "$wpa_supplicant_conf" - log_message "Added Wi-Fi country to wpa_supplicant.conf as $wifi_country." - fi + # Update country field + wifi_command="$wifi_command -c \"$wifi_country\"" + log_message "Updating Wi-Fi country in wpa_supplicant.conf to $wifi_country." found_config="true" update_wifi="true" fi if [[ -n "$wifi_ssid" ]]; then # Update the ssid in the network block - sed -i "/ssid=/s/\".*\"/\"$wifi_ssid\"/" "$wpa_supplicant_conf" - log_message "Updated Wi-Fi SSID in wpa_supplicant.conf to $wifi_ssid." + wifi_command="$wifi_command -s \"$wifi_ssid\"" + log_message "Updating Wi-Fi SSID in wpa_supplicant.conf to \`$wifi_ssid\`." found_config="true" update_wifi="true" fi if [[ -n "$wifi_psk" ]]; then # Update the psk in the network block - sed -i "/psk=/s/\".*\"/\"$wifi_psk\"/" "$wpa_supplicant_conf" - log_message "Updated Wi-Fi PSK in wpa_supplicant.conf." + wifi_command="$wifi_command -p \"$wifi_psk\"" + log_message "Updating Wi-Fi PSK in wpa_supplicant.conf to \`$wifi_psk\`." found_config="true" update_wifi="true" fi @@ -149,120 +137,99 @@ if [ -f "$mount_point/femtofox-config.txt" ]; then meshtastic_lora_radio=$(echo "$meshtastic_lora_radio" | tr '[:upper:]' '[:lower:]') case "$meshtastic_lora_radio" in 'ebyte-e22-900m30s') - cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d + radio="sx1262_tcxo" ;; 'ebyte-e22-900m22s') - cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d + radio="sx1262_tcxo" ;; 'heltec-ht-ra62') - cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d + radio="sx1262_tcxo" ;; 'seeed-wio-sx1262') - cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d + radio="sx1262_tcxo" ;; 'waveshare-sx126x-xxxm') - cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_XTAL.yaml /etc/meshtasticd/config.d + radio="sx1262_xtal" ;; 'ai-thinker-ra-01sh') - cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_XTAL.yaml /etc/meshtasticd/config.d + radio="sx1262_xtal" ;; 'ebyte-e80-900m22s') - #not yet implemented - cp /etc/meshtasticd/available.d/femtofox/femtofox_LR1121_TCXO.yaml /etc/meshtasticd/config.d + radio="lr1121_tcxo" # not yet implemented ;; 'sx1262_tcxo') - cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_TCXO.yaml /etc/meshtasticd/config.d + radio="sx1262_tcxo" ;; 'sx1262_xtal') - cp /etc/meshtasticd/available.d/femtofox/femtofox_SX1262_XTAL.yaml /etc/meshtasticd/config.d + radio="sx1262_xtal" ;; 'lr1121_tcxo') - #not yet implemented - cp /etc/meshtasticd/available.d/femtofox/femtofox_LR1121_TCXO.yaml /etc/meshtasticd/config.d + radio="lr1121_tcxo" # not yet implemented ;; 'none') + radio="none" ;; *) log_message "Invalid LoRa radio name: $meshtastic_lora_radio, ignoring." - found_config="false" ;; esac - if [ "$found_config" = "true" ]; then - systemctl restart meshtasticd + if [[ -n "$radio" ]]; then # if a radio was found + femto-meshtasticd-config.sh -l "$radio" -s 2>&1 | tee -a /tmp/femtofox-config.log # set the radio and restart the service log_message "Set LoRa radio to $meshtastic_lora_radio, restarting Meshtasticd." fi fi - if [[ -n "$timezone" ]]; then - #sed -i "/timezone=/s/\".*\"/\"$timezone\"/" "$wpa_supplicant_conf" + if [[ -n "$timezone" ]]; then # set timezone timezone=$(echo "$timezone" | sed 's/\\//g') log_message "Updating system timezone to $timezone." - rm /etc/localtime - ln -sf /usr/share/zoneinfo/$timezone /etc/localtime >> /tmp/femtofox-config.log 2>&1 + femto-set-timezone.sh -t "$timezone" found_config="true" fi - if [[ -n "$meshtastic_url" ]]; then - meshtastic_url=$(echo "$meshtastic_url" | sed 's/\\//g') + if [[ -n "$meshtastic_url" ]]; then # set meshtastic URL + meshtastic_url=$(echo "$meshtastic_url" | sed 's/\\//g') # remove weirdo windows characters log_message "Updating Meshtastic URL." found_config="true" - update_meshtastic_url="--seturl $meshtastic_url" fi if [[ -n "$meshtastic_admin_key" ]]; then - meshtastic_admin_key=$(echo "$meshtastic_admin_key" | sed 's/\\//g') + meshtastic_admin_key=$(echo "$meshtastic_admin_key" | sed 's/\\//g') # remove weirdo windows characters if [ "$meshtastic_admin_key" = "clear" ]; then log_message "Clearing Meshtastic admin key list." meshtastic_admin_key="0" else - meshtastic_admin_key="base64:$meshtastic_admin_key" + meshtastic_admin_key="$meshtastic_admin_key" log_message "Updating Meshtastic admin key." fi found_config="true" - update_meshtastic_security+=" --set security.admin_key $meshtastic_admin_key" + meshtastic_security_command+=" -a \"$meshtastic_admin_key\"" # add to the command list fi if [[ -n "$meshtastic_legacy_admin" ]]; then - meshtastic_legacy_admin=$(echo "$meshtastic_legacy_admin" | sed 's/\\//g') + meshtastic_legacy_admin=$(echo "$meshtastic_legacy_admin" | sed 's/\\//g') # remove weirdo windows characters log_message "Updating Meshtastic legacy admin." found_config="true" - update_meshtastic_security+=" --set security.admin_channel_enabled $meshtastic_legacy_admin" + meshtastic_security_command+=" -o \"$meshtastic_legacy_admin\"" # add to the command list fi if [ "$found_config" = true ]; then #if we found a config file containing valid data if [ "$update_wifi" = true ]; then #if wifi config found, restart wifi - systemctl restart wpa_supplicant 2>&1 | tee -a /tmp/femtofox-config.log - wpa_cli -i wlan0 reconfigure 2>&1 | tee -a /tmp/femtofox-config.log + log_message "Making changes to wifi settings and restarting wifi." + wifi_command="$wifi_command -r" + eval $wifi_command 2>&1 | tee -a /tmp/femtofox-config.log log_message "wpa_supplicant.conf updated and wifi restarted. Enabling Meshtastic wifi setting." - timeout 30s dhclient -v 2>&1 | tee -a /tmp/femtofox-config.log - - femto-meshtasticd-config.sh -m "--set network.wifi_enabled true" 10 "USB config" #| tee -a /tmp/femtofox-config.log - if [ $? -eq 1 ]; then - log_message "Update of Meshtastic FAILED." - else - log_message "Updated Meshtastic successfully." - fi fi - if [ "$update_meshtastic_url" != "" ]; then - log_message "Connecting to Meshtastic radio and submitting $update_meshtastic_url" - femto-meshtasticd-config.sh -m "$update_meshtastic_url" 10 "USB config" #| tee -a /tmp/femtofox-config.log - if [ $? -eq 1 ]; then - log_message "Update of Meshtastic FAILED." - else - log_message "Updated Meshtastic successfully." - fi + if [ "$meshtastic_url" != "" ]; then + log_message "Connecting to Meshtastic radio and submitting $meshtastic_url" + femto-meshtasticd-config.sh -q "$meshtastic_url" 2>&1 | tee -a /tmp/femtofox-config.log fi - if [ "$update_meshtastic_security" != "" ]; then - log_message "Connecting to Meshtastic radio and submitting $update_meshtastic_security" - femto-meshtasticd-config.sh -m "$update_meshtastic_security" 10 "USB config" #| tee -a /tmp/femtofox-config.log - if [ $? -eq 1 ]; then - log_message "Update of Meshtastic FAILED." - else - log_message "Updated Meshtastic successfully." - fi + if [ "$meshtastic_security_command" != "" ]; then + log_message "Connecting to Meshtastic radio and submitting $meshtastic_security_command + " + eval "$meshtastic_security_command" 2>&1 | tee -a /tmp/femtofox-config.log fi for _ in {1..10}; do #do our successful config boot code diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-wifi-config.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-wifi-config.sh new file mode 100644 index 0000000..fdb3322 --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-wifi-config.sh @@ -0,0 +1,81 @@ +#!/bin/bash +if [[ $EUID -ne 0 ]]; then + echo "This script must be run as root. Try \`sudo femto-wifi-config\`." + exit 1 +fi + +wpa_supplicant_conf="/etc/wpa_supplicant/wpa_supplicant.conf" +help=$(cat <