summaryrefslogtreecommitdiff
path: root/net
diff options
context:
space:
mode:
authorRani Hod <rani.hod@gmail.com>2023-12-23 13:47:59 +0200
committerRosen Penev <rosenp@gmail.com>2024-01-03 08:47:39 -0800
commit1e0d7fd2ef29ce81d30ee61758325dc0a4b1aff8 (patch)
tree252acea1378c317c8ce896efd0fe859af87c7773 /net
parented5e79644dbf5668558f28c980b2f10c52e8bce4 (diff)
wifi_schedule: fix startup problems
Fixes: e0d7181a6 Closes: #22973 Closes: #22988 1. Make the new `startup()` function in `/usr/bin/wifi_schedule.sh` respect the global `enabled` config flag; in particular, make no changes to `/etc/config/wireless` when wifi_schedule is disabled. 2. Make the new `/etc/init.d/wifi_schedule` service script executable. Signed-off-by: Rani Hod <rani.hod@gmail.com>
Diffstat (limited to 'net')
-rw-r--r--net/wifischedule/Makefile4
-rwxr-xr-xnet/wifischedule/net/usr/bin/wifi_schedule.sh18
2 files changed, 12 insertions, 10 deletions
diff --git a/net/wifischedule/Makefile b/net/wifischedule/Makefile
index 98e748c4d..7dc28a9fb 100644
--- a/net/wifischedule/Makefile
+++ b/net/wifischedule/Makefile
@@ -16,7 +16,7 @@ include $(TOPDIR)/rules.mk
PKG_NAME:=wifischedule
PKG_VERSION:=1.0.5
-PKG_RELEASE:=1
+PKG_RELEASE:=2
PKG_LICENSE:=PRPL
PKG_MAINTAINER:=Nils Koenig <openwrt@newk.it>
@@ -54,7 +54,7 @@ define Package/wifischedule/install
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./net/etc/config/wifi_schedule $(1)/etc/config/wifi_schedule
$(INSTALL_DIR) $(1)/etc/init.d
- $(INSTALL_DATA) ./net/etc/init.d/wifi_schedule $(1)/etc/init.d/wifi_schedule
+ $(INSTALL_BIN) ./net/etc/init.d/wifi_schedule $(1)/etc/init.d/wifi_schedule
endef
define Package/wifischedule/postinst
diff --git a/net/wifischedule/net/usr/bin/wifi_schedule.sh b/net/wifischedule/net/usr/bin/wifi_schedule.sh
index 9787bc37d..9adadd212 100755
--- a/net/wifischedule/net/usr/bin/wifi_schedule.sh
+++ b/net/wifischedule/net/usr/bin/wifi_schedule.sh
@@ -277,14 +277,16 @@ _should_wifi_enabled()
startup()
{
_log "startup"
- local _enable_wifi=$(_should_wifi_enabled)
- if [[ ${_enable_wifi} -eq 0 ]]
- then
- _log "enable wifi"
- enable_wifi
- else
- _log "disable wifi"
- disable_wifi
+ local global_enabled=$(_get_uci_value ${GLOBAL}.enabled) || _exit 1
+ if [ ${global_enabled} -eq 1 ]; then
+ local _enable_wifi=$(_should_wifi_enabled)
+ if [ ${_enable_wifi} -eq 0 ]; then
+ _log "enable wifi"
+ enable_wifi
+ else
+ _log "disable wifi"
+ disable_wifi
+ fi
fi
}