2
0
mirror of https://github.com/koreader/koreader synced 2024-11-10 01:10:34 +00:00
koreader/platform/kobo/disable-wifi.sh
Frans de Jonge e8c01274f4 Travis: enforce shellscript coding style
* enormous coding style update

* update luajit-launcher

All changes are formatting only except for:

* new more correct pushd/popd style
	* keeps useful indentation
	* prevents execution of commands when pushd failed (cf. https://github.com/koalaman/shellcheck/wiki/SC2164 and https://github.com/koalaman/shellcheck/issues/863)

```
pushd some_dir && {
    command1
    command2
} || exit
popd
```
2017-04-11 15:30:23 +02:00

20 lines
454 B
Bash

#!/bin/sh
# Disable wifi, and remove all modules.
killall udhcpc default.script wpa_supplicant 2>/dev/null
wlarm_le -i eth0 down
ifconfig eth0 down
# Some sleep in between may avoid system getting hung
# (we test if a module is actually loaded to avoid unneeded sleeps)
if lsmod | grep -q "${WIFI_MODULE}"; then
usleep 200000
rmmod -r "${WIFI_MODULE}"
fi
if lsmod | grep -q sdio_wifi_pwr; then
usleep 200000
rmmod -r sdio_wifi_pwr
fi