[PATCH] packages/fff: Split fff-hoods into two packages
Adrian Schmutzler
freifunk at adrianschmutzler.de
Di Jan 30 23:50:15 CET 2018
Code which is reused by other functionalities is put into the
fff-hoodutils package, so it can be used without including
configurehood.
This also allows setting missing dependencies of other packages.
Signed-off-by: Adrian Schmutzler <freifunk at adrianschmutzler.de>
---
src/packages/fff/fff-hoods/Makefile | 4 +--
.../fff-hoods/files/lib/functions/fff/evalhoodinfo | 36 -------------------
.../fff-hoods/files/lib/functions/fff/keyxchange | 32 -----------------
src/packages/fff/fff-hoodutils/Makefile | 40 ++++++++++++++++++++++
.../files/lib/functions/fff/evalhoodinfo | 36 +++++++++++++++++++
.../files/lib/functions/fff/keyxchange | 32 +++++++++++++++++
src/packages/fff/fff-support/Makefile | 2 +-
src/packages/fff/fff-sysupgrade/Makefile | 2 +-
src/packages/fff/fff-web/Makefile | 2 +-
9 files changed, 113 insertions(+), 73 deletions(-)
delete mode 100644 src/packages/fff/fff-hoods/files/lib/functions/fff/evalhoodinfo
delete mode 100644 src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
create mode 100644 src/packages/fff/fff-hoodutils/Makefile
create mode 100644 src/packages/fff/fff-hoodutils/files/lib/functions/fff/evalhoodinfo
create mode 100644 src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange
diff --git a/src/packages/fff/fff-hoods/Makefile b/src/packages/fff/fff-hoods/Makefile
index 11ab6d1..f36d268 100644
--- a/src/packages/fff/fff-hoods/Makefile
+++ b/src/packages/fff/fff-hoods/Makefile
@@ -1,7 +1,7 @@
include $(TOPDIR)/rules.mk
PKG_NAME:=fff-hoods
-PKG_VERSION:=0.0.1
+PKG_VERSION:=2
PKG_RELEASE:=1
PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
@@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
CATEGORY:=Freifunk
TITLE:= Freifunk-Franken hoods
URL:=http://www.freifunk-franken.de
- DEPENDS:=+fff-network +fff-config
+ DEPENDS:=+fff-hoodutils
endef
define Package/$(PKG_NAME)/description
diff --git a/src/packages/fff/fff-hoods/files/lib/functions/fff/evalhoodinfo b/src/packages/fff/fff-hoods/files/lib/functions/fff/evalhoodinfo
deleted file mode 100644
index c487ea7..0000000
--- a/src/packages/fff/fff-hoods/files/lib/functions/fff/evalhoodinfo
+++ /dev/null
@@ -1,36 +0,0 @@
-#!/bin/sh
-# Copyright 2017 Adrian Schmutzler
-# License GPLv3
-
-. /lib/functions/fff/keyxchange
-
-jsonfile="$(getJsonPath)"
-if [ -n "$jsonfile" ] ; then
- json_load "$(cat "$jsonfile")"
- json_select hood
- json_get_var mesh_type2 mesh_type2
- json_get_var mesh_type5 mesh_type5
- json_get_var chan2ghz channel2
- json_get_var chan5ghz channel5
- json_get_var essid essid
-else
- mesh_type2="-"
- mesh_type5="-"
- chan2ghz="-"
- chan5ghz="-"
- essid="-"
-fi
-
-real_chan2ghz="--"
-real_chan5ghz="--"
-real_essid="-"
-if uci -q get wireless.w2ap > /dev/null ; then
- radio2="$(uci -q get wireless.w2ap.device)"
- real_chan2ghz="$(uci -q get "wireless.${radio2}.channel")"
- real_essid="$(uci -q get wireless.w2ap.ssid)"
-fi
-if uci -q get wireless.w5ap > /dev/null ; then
- radio5="$(uci -q get wireless.w5ap.device)"
- real_chan5ghz="$(uci -q get "wireless.${radio5}.channel")"
- real_essid="$(uci -q get wireless.w5ap.ssid)"
-fi
diff --git a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange b/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
deleted file mode 100644
index 30963ae..0000000
--- a/src/packages/fff/fff-hoods/files/lib/functions/fff/keyxchange
+++ /dev/null
@@ -1,32 +0,0 @@
-#!/bin/sh
-# Copyright 2017 Adrian Schmutzler
-# License GPLv3
-
-. /usr/share/libubox/jshn.sh
-
-hoodfile="/tmp/keyxchangev2data"
-hoodfilecopy="/www/hood/keyxchangev2data"
-
-getJsonPath() {
- jsonfile=""
- if [ -s "$hoodfilecopy" ] ; then
- jsonfile="$hoodfilecopy"
- elif [ -s "$hoodfile" ] ; then
- jsonfile="$hoodfile"
- fi
- echo "$jsonfile"
-}
-
-getUpgradePath() {
- jsonfile="$(getJsonPath)"
-
- if [ -n "$jsonfile" ] ; then
- json_load "$(cat "$jsonfile")"
- json_select hood
- json_get_var upath upgrade_path
- echo "$upath"
- else
- return 1
- fi
- return 0
-}
diff --git a/src/packages/fff/fff-hoodutils/Makefile b/src/packages/fff/fff-hoodutils/Makefile
new file mode 100644
index 0000000..f2ccf37
--- /dev/null
+++ b/src/packages/fff/fff-hoodutils/Makefile
@@ -0,0 +1,40 @@
+include $(TOPDIR)/rules.mk
+
+PKG_NAME:=fff-hoodutils
+PKG_VERSION:=1
+PKG_RELEASE:=1
+
+PKG_BUILD_DIR:=$(BUILD_DIR)/$(PKG_NAME)
+
+include $(INCLUDE_DIR)/package.mk
+
+define Package/$(PKG_NAME)
+ SECTION:=base
+ CATEGORY:=Freifunk
+ TITLE:= Freifunk-Franken hoodutils
+ URL:=http://www.freifunk-franken.de
+ DEPENDS:=+fff-network +fff-config
+endef
+
+define Package/$(PKG_NAME)/description
+ This package contains hood-related code that may
+ may be used outside of configurehood
+endef
+
+define Build/Prepare
+ echo "all: " > $(PKG_BUILD_DIR)/Makefile
+endef
+
+define Build/Configure
+ # nothing
+endef
+
+define Build/Compile
+ # nothing
+endef
+
+define Package/$(PKG_NAME)/install
+ $(CP) ./files/* $(1)/
+endef
+
+$(eval $(call BuildPackage,$(PKG_NAME)))
diff --git a/src/packages/fff/fff-hoodutils/files/lib/functions/fff/evalhoodinfo b/src/packages/fff/fff-hoodutils/files/lib/functions/fff/evalhoodinfo
new file mode 100644
index 0000000..c487ea7
--- /dev/null
+++ b/src/packages/fff/fff-hoodutils/files/lib/functions/fff/evalhoodinfo
@@ -0,0 +1,36 @@
+#!/bin/sh
+# Copyright 2017 Adrian Schmutzler
+# License GPLv3
+
+. /lib/functions/fff/keyxchange
+
+jsonfile="$(getJsonPath)"
+if [ -n "$jsonfile" ] ; then
+ json_load "$(cat "$jsonfile")"
+ json_select hood
+ json_get_var mesh_type2 mesh_type2
+ json_get_var mesh_type5 mesh_type5
+ json_get_var chan2ghz channel2
+ json_get_var chan5ghz channel5
+ json_get_var essid essid
+else
+ mesh_type2="-"
+ mesh_type5="-"
+ chan2ghz="-"
+ chan5ghz="-"
+ essid="-"
+fi
+
+real_chan2ghz="--"
+real_chan5ghz="--"
+real_essid="-"
+if uci -q get wireless.w2ap > /dev/null ; then
+ radio2="$(uci -q get wireless.w2ap.device)"
+ real_chan2ghz="$(uci -q get "wireless.${radio2}.channel")"
+ real_essid="$(uci -q get wireless.w2ap.ssid)"
+fi
+if uci -q get wireless.w5ap > /dev/null ; then
+ radio5="$(uci -q get wireless.w5ap.device)"
+ real_chan5ghz="$(uci -q get "wireless.${radio5}.channel")"
+ real_essid="$(uci -q get wireless.w5ap.ssid)"
+fi
diff --git a/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange b/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange
new file mode 100644
index 0000000..30963ae
--- /dev/null
+++ b/src/packages/fff/fff-hoodutils/files/lib/functions/fff/keyxchange
@@ -0,0 +1,32 @@
+#!/bin/sh
+# Copyright 2017 Adrian Schmutzler
+# License GPLv3
+
+. /usr/share/libubox/jshn.sh
+
+hoodfile="/tmp/keyxchangev2data"
+hoodfilecopy="/www/hood/keyxchangev2data"
+
+getJsonPath() {
+ jsonfile=""
+ if [ -s "$hoodfilecopy" ] ; then
+ jsonfile="$hoodfilecopy"
+ elif [ -s "$hoodfile" ] ; then
+ jsonfile="$hoodfile"
+ fi
+ echo "$jsonfile"
+}
+
+getUpgradePath() {
+ jsonfile="$(getJsonPath)"
+
+ if [ -n "$jsonfile" ] ; then
+ json_load "$(cat "$jsonfile")"
+ json_select hood
+ json_get_var upath upgrade_path
+ echo "$upath"
+ else
+ return 1
+ fi
+ return 0
+}
diff --git a/src/packages/fff/fff-support/Makefile b/src/packages/fff/fff-support/Makefile
index 9fd2d2b..098bbb3 100644
--- a/src/packages/fff/fff-support/Makefile
+++ b/src/packages/fff/fff-support/Makefile
@@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
CATEGORY:=Freifunk
TITLE:=Freifunk-Franken Support Scripts
URL:=http://www.freifunk-franken.de
- DEPENDS:=+ at BUSYBOX_CONFIG_ASH +fff-config
+ DEPENDS:=+ at BUSYBOX_CONFIG_ASH +fff-config +fff-hoodutils
endef
define Package/$(PKG_NAME)/description
diff --git a/src/packages/fff/fff-sysupgrade/Makefile b/src/packages/fff/fff-sysupgrade/Makefile
index 6daf0bc..0be55ab 100644
--- a/src/packages/fff/fff-sysupgrade/Makefile
+++ b/src/packages/fff/fff-sysupgrade/Makefile
@@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
CATEGORY:=Freifunk
TITLE:=Freifunk-Franken sysupgrade
URL:=http://www.freifunk-franken.de
- DEPENDS:=+fff-boardname +fff-config +fff-hoods + at BUSYBOX_CONFIG_WGET
+ DEPENDS:=+fff-boardname +fff-config +fff-hoodutils + at BUSYBOX_CONFIG_WGET
endef
define Package/$(PKG_NAME)/description
diff --git a/src/packages/fff/fff-web/Makefile b/src/packages/fff/fff-web/Makefile
index c885218..308031d 100644
--- a/src/packages/fff/fff-web/Makefile
+++ b/src/packages/fff/fff-web/Makefile
@@ -13,7 +13,7 @@ define Package/$(PKG_NAME)
CATEGORY:=Freifunk
TITLE:= Freifunk-Franken Webinterface
URL:=http://www.freifunk-franken.de
- DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +simple-tc +fff-boardname +fff-config +fff-network
+ DEPENDS:=+uhttpd +libustream-mbedtls +haserl +px5g +simple-tc +fff-boardname +fff-config +fff-network +fff-hoodutils
endef
define Package/$(PKG_NAME)/description
--
2.7.4
Mehr Informationen über die Mailingliste franken-dev