Skip to content

Commit

Permalink
chore: add include libremesh.mk in more packages
Browse files Browse the repository at this point in the history
modify various packages to use libremesh.mk.
drop the package lua-argparse since it is available in openwrt feeds.
adapt packages to apk version schema.
  • Loading branch information
a-gave authored and ilario committed Nov 17, 2024
1 parent 7b0ea4b commit 9671aab
Show file tree
Hide file tree
Showing 75 changed files with 91 additions and 1,119 deletions.
29 changes: 9 additions & 20 deletions libremesh.mk
Original file line number Diff line number Diff line change
Expand Up @@ -2,26 +2,13 @@ include $(TOPDIR)/rules.mk

PKG_NAME?=$(notdir ${CURDIR})

# from https://github.com/openwrt/luci/blob/master/luci.mk
PKG_VERSION?=$(if $(DUMP),x,$(strip $(shell \
if svn info >/dev/null 2>/dev/null; then \
revision="svn-r$$(LC_ALL=C svn info | sed -ne 's/^Revision: //p')"; \
elif git log -1 >/dev/null 2>/dev/null; then \
revision="svn-r$$(LC_ALL=C git log -1 | sed -ne 's/.*git-svn-id: .*@\([0-9]\+\) .*/\1/p')"; \
if [ "$$revision" = "svn-r" ]; then \
set -- $$(git log -1 --format="%ct %h" --abbrev=7); \
secs="$$(($$1 % 86400))"; \
yday="$$(date --utc --date="@$$1" "+%y.%j")"; \
revision="$$(printf 'git-%s.%05d-%s' "$$yday" "$$secs" "$$2")"; \
fi; \
else \
revision="unknown"; \
fi; \
echo "$$revision" \
)))
PKG_RELEASE?=1

PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
GIT_COMMIT_DATE:=$(shell git log -n 1 --pretty=%ad --date=short . | sed 's|-|.|g')
GIT_COMMIT_TSTAMP:=$(shell git log -n 1 --pretty=%at . )

PKG_SRC_VERSION:=$(GIT_COMMIT_DATE)~$(GIT_COMMIT_TSTAMP)
PKG_VERSION:=$(if $(PKG_VERSION),$(PKG_VERSION),$(PKG_SRC_VERSION))

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

include $(INCLUDE_DIR)/package.mk

Expand All @@ -31,6 +18,8 @@ define Build/Compile
$(CP) ./files ./build
$(FIND) ./build -name '*.sh' -exec sed -i '/^\s*#\[Doc\]/d' {} +
$(FIND) ./build -name '*.lua' -exec sed -i '/^\s*--!.*/d' {} +
$(FIND) ./build -type f -executable -exec sed -i '/^\s*#\[Doc\]/d' {} +
$(FIND) ./build -type f -executable -exec sed -i '/^\s*--!.*/d' {} +
endef

define Package/$(PKG_NAME)/install
Expand Down
17 changes: 1 addition & 16 deletions packages/altermundi-grafana/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@
# This is free software, licensed under the GNU General Public License v3.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=altermundi-grafana
PKG_VERSION=$(GIT_COMMIT_DATE)-$(GIT_COMMIT_TSTAMP)
GIT_COMMIT_DATE:=$(shell git log -n 1 --pretty=%ad --date=short . )
GIT_COMMIT_TSTAMP:=$(shell git log -n 1 --pretty=%at . )

include $(INCLUDE_DIR)/package.mk
include ../../libremesh.mk

define Package/$(PKG_NAME)
SECTION:=utils
Expand All @@ -36,12 +29,4 @@ define Package/$(PKG_NAME)/description
that gathers data on the node and pushes to https://grafana.altermundi.net
endef

define Build/Compile
endef

define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/
$(CP) ./files/* $(1)/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
17 changes: 1 addition & 16 deletions packages/auto-usb-wwan/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,7 @@
# This is free software, licensed under the GNU General Public License v3.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=auto-usb-wwan
PKG_VERSION=$(GIT_COMMIT_DATE)-$(GIT_COMMIT_TSTAMP)
GIT_COMMIT_DATE:=$(shell git log -n 1 --pretty=%ad --date=short . )
GIT_COMMIT_TSTAMP:=$(shell git log -n 1 --pretty=%at . )

include $(INCLUDE_DIR)/package.mk
include ../../libremesh.mk

define Package/$(PKG_NAME)
SECTION:=utils
Expand All @@ -28,12 +21,4 @@ define Package/$(PKG_NAME)/description
By default, it will try connect to SSID "internet" with password "internet"
endef

define Build/Compile
endef

define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/
$(CP) ./files/* $(1)/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
24 changes: 1 addition & 23 deletions packages/bandwidth-test/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@
# This is free software, licensed under the GNU General Public License v3.
#

include $(TOPDIR)/rules.mk

GIT_COMMIT_DATE:=$(shell git log -n 1 --pretty=%ad --date=short . )
GIT_COMMIT_TSTAMP:=$(shell git log -n 1 --pretty=%at . )

PKG_NAME:=bandwidth-test
PKG_VERSION=$(GIT_COMMIT_DATE)-$(GIT_COMMIT_TSTAMP)

include $(INCLUDE_DIR)/package.mk
include ../../libremesh.mk

define Package/$(PKG_NAME)
SECTION:=utils
Expand All @@ -24,23 +16,9 @@ define Package/$(PKG_NAME)
PKGARCH:=all
endef

define Package/$(PKG_NAME)/config
endef


define Package/$(PKG_NAME)/description
Measure the maximum available bandwidth towards the internet, in the download direction.
Downloading a list of files via HTTP connections.
endef

define Build/Compile
endef

define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/bin/
$(INSTALL_DIR) $(1)/etc/config/
$(INSTALL_BIN) ./files/bin/bandwidth-test.lua $(1)/bin/bandwidth-test
$(INSTALL_CONF) ./files/etc/config/bandwidth-test $(1)/etc/config/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
File renamed without changes.
18 changes: 1 addition & 17 deletions packages/batman-adv-auto-gw-mode/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@
# This is free software, licensed under the GNU General Public License v3.
#

include $(TOPDIR)/rules.mk

GIT_COMMIT_DATE:=$(shell git log -n 1 --pretty=%ad --date=short . )
GIT_COMMIT_TSTAMP:=$(shell git log -n 1 --pretty=%at . )

PKG_NAME:=batman-adv-auto-gw-mode
PKG_VERSION=$(GIT_COMMIT_DATE)-$(GIT_COMMIT_TSTAMP)

include $(INCLUDE_DIR)/package.mk
include ../../libremesh.mk

define Package/$(PKG_NAME)
CATEGORY:=LibreMesh
Expand All @@ -38,12 +30,4 @@ port of any (one or more) nodes, it will be autodetected
and the rest of the nodes will route through it (or them)
endef

define Build/Compile
endef

define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/
$(CP) ./files/* $(1)/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
18 changes: 4 additions & 14 deletions packages/bmx7-auto-gw-bw-mode/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@
# This is free software, licensed under the GNU General Public License v3.
#

include $(TOPDIR)/rules.mk
include ../../libremesh.mk

PKG_NAME:=bmx7-auto-gw-bw-mode
PKG_VERSION=0.1

include $(INCLUDE_DIR)/package.mk
PKG_REALVERSION:=0.1
PKG_VERSION:=0.0.1
PKG_RELEASE:=1

define Package/$(PKG_NAME)
CATEGORY:=LibreMesh
Expand All @@ -26,17 +25,8 @@ define Package/$(PKG_NAME)/config
select CONFIG_BUSYBOX_CONFIG_CRONTAB
endef


define Package/$(PKG_NAME)/description
Watchping hooks to set bmx7 Internet bandwidth announcement
endef

define Build/Compile
endef

define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/
$(CP) ./files/* $(1)/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
20 changes: 2 additions & 18 deletions packages/bmx7-auto-gw-mode/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,35 +4,19 @@
# This is free software, licensed under the GNU General Public License v3.
#

include $(TOPDIR)/rules.mk

GIT_COMMIT_DATE:=$(shell git log -n 1 --pretty=%ad --date=short . )
GIT_COMMIT_TSTAMP:=$(shell git log -n 1 --pretty=%at . )

PKG_NAME:=bmx7-auto-gw-mode
PKG_VERSION=$(GIT_COMMIT_DATE)-$(GIT_COMMIT_TSTAMP)

include $(INCLUDE_DIR)/package.mk
include ../../libremesh.mk

define Package/$(PKG_NAME)
CATEGORY:=LibreMesh
TITLE:=bmx7 auto Internet gateway module
MAINTAINER:=Pau Escrich <p4u@dabax.et>
URL:=http://libremesh.org
DEPENDS:= bmx7 +watchping +ip
DEPENDS:=+bmx7 +watchping +ip
PKGARCH:=all
endef

define Package/$(PKG_NAME)/description
Watchping hooks to set bmx7 Internet automatic announcements
endef

define Build/Compile
endef

define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/
$(CP) ./files/* $(1)/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
34 changes: 4 additions & 30 deletions packages/bmx7-mdns/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,16 +21,12 @@
# Pau Escrich <p4u@dabax.net>
#

include $(TOPDIR)/rules.mk
include $(INCLUDE_DIR)/kernel.mk
include ../../libremesh.mk

PKG_NAME:=bmx7-mdns
PKG_VERSION:=0.1
PKG_REALVERSION:=0.1
PKG_VERSION:=0.0.1
PKG_RELEASE:=1
PKG_LICENSE:=GPL-2.0+
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)

include $(INCLUDE_DIR)/package.mk

define Package/$(PKG_NAME)
SECTION:=net
Expand All @@ -52,26 +48,4 @@ define Package/$(PKG_NAME)/description
Distributed DNS system using bmx7 sms plugin
endef

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

define Build/Configure
endef

define Build/Compile
endef

define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/
$(INSTALL_DIR) $(1)/etc
$(INSTALL_DIR) $(1)/etc/init.d
$(INSTALL_DIR) $(1)/etc/config
$(CP) ./files/etc/init.d/bmx7-mdns $(1)/etc/init.d/bmx7-mdns
chmod 755 $(1)/etc/init.d/bmx7-mdns
$(CP) ./files/etc/config/bmx7-mdns $(1)/etc/config/bmx7-mdns
$(INSTALL_DIR) $(1)/usr/lib/lua/luci/model/cbi/
$(CP) ./files/luci/bmx7-mdns.lua $(1)/usr/lib/lua/luci/model/cbi/bmx7-mdns.lua
endef

$(eval $(call BuildPackage,bmx7-mdns))
$(eval $(call BuildPackage,$(PKG_NAME)))
File renamed without changes.
18 changes: 1 addition & 17 deletions packages/check-date-http/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@
# This is free software, licensed under the GNU Affero General Public License v3.
#

include $(TOPDIR)/rules.mk

GIT_COMMIT_DATE:=$(shell git log -n 1 --pretty=%ad --date=short . )
GIT_COMMIT_TSTAMP:=$(shell git log -n 1 --pretty=%at . )

PKG_NAME:=check-date-http
PKG_VERSION=$(GIT_COMMIT_DATE)-$(GIT_COMMIT_TSTAMP)

include $(INCLUDE_DIR)/package.mk
include ../../libremesh.mk

define Package/$(PKG_NAME)
TITLE:=Keep local date under NTP too far away skew
Expand All @@ -30,12 +22,4 @@ define Package/$(PKG_NAME)/description
reset trought date command depending on configuration.
endef

define Build/Compile
endef

define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/
$(CP) ./files/* $(1)/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
18 changes: 1 addition & 17 deletions packages/check-internet/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@
# This is free software, licensed under the GNU Affero General Public License v3.
#

include $(TOPDIR)/rules.mk

GIT_COMMIT_DATE:=$(shell git log -n 1 --pretty=%ad --date=short . )
GIT_COMMIT_TSTAMP:=$(shell git log -n 1 --pretty=%at . )

PKG_NAME:=check-internet
PKG_VERSION=$(GIT_COMMIT_DATE)-$(GIT_COMMIT_TSTAMP)

include $(INCLUDE_DIR)/package.mk
include ../../libremesh.mk

define Package/$(PKG_NAME)
TITLE:=Check internet connection
Expand All @@ -27,12 +19,4 @@ define Package/$(PKG_NAME)/description
Simple script to verify that there is internet access.
endef

define Build/Compile
endef

define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/
$(CP) ./files/* $(1)/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
27 changes: 1 addition & 26 deletions packages/deferable-reboot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,7 @@
# This is free software, licensed under the GNU General Public License v3.
#

include $(TOPDIR)/rules.mk

GIT_COMMIT_DATE:=$(shell git log -n 1 --pretty=%ad --date=short . )
GIT_COMMIT_TSTAMP:=$(shell git log -n 1 --pretty=%at . )

PKG_NAME:=deferable-reboot
PKG_VERSION=$(GIT_COMMIT_DATE)-$(GIT_COMMIT_TSTAMP)

include $(INCLUDE_DIR)/package.mk
include ../../libremesh.mk

define Package/$(PKG_NAME)
SECTION:=utils
Expand All @@ -34,21 +26,4 @@ define Package/$(PKG_NAME)/description
awk '{print $1 + 120}' /proc/uptime > /tmp/deferable-reboot.defer
endef

define Build/Configure
endef

define Build/Compile
@rm -rf ./build || true
@mkdir ./build
$(CP) ./files ./build
$(FIND) ./build -name '*.sh' -exec sed -i '/^\s*#\[Doc\]/d' {} +
$(FIND) ./build -name '*.lua' -exec sed -i '/^\s*--!.*/d' {} +
endef


define Package/$(PKG_NAME)/install
$(INSTALL_DIR) $(1)/
$(CP) ./files/* $(1)/
endef

$(eval $(call BuildPackage,$(PKG_NAME)))
Loading

0 comments on commit 9671aab

Please sign in to comment.