Skip to content

Commit

Permalink
improve Makefiles
Browse files Browse the repository at this point in the history
* use autoupdate.lock file instead of pgrep
* use BuildPackageGluon
* specify correct License for tecff packages
  • Loading branch information
maurerle committed Aug 29, 2024
1 parent c2b9801 commit b74a600
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 55 deletions.
4 changes: 1 addition & 3 deletions ffac-mt7915-reload/Makefile
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# SPDX-FileCopyrightText: 2024 Felix Baumann (FFAC)
# SPDX-FileCopyrightText: 2024 Felix Baumann, Florian Maurer (FFAC)
# SPDX-License-Identifier: MIT
include $(TOPDIR)/rules.mk

Expand All @@ -8,8 +8,6 @@ PKG_RELEASE:=1

PKG_LICENSE:=MIT

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

include $(TOPDIR)/../package/gluon.mk

define Package/$(PKG_NAME)
Expand Down
14 changes: 1 addition & 13 deletions ffac-threetime-reboot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,6 @@ PKG_RELEASE:=1

PKG_LICENSE:=BSD-2-Clause

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)

include $(TOPDIR)/../package/gluon.mk

define Package/$(PKG_NAME)
Expand All @@ -19,19 +17,9 @@ define Package/$(PKG_NAME)
DEPENDS:=+gluon-core +micrond
endef

define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef

define Build/Configure
endef

define Build/Compile
endef

define Package/$(PKG_NAME)/install
$(CP) ./files/* $(1)/
./gluonShellDiet.sh $(1)/lib/gluon/threetime-reboot/threetime-reboot.sh
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
$(eval $(call BuildPackageGluon,$(PKG_NAME)))
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
logger -s -t "ffac-threetime-reboot" -p 5 "scheduled reboot in 5 seconds"
sleep 5
# Autoupdate?
upgrade_started='/tmp/autoupdate.lock'
if [ -f $upgrade_started ] ; then
if [ -f '/tmp/autoupdate.lock' ] ; then
logger -s -t "ffac-threetime-reboot" -p 5 "Autoupdate running! Aborting"
exit 2
fi
Expand Down
20 changes: 4 additions & 16 deletions tecff-broken-wlan-workaround/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# SPDX-FileCopyrightText: 2024 Freifunk Alsdorf, Florian Maurer (FFAC)
# SPDX-License-Identifier: GPL-3.0-or-later
include $(TOPDIR)/rules.mk

PKG_NAME:=tecff-broken-wlan-workaround
PKG_VERSION:=4
PKG_RELEASE:=0

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_LICENSE:=GPL-3.0-or-later

include $(INCLUDE_DIR)/package.mk

Expand All @@ -15,18 +17,4 @@ define Package/tecff-broken-wlan-workaround
DEPENDS:=+gluon-core +gluon-state-check +micrond +tecff-general-workaround
endef

define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef

define Build/Configure
endef

define Build/Compile
endef

define Package/tecff-broken-wlan-workaround/install
$(CP) ./files/* $(1)/
endef

$(eval $(call BuildPackage,tecff-broken-wlan-workaround))
$(eval $(call BuildPackageGluon,tecff-broken-wlan-workaround))
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,7 @@ if [ ! -d /sys/class/ieee80211 ] || [ "$(ls -l /sys/class/ieee80211/ | wc -l)" -
fi

# don't do anything while an autoupdater process is running
pgrep autoupdater >/dev/null
if [ "$?" == "0" ]; then
if [ -f '/tmp/autoupdate.lock' ] ; then
logger -s -t "$SCRIPTNAME" -p 5 "autoupdater is running, aborting."
exit
fi
Expand Down Expand Up @@ -75,7 +74,7 @@ RESTARTINFOFILE="/tmp/wlan-last-restart-marker-file"
WLANMESHCONNECTIONS=0
for wlan_interface in $WLAN_INTERFACES; do
if expr "$wlan_interface" : "mesh[0-9]" >/dev/null; then
if [ "$(batctl o | egrep "$wlan_interface" | wc -l)" -gt 0 ]; then
if [ "$(batctl o | grep -cE "$wlan_interface")" -gt 0 ]; then
WLANMESHCONNECTIONS=1
$($DEBUG) && logger -s -t "$SCRIPTNAME" -p 5 "found wlan mesh partners."
if [ ! -f "$MESHFILE" ]; then
Expand All @@ -89,7 +88,7 @@ done

# check if there are local wlan batman clients
WLANFFCONNECTIONS=0
WLANFFCONNECTIONCOUNT="$(batctl tl | grep W | wc -l)"
WLANFFCONNECTIONCOUNT="$(batctl tl | grep -c W)"
if [ "$WLANFFCONNECTIONCOUNT" -gt 0 ]; then
# note: this check doesn't know which radio the clients are on
WLANFFCONNECTIONS=1
Expand All @@ -105,7 +104,7 @@ WLANPRIVCONNECTIONS=0
for wlan_interface in $WLAN_INTERFACES; do
if expr "$wlan_interface" : "wlan[0-9]" >/dev/null; then
iw dev $wlan_interface station dump 2>/dev/null | grep -q Station
if [ "$?" == "0" ]; then
if [ "$?" = "0" ]; then
WLANPRIVCONNECTIONS=1
$($DEBUG) && logger -s -t "$SCRIPTNAME" -p 5 "found private wlan clients."
if [ ! -f "$PRIVCLIENTFILE" ]; then
Expand Down
20 changes: 4 additions & 16 deletions tecff-general-workaround/Makefile
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# SPDX-FileCopyrightText: 2024 Freifunk Alsdorf, Florian Maurer (FFAC)
# SPDX-License-Identifier: GPL-3.0-or-later
include $(TOPDIR)/rules.mk

PKG_NAME:=tecff-general-workaround
PKG_VERSION:=1
PKG_RELEASE:=1

PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME)
PKG_LICENSE:=GPL-3.0-or-later

include $(INCLUDE_DIR)/package.mk

Expand All @@ -15,18 +17,4 @@ define Package/tecff-general-workaround
DEPENDS:=+gluon-core +gluon-state-check +micrond
endef

define Build/Prepare
mkdir -p $(PKG_BUILD_DIR)
endef

define Build/Configure
endef

define Build/Compile
endef

define Package/tecff-general-workaround/install
$(CP) ./files/* $(1)/
endef

$(eval $(call BuildPackage,tecff-general-workaround))
$(eval $(call BuildPackageGluon,tecff-general-workaround))

0 comments on commit b74a600

Please sign in to comment.