Android (& Chromebook)
This is a shell script that is used to automatically log in to a BT Wi-Fi network as a service on an OpenWrt device. The script is designed to start automatically when the device is powered on and run continuously in the background. It includes several functions that are used to start, stop, and manage the service, as well as a loop that checks for internet connectivity and logs in to the BT Wi-Fi network if necessary.
The script defines several variables that are used to configure the behavior of the service, including the ACCOUNTTYPE, USERNAME, and PASSWORD variables, which are used to specify the user's account type and login credentials. These variables are read from the /etc/rc.local file, which is a script that is executed when the device starts up.
The script includes several functions, including the start function, which is used to start the service, and the stop function, which is used to stop the service. The start function starts three loops in the background, including the btwifi_loop, which checks for internet connectivity and logs in to the BT Wi-Fi network if necessary, the cleanlog_loop, which limits the size of the log file, and the tls_loop, which installs the TLS (Transport Layer Security) certificate if it is not already installed on the device. The stop function kills the three loops and removes the PID files that are used to track the processes.
The script also includes several optional variables, such as the LOGSIZE, PING1, PING2, PING3, and LOGPATH variables, which are used to customize the behavior of the service. For example, the LOGSIZE variable is used to specify the maximum size of the log file, and the PING1, PING2, and PING3 variables are used to specify the websites to ping to check for internet connectivity.