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 4487bd7..b03459c 100755 --- a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-config @@ -16,14 +16,7 @@ pause() { read -n 1 -s -r } - - -#│ ^[[0;30m Black^[[0m ^[[0;31m Red^[[0m ^[[0;32m │ -#│ Green^[[0m ^[[0;33m Yellow^[[0m ^[[0;34m Blue^[[0m │ -#│ ^[[0;35m Magenta^[[0m ^[[0;36m Cyan^[[0m ^[[0;37m │ -#│ White^[[0m ^[[4m Underlined^[[0m ^[[7m Inverted^[[0m - - +# Dialog uses a different method to display colors, and is limited to only these 8. replace_colors() { input="$1" input="${input//$(echo -e '\033[0;30m')/\\Z0}" # black @@ -168,13 +161,13 @@ femto_pinouts() { } # Function to handle misc settings -misc_settings() { - local title="Misc Settings" +utilities() { + local title="Utilities" while true; do local option="" - option=$(dialog --cancel-label "Back" --menu "Misc Settings" 15 40 4 \ + option=$(dialog --cancel-label "Back" --menu "$title" 15 40 4 \ 1 "Set system timezone" \ - 2 "Ham radio support" \ + 2 "Kernel modules" \ 3 "Re-run first-boot script" \ 4 "Run OEM luckfox-config" \ "" "" \ @@ -190,45 +183,8 @@ misc_settings() { femto-set-timezone.sh ;; 2) # the contents of this should probably moved to a script) - dialog --title "$title" --msgbox "Amateur radio support can be added in kernel for:\n\n\ -Amateur Radio AX.25 Level 2 protocol\n\ -AX.25 DAMA Slave support\n\ -Amateur Radio NET/ROM protocol\n\ -Amateur Radio X.25 PLP (Rose)\n\ -Serial port KISS driver\n\ -Serial port 6PACK driver\n\ -BPQ Ethernet driver\n\ -BAYCOM ser12 fullduplex driver for AX.25\n\ -BAYCOM ser12 halfduplex driver for AX.25\n\ -YAM driver for AX.25\n\ -AM/FM Radio receivers/transmitters\n\ -Software defined radio (SDR)\n\ -Maxim 2175 RF to Bits tuner\n\ -Silicon Labs Si470x FM Radio Receiver support\n\ -Silicon Labs Si470x FM Radio Receiver support with USB\n\ -Silicon Labs Si470x FM Radio Receiver support with I2C\n\ -Silicon Labs Si4713 FM Radio with RDS Transmitter support\n\ -Silicon Labs Si4713 FM Radio Transmitter support with USB\n\ -Silicon Labs Si4713 FM Radio Transmitter support with I2C\n\ -Silicon Labs Si4713 FM Radio Transmitter support\n\ -AverMedia MR 800 USB FM radio support\n\ -D-Link/GemTek USB FM radio support\n\ -Guillemot MAXI Radio FM 2000 radio\n\ -Griffin radioSHARK USB radio receiver\n\ -Griffin radioSHARK2 USB radio receiver\n\ -Keene FM Transmitter USB support\n\ -Thanko's Raremono AM/FM/SW radio support\n\ -Masterkit MA901 USB FM radio support\n\ -TEA5764 I2C FM radio support\n\ -SAA7706H Car Radio DSP\n\ -TEF6862 Car Radio Enhanced Selectivity Tuner\n\ -Texas Instruments WL1273 I2C FM Radio\n\ -Renesas Digital Radio Interface (DRIF)" 20 65 - dialog --title "$title" --msgbox "To add support, kernel modules for all these will be copied to \`/lib/modules/5.10.160/\`,\ -then \`depmod\` will be run. To remove support, those modules will be deleted.\n\nAfter installation, many redundant network interfaces will appear." 11 40 - #add code to choose add or remove - cp /oem/usr/ko/ham/* /lib/modules/5.10.160/ - depmod -a 5.10.160 + dialog --title "$title" --msgbox "Kernel modules are loadable pieces of code that extend a Linux kernel's functionality without requiring a reboot. Common examples include device drivers, file systems, or system calls.\n\nThis tool will allow you to add pre-compiled modules to the Foxbuntu kernel.\n\nModules currently autostarting at boot:\n$(sed -n '6,$p' /etc/modules | sed ':a;N;$!ba;s/\n/, /g;s/, $//')" 16 65 + femto-kernel-modules.sh ;; 3) femto-runonce.sh @@ -522,8 +478,8 @@ while true; do 1 "Settings wizard" \ 2 "Networking" \ 3 "Meshtasticd" \ - 4 "Misc" \ - 5 "Software" \ + 4 "Software" \ + 5 "Utilities" \ 6 "Help" \ "" "" \ 7 "Exit" 3>&1 1>&2 2>&3) @@ -538,9 +494,11 @@ while true; do 1) femto-install-wizard.sh ;; 2) networking_settings ;; 3) meshtasticd_settings ;; - 4) misc_settings ;; - 5) femto-software-menu.sh ;; + 4) femto-software-menu.sh ;; + 5) utilities ;; 6) help_menu ;; 7) break ;; esac -done \ No newline at end of file +done + +exit 0 \ No newline at end of file diff --git a/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh new file mode 100644 index 0000000..4069523 --- /dev/null +++ b/foxbuntu/sysdrv/out/rootfs_uclibc_rv1106/usr/local/bin/femto-kernel-modules.sh @@ -0,0 +1,91 @@ +#!/bin/bash + +help=$(cat <> /etc/modules + fi + echo "$1 has been enabled and will be started at boot." + else + exit 1 + fi + elif [ $2 = "disable" ]; then + rmmod $1 # Disable the module + if [ $? -eq 0 ]; then + sed -i "/^$1$/d" /etc/modules + echo "$1 has been disabled and removed from boot." + else + exit 1 + fi + else + echo "Invalid argument \"$2\".\n$help" + fi +} + +# Parse options +while getopts ":hx" opt; do + case ${opt} in + h) # Option -l (set lora radio) + echo "$help" + exit 0 + ;; + x) # Option -x (Set kernel module status (enable/disable)) + echo "$(module_switch $2 $3)" + ;; + esac +done +if [ -n "$1" ]; then # if there are arguments, don't proceed to menu + exit +fi + +dialog --infobox "Loading kernel module menu..." 5 45 + +modules=() + +# Create a list of modules (filename minus the .ko) +for module in $(ls "/lib/modules/5.10.160"/*.ko); do + module_name=$(basename "$module" .ko) + modules+=("$module_name" "$(modinfo $module_name | grep -i 'description' | cut -d: -f2 | sed 's/^[ \t]*//')") +done + +while true; do + # Create the menu options + option=$(dialog --cancel-label "Back" --title "Kernel Modules" --menu "" 42 103 8 "${modules[@]}" 3>&1 1>&2 2>&3) + + exit_status=$? # Check 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 + break + fi + + # Get the module name from the selection + selected_module=$option + + # Get the full modinfo for the module and process it for dialog + modinfo_output=$(modinfo $selected_module | sed ':a;N;$!ba;s/\n/\\n/g') # add \n to module info + + # Check if the module is currently enabled + if lsmod | grep -q "^$selected_module "; then + dialog --colors --title "Disable Module" --yesno "The module '$selected_module' is currently \Z2\Zuenabled\Zn.\n\nDo you want to disable it?\n\nFull module info:\n$modinfo_output\n\nNote: Unused dependencies will be removed automatically." 25 0 + if [ $? -eq 0 ]; then + dialog --msgbox "$(module_switch $selected_module disable)" 7 60 + fi + else + dialog --colors --title "Enable Module" --yesno "The module '$selected_module' is currently \Z1disabled\Zn.\n\nDo you want to enable it?\n\nFull module info:\n$modinfo_output\n\nNote: Dependencies will be loaded automatically." 25 0 + if [ $? -eq 0 ]; then + dialog --msgbox "$(module_switch $selected_module enable)" 7 60 + fi + fi +done + +exit 0 \ No newline at end of file