0
0
mirror of https://github.com/openwrt/packages.git synced 2025-02-07 04:39:51 +00:00
Jan Chren ~rindeal fa9a6f7cd2 wifischedule: completely overhaul the script
Squashed using these commits:

 - wifischedule: use `service` instead of direct path
 - wifischedule: use `sort -u` instead of `uniq`
 - wifischedule: restart cron only at the end of batch instead of after every change
 - wifischedule: remove `[[` bash-isms
 - wifischedule: trim trailing ws
 - wifischedule: reduce `if` blocks
 - wifischedule: quote variables and remove some more bash-isms
 - wifischedule: simplify _get_uci_value`
 - wifischedule: don't exit whole script just because `uci get somekey` fails somewhere
 - wifischedule: revamp `_should_enable_wifi()`
 - wifischedule: revamp `_format_daysofweek_list()`
 - wifischedule: revamp `_enable_wifi_schedule()`
 - wifischedule: minor refactoring
 - wifischedule: mega revamp
 - wifischedule: fixes
 - wifischedule: touch-ups
 - wifischedule: use only `awk` in `_cfg_list_entries()` to filter `uci`
 - wifischedule: improve code docs
 - wifischedule: inline `_crontab_format_dow_field()`
 - wifischedule: refactor `_crontab_append_line()`
 - wifischedule: add `_uci_bool()` and refactor `_arith_bool()`
 - wifischedule: rename some functions
 - wifischedule: refactor using shellcheck
 - wifischedule: refactor `_wifi_get_interfaces()`
 - wifischedule: refactor `_wifi_get_devices()`
 - wifischedule: shellcheck fixes
 - wifischedule: use logger instead of a logfile
 - wifischedule: refactor global consts
 - wifischedule: introduce main() func
 - wifischedule: bump version

Signed-off-by: Jan Chren ~rindeal <dev.rindeal@gmail.com>
2024-07-05 13:43:57 -07:00

71 lines
2.0 KiB
Makefile

# Copyright (c) 2016, prpl Foundation
#
# Permission to use, copy, modify, and/or distribute this software for any purpose with or without
# fee is hereby granted, provided that the above copyright notice and this permission notice appear
# in all copies.
#
# THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE
# INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE
# FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM
# LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION,
# ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
#
# Author: Nils Koenig <openwrt@newk.it>
include $(TOPDIR)/rules.mk
PKG_NAME:=wifischedule
PKG_VERSION:=1.1.0
PKG_RELEASE:=0
PKG_LICENSE:=PRPL
PKG_MAINTAINER:=Nils Koenig <openwrt@newk.it>
include $(INCLUDE_DIR)/package.mk
define Package/wifischedule
SUBMENU:=Wireless
TITLE:=Turns WiFi on and off according to a schedule
SECTION:=net
CATEGORY:=Network
PKGARCH:=all
endef
define Package/wifischedule/description
Turns WiFi on and off according to a schedule defined in UCI.
endef
define Package/wifischedule/conffiles
/etc/config/wifi_schedule
endef
define Build/Prepare
endef
define Build/Configure
endef
define Build/Compile
endef
define Package/wifischedule/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) ./net/usr/bin/wifi_schedule.sh $(1)/usr/bin/wifi_schedule.sh
$(INSTALL_DIR) $(1)/etc/config
$(INSTALL_DATA) ./net/etc/config/wifi_schedule $(1)/etc/config/wifi_schedule
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_BIN) ./net/etc/init.d/wifi_schedule $(1)/etc/init.d/wifi_schedule
endef
define Package/wifischedule/postinst
#!/bin/sh
# check if we are on real system
if [ -z "$${IPKG_INSTROOT}" ]; then
echo "Enabling rc.d symlink for wifischedule"
/etc/init.d/wifi_schedule enable
fi
exit 0
endef
$(eval $(call BuildPackage,wifischedule))