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/S00datapart b/board/common/overlay/etc/init.d/S00datapart index 5c76f928fa..70e880cb95 100755 --- a/board/common/overlay/etc/init.d/S00datapart +++ b/board/common/overlay/etc/init.d/S00datapart @@ -41,24 +41,12 @@ case "$1" in test $? == 0 && msg_done || msg_fail msg_begin "Mounting data partition" - mount -T /etc/fstab.disk /data - test $? == 0 && msg_done || msg_fail + mount -T /etc/fstab.disk /data && msg_done || msg_fail - msg_begin "Creating required data files" + msg_begin "Copying data skeleton" cp -pur /usr/share/dataskel/* /data - cp /etc/version /data/etc/version - ln -s /usr/share/zoneinfo/UTC /data/etc/localtime - touch /data/etc/adjtime sync msg_done - - msg_begin "Setting empty root password" - PASSWORD="" adminpasswd - msg_done - - # mount other partitions depending on data - mount -T /etc/fstab.disk -a - mount -T /etc/fstab.extra -a ;; stop) diff --git a/board/common/overlay/etc/init.d/S02defaultdata b/board/common/overlay/etc/init.d/S02defaultdata new file mode 100755 index 0000000000..62bf91454e --- /dev/null +++ b/board/common/overlay/etc/init.d/S02defaultdata @@ -0,0 +1,45 @@ +#!/bin/bash + +test -n "${OS_VERSION}" || source /etc/init.d/base + + +set_empty_root_passwd() { + msg_begin "Setting empty root password" + PASSWORD="" adminpasswd + sync + msg_done +} + +copy_version() { + msg_begin "Copying version file" + cp /etc/version /data/etc/version + sync + msg_done +} + +set_utc_timezone() { + msg_begin "Setting UTC timezone" + ln -s /usr/share/zoneinfo/UTC /data/etc/localtime + touch /data/etc/adjtime + sync + msg_done +} + + +case "$1" in + start) + test -s /data/etc/shadow || set_empty_root_passwd + test -s /data/etc/version || copy_version + test -s /data/etc/localtime || set_utc_timezone + ;; + + stop) + true + ;; + + *) + echo "Usage: $0 {start}" + exit 1 +esac + +exit $? diff --git a/board/common/overlay/etc/init.d/S60sshd b/board/common/overlay/etc/init.d/S60sshd index 9e3ff1c878..82f3b04dab 100755 --- a/board/common/overlay/etc/init.d/S60sshd +++ b/board/common/overlay/etc/init.d/S60sshd @@ -18,8 +18,6 @@ test -n "${OS_VERSION}" || source /etc/init.d/base test -s ${SYS_CONF} || exit 0 -test "${OS_NETWORKLESS}" == "true" && exit 0 - start() { # merge user and sys conf files; options in first file take precedence diff --git a/board/common/overlay/etc/init.d/S61proftpd b/board/common/overlay/etc/init.d/S61proftpd index f0a16817aa..445a6dda05 100755 --- a/board/common/overlay/etc/init.d/S61proftpd +++ b/board/common/overlay/etc/init.d/S61proftpd @@ -11,8 +11,6 @@ test -n "${OS_DEBUG}" || source /etc/init.d/conf test -s ${CONF} || exit 0 -test "${OS_NETWORKLESS}" == "true" && exit 0 - start() { msg_begin "Starting proftpd" diff --git a/board/common/overlay/etc/init.d/S62smb b/board/common/overlay/etc/init.d/S62smb index 74637cf5a2..2f87a46b7a 100755 --- a/board/common/overlay/etc/init.d/S62smb +++ b/board/common/overlay/etc/init.d/S62smb @@ -13,8 +13,6 @@ test -n "${OS_DEBUG}" || source /etc/init.d/conf test -s ${CONF} || exit 0 -test "${OS_NETWORKLESS}" == "true" && exit 0 - start() { mkdir -p /var/log/samba diff --git a/board/common/overlay/sbin/fwupdate b/board/common/overlay/sbin/fwupdate index a5c8afd63e..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]} @@ -275,6 +277,7 @@ function do_download() { if [[ -n "${DST_FNAME}" ]]; then cp -f $1 ${DST_FNAME} echo ${version} > ${VER_FILE} + touch ${DOWNLOAD_DONE_FILE} return fi fi 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=$(