Merge branch 'dev' into motion_update

This commit is contained in:
popoviciri 2020-05-03 13:45:05 +02:00
commit f9e6a1fde0
27 changed files with 125 additions and 71 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

@ -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)

View File

@ -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 $?

View File

@ -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

View File

@ -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"

View File

@ -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

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]}
@ -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

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 $?