mirror of
https://github.com/freifunk-gluon/packages.git
synced 2024-06-17 04:33:59 +02:00
Merge 71bf3aba58
into 10d163697b
This commit is contained in:
commit
2be73f064c
32
gluon/gluon-alfred-ffmap/Makefile
Normal file
32
gluon/gluon-alfred-ffmap/Makefile
Normal file
|
@ -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))
|
21
gluon/gluon-alfred-ffmap/files/etc/alfred/ffmap.sh
Executable file
21
gluon/gluon-alfred-ffmap/files/etc/alfred/ffmap.sh
Executable file
|
@ -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"
|
32
gluon/gluon-alfred/Makefile
Normal file
32
gluon/gluon-alfred/Makefile
Normal file
|
@ -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))
|
|
@ -0,0 +1,5 @@
|
||||||
|
#!/bin/sh
|
||||||
|
|
||||||
|
uci set alfred.alfred.interface=br-client
|
||||||
|
uci set alfred.alfred.mode=slave
|
||||||
|
uci delete alfred.alfred.disabled
|
|
@ -1,5 +1,8 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# abort on error
|
||||||
|
set -e
|
||||||
|
|
||||||
if test $(uci get autoupdater.settings.enabled) != 1; then
|
if test $(uci get autoupdater.settings.enabled) != 1; then
|
||||||
echo "autoupdater is disabled"
|
echo "autoupdater is disabled"
|
||||||
exit 0
|
exit 0
|
||||||
|
@ -10,15 +13,15 @@ BRANCH=$(uci get autoupdater.settings.branch)
|
||||||
PROBABILITY=$(uci get autoupdater.${BRANCH}.probability)
|
PROBABILITY=$(uci get autoupdater.${BRANCH}.probability)
|
||||||
|
|
||||||
if test "a$1" != "a-f"; then
|
if test "a$1" != "a-f"; then
|
||||||
echo | awk "END{srand();exit rand() > $PROBABILITY}"
|
if ! echo | awk "END{srand();exit rand() > $PROBABILITY}"; then
|
||||||
if test $? -ne 0; then
|
|
||||||
echo "No autoupdate this time. Use -f to override"
|
echo "No autoupdate this time. Use -f to override"
|
||||||
exit 0
|
exit 0
|
||||||
fi
|
fi
|
||||||
fi
|
fi
|
||||||
|
|
||||||
BASE=$(uci get autoupdater.${BRANCH}.url)
|
BASE=$(uci get autoupdater.${BRANCH}.url)
|
||||||
PUBKEYS=$(uci get autoupdater.${BRANCH}.pubkey)
|
# if no signatures are needed, no pubkeys need to be defined, so don't fail
|
||||||
|
PUBKEYS=$(uci get autoupdater.${BRANCH}.pubkey) || true
|
||||||
GOOD_SIGNATURES=$(uci get autoupdater.${BRANCH}.good_signatures)
|
GOOD_SIGNATURES=$(uci get autoupdater.${BRANCH}.good_signatures)
|
||||||
|
|
||||||
VERSION_FILE=/lib/gluon/release
|
VERSION_FILE=/lib/gluon/release
|
||||||
|
@ -29,15 +32,22 @@ newer_than() {
|
||||||
}
|
}
|
||||||
|
|
||||||
cleanup() {
|
cleanup() {
|
||||||
rm -f $manifest
|
[ -f "$manifest" ] && rm -f "$manifest"
|
||||||
rm -f $fw_image
|
[ -f "$fw_image" ] && rm -f "$fw_image"
|
||||||
rm -f $manifest_upper
|
[ -f "$manifest_upper" ] && rm -f "$manifest_upper"
|
||||||
rm -f $manifest_lower
|
[ -f "$manifest_lower" ] && rm -f "$manifest_lower"
|
||||||
|
}
|
||||||
|
|
||||||
|
fail() {
|
||||||
|
echo "$@" >&2
|
||||||
|
exit 1
|
||||||
}
|
}
|
||||||
|
|
||||||
trap cleanup INT TERM EXIT PIPE
|
trap cleanup INT TERM EXIT PIPE
|
||||||
|
|
||||||
my_model="$(cat /tmp/sysinfo/model | sed 's/ /-/g' | tr '[A-Z]' '[a-z]')"
|
. /lib/ar71xx.sh
|
||||||
|
|
||||||
|
my_model="$(ar71xx_board_name)"
|
||||||
|
|
||||||
case "$my_model" in
|
case "$my_model" in
|
||||||
"tl-wdr4300")
|
"tl-wdr4300")
|
||||||
|
@ -49,10 +59,7 @@ case "$my_model" in
|
||||||
;;
|
;;
|
||||||
esac
|
esac
|
||||||
|
|
||||||
if [ ! -f "$VERSION_FILE" ]; then
|
[ -f "$VERSION_FILE" ] || fail "Couldn't determine firmware version!"
|
||||||
echo "Couldn't determine firmware version!" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
my_version="$(cat "$VERSION_FILE")"
|
my_version="$(cat "$VERSION_FILE")"
|
||||||
|
|
||||||
|
@ -61,22 +68,9 @@ manifest=$(mktemp)
|
||||||
manifest_upper=$(mktemp)
|
manifest_upper=$(mktemp)
|
||||||
manifest_lower=$(mktemp)
|
manifest_lower=$(mktemp)
|
||||||
|
|
||||||
wget -O$manifest "$BASE"/manifest
|
wget -O$manifest "$BASE"/manifest || fail "Couldn't fetch manifest"
|
||||||
|
|
||||||
if test $? -ne 0; then
|
awk 'BEGIN { sep=0 } /^---$/ { sep=1; next } { if(sep==0) print; else print > "'$manifest_lower'" }' $manifest > $manifest_upper
|
||||||
echo "Couldn't fetch manifest" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
seperator_line=$(cat $manifest|grep -n "^---$"|cut -d: -f1|head -n1)
|
|
||||||
|
|
||||||
if test -z "$seperator_line"; then
|
|
||||||
echo "Couldn't find --- marker!" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
head -n$(($seperator_line-1)) $manifest > $manifest_upper
|
|
||||||
tail -n+$(($seperator_line+1)) $manifest > $manifest_lower
|
|
||||||
|
|
||||||
signatures=""
|
signatures=""
|
||||||
while read sig; do
|
while read sig; do
|
||||||
|
@ -92,26 +86,12 @@ for key in $PUBKEYS; do
|
||||||
pubkeys="$pubkeys -p $key"
|
pubkeys="$pubkeys -p $key"
|
||||||
done
|
done
|
||||||
|
|
||||||
ecdsaverify -n $GOOD_SIGNATURES $pubkeys $signatures $manifest_upper
|
ecdsaverify -n $GOOD_SIGNATURES $pubkeys $signatures $manifest_upper || \
|
||||||
|
fail "Not enough valid signatures!"
|
||||||
|
|
||||||
if test $? -ne 0; then
|
grep -q "^BRANCH=${BRANCH}$" $manifest_upper || fail "Wrong branch. We'are on ${BRANCH}"
|
||||||
echo "Not enough valid signatures!" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
grep -q "^BRANCH=${BRANCH}$" $manifest_upper
|
my_firmware=$(grep "^${my_model} " $manifest_upper) || fail "No matching firmware found (model ${my_model})"
|
||||||
|
|
||||||
if test $? -ne 0; then
|
|
||||||
echo "Wrong branch. We'are on ${BRANCH}" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
my_firmware=$(grep "^${my_model} " $manifest_upper)
|
|
||||||
|
|
||||||
if test $? -ne 0; then
|
|
||||||
echo "No matching firmware found (model ${my_model})" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
fw_version=$(echo "${my_firmware}"|cut -d' ' -f2)
|
fw_version=$(echo "${my_firmware}"|cut -d' ' -f2)
|
||||||
fw_md5=$(echo "${my_firmware}"|cut -d' ' -f3)
|
fw_md5=$(echo "${my_firmware}"|cut -d' ' -f3)
|
||||||
|
@ -119,16 +99,11 @@ fw_file=$(echo "${my_firmware}"|cut -d' ' -f4)
|
||||||
|
|
||||||
if newer_than "$fw_version" "$my_version"; then
|
if newer_than "$fw_version" "$my_version"; then
|
||||||
echo "New version available"
|
echo "New version available"
|
||||||
wget -O$fw_image "${BASE}/${fw_file}"
|
wget -O$fw_image "${BASE}/${fw_file}" || fail "Error downloading image"
|
||||||
if test $? -ne 0; then
|
|
||||||
echo "Error downloading image" >&2
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
image_md5=$(md5sum "$fw_image"|cut -b-32)
|
image_md5=$(md5sum "$fw_image"|cut -b-32)
|
||||||
if test "$image_md5" != "$fw_md5"; then
|
if test "$image_md5" != "$fw_md5"; then
|
||||||
echo "Invalid image checksum" >&2
|
fail "Invalid image checksum"
|
||||||
exit 1
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "Upgrading firmware."
|
echo "Upgrading firmware."
|
||||||
|
|
Loading…
Reference in New Issue
Block a user