diff --git a/package/gluon-alfred-ffmap/Makefile b/package/gluon-alfred-ffmap/Makefile new file mode 100644 index 00000000..cc3bbc3c --- /dev/null +++ b/package/gluon-alfred-ffmap/Makefile @@ -0,0 +1,32 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-alfred-ffmap +PKG_VERSION:=0.1 +PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-alfred-ffmap + SECTION:=gluon + CATEGORY:=Gluon + DEPENDS:=+gluon-alfred +gluon-location + TITLE:=Distribute data for ffmap via alfred +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-alfred-ffmap/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-alfred-ffmap)) diff --git a/package/gluon-alfred-ffmap/files/etc/alfred/ffmap.sh b/package/gluon-alfred-ffmap/files/etc/alfred/ffmap.sh new file mode 100755 index 00000000..a79addd1 --- /dev/null +++ b/package/gluon-alfred-ffmap/files/etc/alfred/ffmap.sh @@ -0,0 +1,21 @@ +#!/bin/sh + +if [ -f /lib/functions/jshn.sh ]; then + . /lib/functions/jshn.sh +elif [ -f /usr/share/libubox/jshn.sh ]; then + . /usr/share/libubox/jshn.sh +else + echo "Error: jshn.sh not found!" + exit 1 +fi + +[ -z "$ALFRED_DATA_TYPE" ] && ALFRED_DATA_TYPE=158 + +set -e + +json_init +json_add_string "name" "$(uci get 'system.@system[0].hostname')" +if [ "$(uci get 'system.@system[0].share_location')" = 1 ]; then + json_add_string "gps" "$(uci get 'system.@system[0].latitude') $(uci get 'system.@system[0].longitude')" +fi +json_dump | tr -d '\n' | alfred -s "$ALFRED_DATA_TYPE" diff --git a/package/gluon-alfred/Makefile b/package/gluon-alfred/Makefile new file mode 100644 index 00000000..c67d9208 --- /dev/null +++ b/package/gluon-alfred/Makefile @@ -0,0 +1,32 @@ +include $(TOPDIR)/rules.mk + +PKG_NAME:=gluon-alfred +PKG_VERSION:=0.1 +PKG_RELEASE:=1.$(GLUON_CONFIG_VERSION) + +PKG_BUILD_DIR := $(BUILD_DIR)/$(PKG_NAME) + +include $(INCLUDE_DIR)/package.mk + +define Package/gluon-alfred + SECTION:=gluon + CATEGORY:=Gluon + DEPENDS:=+alfred +gluon-cron + TITLE:=Configure alfred +endef + +define Build/Prepare + mkdir -p $(PKG_BUILD_DIR) +endef + +define Build/Configure +endef + +define Build/Compile +endef + +define Package/gluon-alfred/install + $(CP) ./files/* $(1)/ +endef + +$(eval $(call BuildPackage,gluon-alfred)) diff --git a/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred b/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred new file mode 100755 index 00000000..20ff5df4 --- /dev/null +++ b/package/gluon-alfred/files/lib/gluon/upgrade/alfred/invariant/010-enable-alfred @@ -0,0 +1,5 @@ +#!/bin/sh + +uci set alfred.alfred.interface=br-client +uci set alfred.alfred.mode=slave +uci delete alfred.alfred.disabled