
Changes since v1: - source directly instead of using "command -v" as much as possible, I couldn't get the sources in deviceprofile cases to return a proper exit code so they still use "command -v". - avoid leaving deviceprofile var set in interactive shells from sxmo_init.sh - small fixup to warning message if deviceprofile not found This allows Sxmo to drop an external dependency on which. Anjan's note: This is also faster due to being a shell built-in Signed-off-by: Jami Kettunen <jami.kettunen@protonmail.com> Signed-off-by: Anjandev Momi <anjan@momi.ca>
32 lines
397 B
Bash
Executable File
32 lines
397 B
Bash
Executable File
#!/bin/sh
|
|
# SPDX-License-Identifier: AGPL-3.0-only
|
|
# Copyright 2022 Sxmo Contributors
|
|
|
|
# Note: this script should be run as root via doas
|
|
|
|
# shellcheck source=scripts/core/sxmo_common.sh
|
|
. sxmo_common.sh
|
|
|
|
on() {
|
|
rfkill unblock wlan
|
|
}
|
|
|
|
off() {
|
|
rfkill block wlan
|
|
}
|
|
|
|
case "$1" in
|
|
on)
|
|
on
|
|
;;
|
|
off)
|
|
off
|
|
;;
|
|
*) #toggle
|
|
if rfkill list wifi | grep -q "yes"; then
|
|
on
|
|
else
|
|
off
|
|
fi
|
|
esac
|