diff --git a/board/bananapim1/overlay-initramfs/remove_initramfs b/board/bananapim1/overlay-initramfs/remove_initramfs index 81c5f6adde..646372bb44 100755 --- a/board/bananapim1/overlay-initramfs/remove_initramfs +++ b/board/bananapim1/overlay-initramfs/remove_initramfs @@ -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 - diff --git a/board/common/overlay/etc/crontabs/root b/board/common/overlay/etc/crontabs/root index b67d28d62d..c3d1c5572e 100644 --- a/board/common/overlay/etc/crontabs/root +++ b/board/common/overlay/etc/crontabs/root @@ -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 diff --git a/board/common/overlay/etc/init.d/S33hostapd b/board/common/overlay/etc/init.d/S33hostapd index dad69d736a..23b0d0c22f 100755 --- a/board/common/overlay/etc/init.d/S33hostapd +++ b/board/common/overlay/etc/init.d/S33hostapd @@ -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 - diff --git a/board/common/overlay/sbin/fwupdate b/board/common/overlay/sbin/fwupdate index e40caac832..d74e5025c9 100755 --- a/board/common/overlay/sbin/fwupdate +++ b/board/common/overlay/sbin/fwupdate @@ -211,7 +211,7 @@ function show_versions() { show_json=$1 # the /usr/libexec/list-versions-* helpers return a table with the following format: - # |||| + # |||| 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]} diff --git a/board/common/overlay/usr/libexec/list-versions-bitbucket b/board/common/overlay/usr/libexec/list-versions-bitbucket index 6f1d7fb9f3..68615a8750 100755 --- a/board/common/overlay/usr/libexec/list-versions-bitbucket +++ b/board/common/overlay/usr/libexec/list-versions-bitbucket @@ -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]} - diff --git a/board/common/overlay/usr/libexec/list-versions-github b/board/common/overlay/usr/libexec/list-versions-github index 8ac8b0e356..58a183208e 100755 --- a/board/common/overlay/usr/libexec/list-versions-github +++ b/board/common/overlay/usr/libexec/list-versions-github @@ -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 $? diff --git a/board/common/overlay/usr/libexec/list-versions-s3 b/board/common/overlay/usr/libexec/list-versions-s3 index b8801359e5..160168a313 100755 --- a/board/common/overlay/usr/libexec/list-versions-s3 +++ b/board/common/overlay/usr/libexec/list-versions-s3 @@ -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>' | sed 's/\(.*\)<\/Key>/\1/') dates=$(echo "${xml_result}" | grep -oE '[^<]+<\/LastModified>' | sed 's/\(.*\)<\/LastModified>/\1/') +storage_classes=$(echo "${xml_result}" | grep -oE '[^<]+<\/StorageClass>' | sed 's/\(.*\)<\/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 diff --git a/board/odroidc1/overlay-initramfs/prepare_initramfs b/board/odroidc1/overlay-initramfs/prepare_initramfs index 1a0194ad6d..bfc667a343 100755 --- a/board/odroidc1/overlay-initramfs/prepare_initramfs +++ b/board/odroidc1/overlay-initramfs/prepare_initramfs @@ -4,4 +4,3 @@ mkdir /system mount /dev/mmcblk0p2 /system /system/bin/busybox insmod /system/lib/modules/*/kernel/fs/nls/nls_cp437.ko - diff --git a/board/odroidc1/overlay-initramfs/remove_initramfs b/board/odroidc1/overlay-initramfs/remove_initramfs index ab6eeb2354..b64224c3b3 100755 --- a/board/odroidc1/overlay-initramfs/remove_initramfs +++ b/board/odroidc1/overlay-initramfs/remove_initramfs @@ -1,4 +1,3 @@ #!/bin/sh sed -i 's/00 0x22000000 0x/00 - 0x/' /boot/boot.ini - diff --git a/board/odroidc2/overlay-initramfs/remove_initramfs b/board/odroidc2/overlay-initramfs/remove_initramfs index 8fef583da6..23f3c0ac81 100755 --- a/board/odroidc2/overlay-initramfs/remove_initramfs +++ b/board/odroidc2/overlay-initramfs/remove_initramfs @@ -1,4 +1,3 @@ #!/bin/sh sed -i 's/00 0x13000000 0x/00 - 0x/' /boot/boot.ini - diff --git a/board/odroidxu4/overlay-initramfs/remove_initramfs b/board/odroidxu4/overlay-initramfs/remove_initramfs index 6b82169c61..70b9881458 100755 --- a/board/odroidxu4/overlay-initramfs/remove_initramfs +++ b/board/odroidxu4/overlay-initramfs/remove_initramfs @@ -1,4 +1,3 @@ #!/bin/sh sed -i 's/00 0x42000000 0x/00 - 0x/' /boot/boot.ini - diff --git a/board/pine64/overlay-initramfs/remove_initramfs b/board/pine64/overlay-initramfs/remove_initramfs index d2b2798061..2c5aa8cc87 100755 --- a/board/pine64/overlay-initramfs/remove_initramfs +++ b/board/pine64/overlay-initramfs/remove_initramfs @@ -1,4 +1,3 @@ #!/bin/sh sed -i 's/initrd_filename=/#initrd_filename=/' /boot/uEnv.txt - diff --git a/board/raspberrypi/initrd.gz b/board/raspberrypi/initrd.gz index 40d686632b..4fc4238bc3 100644 Binary files a/board/raspberrypi/initrd.gz and b/board/raspberrypi/initrd.gz differ diff --git a/board/raspberrypi/overlay-initramfs/remove_initramfs b/board/raspberrypi/overlay-initramfs/remove_initramfs index a38cdc4ace..004fc348d1 100755 --- a/board/raspberrypi/overlay-initramfs/remove_initramfs +++ b/board/raspberrypi/overlay-initramfs/remove_initramfs @@ -1,4 +1,4 @@ #!/bin/sh sed -i 's/^initramfs.*//g' /boot/config.txt - +sed -i '/^ *$/d' /boot/config.txt # Remove blank lines diff --git a/board/raspberrypi/overlay/etc/init.d/S11throttlewatch b/board/raspberrypi/overlay/etc/init.d/S11throttlewatch index 4f6a422152..a07b6e6dc8 100755 --- a/board/raspberrypi/overlay/etc/init.d/S11throttlewatch +++ b/board/raspberrypi/overlay/etc/init.d/S11throttlewatch @@ -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=$(> /boot/config.txt echo "initramfs initrd.gz" >> /boot/config.txt - diff --git a/board/raspberrypi/overlay/usr/libexec/fw-restore-boot-cfg b/board/raspberrypi/overlay/usr/libexec/fw-restore-boot-cfg index a4cf5afe76..b935963101 100755 --- a/board/raspberrypi/overlay/usr/libexec/fw-restore-boot-cfg +++ b/board/raspberrypi/overlay/usr/libexec/fw-restore-boot-cfg @@ -7,4 +7,3 @@ fi old_boot=$1 cp ${old_boot}/config.txt /boot - diff --git a/board/raspberrypi2/initrd.gz b/board/raspberrypi2/initrd.gz index 820a276d85..24415e050c 100644 Binary files a/board/raspberrypi2/initrd.gz and b/board/raspberrypi2/initrd.gz differ diff --git a/board/raspberrypi2/overlay/etc/init.d/S11throttlewatch b/board/raspberrypi2/overlay/etc/init.d/S11throttlewatch index 4f6a422152..a07b6e6dc8 100755 --- a/board/raspberrypi2/overlay/etc/init.d/S11throttlewatch +++ b/board/raspberrypi2/overlay/etc/init.d/S11throttlewatch @@ -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=$(