Skip to content

Commit

Permalink
wifi_schedule: fix startup problems
Browse files Browse the repository at this point in the history
Fixes: e0d7181
Closes: openwrt#22973
Closes: openwrt#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 <[email protected]>
  • Loading branch information
raenye authored and neheb committed Jan 3, 2024
1 parent ed5e796 commit 1e0d7fd
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 10 deletions.
4 changes: 2 additions & 2 deletions net/wifischedule/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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 <[email protected]>
Expand Down Expand Up @@ -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
Expand Down
18 changes: 10 additions & 8 deletions net/wifischedule/net/usr/bin/wifi_schedule.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
}

Expand Down

0 comments on commit 1e0d7fd

Please sign in to comment.