Merge remote-tracking branch 'thingos/dev' into dev

This commit is contained in:
Calin Crisan 2020-06-06 12:44:38 +03:00
commit 12afca5baa
23 changed files with 106 additions and 55 deletions

View File

@ -4,4 +4,3 @@ if [ -f /boot/boot-normal.scr ]; then
mv /boot/boot.scr /boot/boot-fwupdater.scr
mv /boot/boot-normal.scr /boot/boot.scr
fi

View File

@ -1,3 +1,3 @@
14 3 * * * /usr/sbin/logrotate /etc/logrotate.conf
13 * * * * /usr/sbin/logrotate /etc/logrotate.conf
0 2 * * 0 /usr/sbin/https-update
*/15 * * * * /usr/sbin/dyndns-update

View File

@ -18,7 +18,6 @@ test -x ${PROG} || exit 0
test -n "${OS_VERSION}" || source /etc/init.d/base
prepare_conf ${CONF} ${SYS_CONF} ${BOOT_CONF}
test -s ${CONF} || exit 0
test -s ${WATCH_CONF} && source ${WATCH_CONF}
@ -38,7 +37,20 @@ watch() {
done
}
start() {
prepare_ap_ifaces() {
wifi_ifaces=$(ip link | grep -oE 'wlan[[:digit:]]')
msg_begin "Preparing AP interfaces"
ap_ifaces=""
for iface in ${wifi_ifaces}; do
ap_iface=ap${iface: -1}
if iw dev ${iface} interface add ${ap_iface} type __ap &>/dev/null; then
ap_ifaces+="${ap_iface} "
fi
done
msg_done "${ap_ifaces:-none}"
}
start_hostapd() {
msg_begin "Starting hostapd"
# wait up to 5 seconds for interface
@ -65,13 +77,27 @@ start() {
test -n "${module}" && msg_done "done (${module})"|| msg_done
}
stop() {
stop_hostapd() {
msg_begin "Stopping hostpad"
killall hostapd &>/dev/null
ps | grep hostapd | grep -v $$ | grep -v grep | tr -s ' ' | sed -e 's/^\s//' | cut -d ' ' -f 1 | xargs -r kill
msg_done
}
start() {
prepare_ap_ifaces
if [[ -s ${CONF} ]]; then
start_hostapd
fi
}
stop() {
if [[ -s ${CONF} ]]; then
stop_hostapd
fi
}
case "$1" in
start)
start
@ -90,4 +116,3 @@ case "$1" in
echo "Usage: $0 {start|stop|restart}"
exit 1
esac

View File

@ -211,7 +211,7 @@ function show_versions() {
show_json=$1
# the /usr/libexec/list-versions-* helpers return a table with the following format:
# <version>|<prerelease>|<board>|<url>|<date>
# <version>|<prerelease>|<board>|<url>|<date|published>
versions=$(FW_USERNAME=${OS_FIRMWARE_USERNAME} FW_PASSWORD=${OS_FIRMWARE_PASSWORD} \
/usr/libexec/list-versions-${OS_FIRMWARE_METHOD} ${OS_FIRMWARE_REPO})
@ -223,6 +223,9 @@ function show_versions() {
if [[ "${OS_PRERELEASES}" == "false" && "${varr[1]}" == "true" ]]; then
continue # skip prereleases
fi
if [[ "${varr[5]}" == "false" ]]; then
continue # skip unpublished
fi
if [[ "${board}" != "${varr[2]}" ]]; then
continue # skip other boards
fi
@ -230,8 +233,7 @@ function show_versions() {
if [[ "${show_json}" == "true" ]]; then
echo "{\"version\": \"${varr[0]}\"," \
"\"url\": \"${varr[3]}\"," \
"\"board\": \"${varr[2]}\"," \
"\"prerelease\": ${varr[1]}," \
"\"prerelease\": ${varr[1]:-false}," \
"\"date\": \"${varr[4]}\"}"
else
echo ${varr[0]}

View File

@ -14,6 +14,11 @@ function check_prerelease() {
fi
}
function add_published_flag() {
read line
echo "${line}|true"
}
extensions=".img.gz .img.xz .img"
opts="-s -S -f"
test -n "${FW_USERNAME}" && opts+=" --user ${FW_USERNAME}:${FW_PASSWORD}"
@ -23,6 +28,5 @@ rtrimstr=$(for e in ${extensions}; do echo -n " | rtrimstr(\"${e}\")"; done)
jq_expr=".values[] | [{a: .name | split(\"-\"), url: .links.self.href, date: .created_on | split(\"T\")[0]}] |
map((.a[2] ${rtrimstr}), \"false\", .a[1], .url, .date) | join(\"|\")"
curl ${opts} ${url} | jq --raw-output "${jq_expr}" | while read line; do echo "${line}" | check_prerelease; done
curl ${opts} ${url} | jq --raw-output "${jq_expr}" | while read line; do echo "${line}" | check_prerelease | add_published_flag; done
exit ${PIPESTATUS[0]}

View File

@ -7,12 +7,18 @@ fi
opts="-s -S -f"
test -n "${FW_USERNAME}" && opts+=" --user ${FW_USERNAME}:${FW_PASSWORD}"
url=https://api.github.com/repos/$1/releases
releases_url=https://api.github.com/repos/$1/releases
# Get release info via GitHub API
releases=$(curl ${opts} ${releases_url})
test $? == 0 || exit 1
# Format release lines
jq_expr='.[] | {version: .name, prerelease: .prerelease | tostring} +
(.assets[] | {name: .name | split("-")[1], url: .browser_download_url}) +
({date: .created_at | split("T")[0]}) | flatten | join("|")'
curl ${opts} ${url} | jq --raw-output "${jq_expr}"
exit ${PIPESTATUS[0]}
({date: .created_at | split("T")[0]}) +
({published: true})
| flatten | join("|")'
jq --raw-output "${jq_expr}" <<< ${releases}
exit $?

View File

@ -13,33 +13,43 @@ bucket=$(echo ${bucket_path} | cut -d '/' -f 1)
path=${bucket_path:${#bucket} + 1}
opts="-s -S -f"
max_keys="1000"
test -n "${FW_USERNAME}" && opts+=" --user ${FW_USERNAME}:${FW_PASSWORD}"
url="https://${bucket}.s3.amazonaws.com"
xml_result=$(curl ${opts} "${url}?list-type=2&prefix=${path}")
xml_result=$(curl ${opts} "${url}?list-type=2&max_keys=${max_keys}&prefix=${path}&fetch-owner=true")
keys=$(echo "${xml_result}" | grep -oE '<Key>[^<]+<\/Key>' | sed 's/<Key>\(.*\)<\/Key>/\1/')
dates=$(echo "${xml_result}" | grep -oE '<LastModified>[^<]+<\/LastModified>' | sed 's/<LastModified>\(.*\)<\/LastModified>/\1/')
storage_classes=$(echo "${xml_result}" | grep -oE '<StorageClass>[^<]+<\/StorageClass>' | sed 's/<StorageClass>\(.*\)<\/StorageClass>/\1/')
dates=(${dates})
files=(${keys})
storage_classes=(${storage_classes})
i=0
for file in ${files[*]}; do
[[ "${file}" =~ ^${path}/(.+)/(.+)$ ]] || continue
version="${BASH_REMATCH[1]}"
fname="${BASH_REMATCH[2]}"
prerelease=false
if [[ "${version}" =~ ^.*[abc]\.?[0-9]+$ ]] || # e.g. 0.4.1b2, 0.4.1b.2, 0.4.1-b.2
[[ "${version}" =~ ^.*(alpha|beta|rc)\.?[0-9]+$ ]] || # e.g. 0.4.1beta2, 0.4.1beta.2, 0.4.1-beta.2
[[ "${version}" =~ ^(dev|nightly).*$ ]]; then # e.g. dev20180314, nightly20180314
prerelease=true
fi
# Items with REDUCED_REDUNDANCY storage class are considered, by convention, unpublished
published="true"
storage_class=${storage_classes[${i}]}
if [[ "${storage_class}" == "REDUCED_REDUNDANCY" ]]; then
published="false"
fi
[[ "${fname}" =~ ^([^-]+)-([^-]+)-(.+)$ ]] || continue
board="${BASH_REMATCH[2]}"
final_url="${url}/${path}/${version}/${fname}"
date="${dates[${i}]:0:10}"
echo "${version}|${prerelease}|${board}|${final_url}|${date}"
echo "${version}|${prerelease}|${board}|${final_url}|${date}|${published}"
i=$((i + 1))
done | semver-sort -r -t '|' -k 1

View File

@ -4,4 +4,3 @@
mkdir /system
mount /dev/mmcblk0p2 /system
/system/bin/busybox insmod /system/lib/modules/*/kernel/fs/nls/nls_cp437.ko

View File

@ -1,4 +1,3 @@
#!/bin/sh
sed -i 's/00 0x22000000 0x/00 - 0x/' /boot/boot.ini

View File

@ -1,4 +1,3 @@
#!/bin/sh
sed -i 's/00 0x13000000 0x/00 - 0x/' /boot/boot.ini

View File

@ -1,4 +1,3 @@
#!/bin/sh
sed -i 's/00 0x42000000 0x/00 - 0x/' /boot/boot.ini

View File

@ -1,4 +1,3 @@
#!/bin/sh
sed -i 's/initrd_filename=/#initrd_filename=/' /boot/uEnv.txt

Binary file not shown.

View File

@ -1,4 +1,4 @@
#!/bin/sh
sed -i 's/^initramfs.*//g' /boot/config.txt
sed -i '/^ *$/d' /boot/config.txt # Remove blank lines

View File

@ -1,6 +1,6 @@
#!/bin/bash
CHECK_INTERVAL=30
CHECK_INTERVAL=60
test -n "${OS_VERSION}" || source /etc/init.d/base
@ -19,12 +19,16 @@ get_throttled_since_boot() {
test $((t & 262144)) -ne 0 && echo -n "throttled "
}
get_temp() {
t=$(</sys/class/thermal/thermal_zone0/temp)
echo "$((t / 1000))"
}
watch_now() {
while true; do
t=$(get_throttled_now)
if [[ -n "${t}" ]]; then
logger -t throttlewatch -s "currently: ${t}"
fi
th=$(get_throttled_now)
te=$(get_temp)
logger -t throttlewatch "currently: ${th:-ok}, temperature: ${te} C"
sleep ${CHECK_INTERVAL}
done
@ -34,7 +38,7 @@ watch_since_boot() {
while true; do
t=$(get_throttled_since_boot)
if [[ -n "${t}" ]]; then
logger -t throttlewatch -s "since boot: ${t}"
logger -t throttlewatch "since boot: ${t}"
break
fi
@ -62,4 +66,3 @@ case "$1" in
esac
exit $?

View File

@ -2,4 +2,3 @@
echo >> /boot/config.txt
echo "initramfs initrd.gz" >> /boot/config.txt

View File

@ -7,4 +7,3 @@ fi
old_boot=$1
cp ${old_boot}/config.txt /boot

Binary file not shown.

View File

@ -1,6 +1,6 @@
#!/bin/bash
CHECK_INTERVAL=30
CHECK_INTERVAL=60
test -n "${OS_VERSION}" || source /etc/init.d/base
@ -19,12 +19,16 @@ get_throttled_since_boot() {
test $((t & 262144)) -ne 0 && echo -n "throttled "
}
get_temp() {
t=$(</sys/class/thermal/thermal_zone0/temp)
echo "$((t / 1000))"
}
watch_now() {
while true; do
t=$(get_throttled_now)
if [[ -n "${t}" ]]; then
logger -t throttlewatch -s "currently: ${t}"
fi
th=$(get_throttled_now)
te=$(get_temp)
logger -t throttlewatch "currently: ${th:-ok}, temperature: ${te} C"
sleep ${CHECK_INTERVAL}
done
@ -34,7 +38,7 @@ watch_since_boot() {
while true; do
t=$(get_throttled_since_boot)
if [[ -n "${t}" ]]; then
logger -t throttlewatch -s "since boot: ${t}"
logger -t throttlewatch "since boot: ${t}"
break
fi
@ -62,4 +66,3 @@ case "$1" in
esac
exit $?

Binary file not shown.

View File

@ -1,6 +1,6 @@
#!/bin/bash
CHECK_INTERVAL=30
CHECK_INTERVAL=60
test -n "${OS_VERSION}" || source /etc/init.d/base
@ -19,12 +19,16 @@ get_throttled_since_boot() {
test $((t & 262144)) -ne 0 && echo -n "throttled "
}
get_temp() {
t=$(</sys/class/thermal/thermal_zone0/temp)
echo "$((t / 1000))"
}
watch_now() {
while true; do
t=$(get_throttled_now)
if [[ -n "${t}" ]]; then
logger -t throttlewatch -s "currently: ${t}"
fi
th=$(get_throttled_now)
te=$(get_temp)
logger -t throttlewatch "currently: ${th:-ok}, temperature: ${te} C"
sleep ${CHECK_INTERVAL}
done
@ -34,7 +38,7 @@ watch_since_boot() {
while true; do
t=$(get_throttled_since_boot)
if [[ -n "${t}" ]]; then
logger -t throttlewatch -s "since boot: ${t}"
logger -t throttlewatch "since boot: ${t}"
break
fi
@ -62,4 +66,3 @@ case "$1" in
esac
exit $?

Binary file not shown.

View File

@ -1,6 +1,6 @@
#!/bin/bash
CHECK_INTERVAL=30
CHECK_INTERVAL=60
test -n "${OS_VERSION}" || source /etc/init.d/base
@ -19,12 +19,16 @@ get_throttled_since_boot() {
test $((t & 262144)) -ne 0 && echo -n "throttled "
}
get_temp() {
t=$(</sys/class/thermal/thermal_zone0/temp)
echo "$((t / 1000))"
}
watch_now() {
while true; do
t=$(get_throttled_now)
if [[ -n "${t}" ]]; then
logger -t throttlewatch -s "currently: ${t}"
fi
th=$(get_throttled_now)
te=$(get_temp)
logger -t throttlewatch "currently: ${th:-ok}, temperature: ${te} C"
sleep ${CHECK_INTERVAL}
done
@ -34,7 +38,7 @@ watch_since_boot() {
while true; do
t=$(get_throttled_since_boot)
if [[ -n "${t}" ]]; then
logger -t throttlewatch -s "since boot: ${t}"
logger -t throttlewatch "since boot: ${t}"
break
fi
@ -62,4 +66,3 @@ case "$1" in
esac
exit $?