|
On the raspberry I was able to set the parameters to get on my wifi network on the first boot. Could not find how to this on orange anywhere, so I made this script. Comments in the script show how to install and setup. I'm using the orangepi zero 3, with July 2023 orangepi os. Might work on other devices?- #!/usr/bin/bash
- # script to setup wifi prior to booting
- # I use to not need to connect to ethernet
- # to configure the wifi connection after
- # the initial install of orangepi os
- # on the sd card.
- # Tested on orange pi zero 3 with
- # orangepi os dated July 2023
- # run this script from /etc/rc.local
- # I save the script as
- # /home/orangepi/scripts/wifi.sh
- # /etc/rc.local then needs this line -
- # /home/orangepi/scripts/wifi.sh
- # the last line of rc.local must be-
- # exit 0
- # create the following files
- # /boot/ssid and /boot/password
- # with one line only, containing
- # what their filenames say
- # script starts here
- # test for the files
- if [ -f /boot/ssid ]
- then
- if [ -f /boot/password ]
- then
- # wait 10 secs for the board to complete bootup
- # may not be necessary
- sleep 10
- ssid=`cat /boot/ssid`
- password=`cat /boot/password`
- #echo $ssid
- #echo $password
- # force scan befor connect
- nmcli device wifi list > /dev/null
- # wait a little and then connect!!
- sleep 5
- nmcli device wifi connect $ssid password $password
- # network manager should keep activating
- # the same wifi when rebooted. So remove these files.
- # They can be recreated if needed
- # If commented out the files will persist and the orangepi
- # will connect to the listed network on each reboot
- # regardless if the network was switched
- rm /boot/ssid
- rm /boot/password
- # close the ifs
- fi
- fi
Copy code |
|