mirror of
https://github.com/motioneye-project/motioneyeos.git
synced 2025-07-28 13:46:32 +00:00
initial work on generalized firmware update
This commit is contained in:
parent
f748ea3e6c
commit
b152773f44
@ -7,3 +7,8 @@ os_ppp="ppp0"
|
|||||||
os_networkless="false"
|
os_networkless="false"
|
||||||
os_country="US"
|
os_country="US"
|
||||||
|
|
||||||
|
os_firmware_method="github"
|
||||||
|
os_firmware_repo="ccrisan/motioneyeos"
|
||||||
|
os_firmware_username=""
|
||||||
|
os_firmware_password=""
|
||||||
|
|
||||||
|
54
board/common/overlay/sbin/fwupdate
Normal file
54
board/common/overlay/sbin/fwupdate
Normal file
@ -0,0 +1,54 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
function exit_usage() {
|
||||||
|
echo "Usage: $0 latest"
|
||||||
|
echo " $0 current"
|
||||||
|
echo " $0 upgrade <version|url>"
|
||||||
|
echo " $0 progress"
|
||||||
|
|
||||||
|
exit -1
|
||||||
|
}
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
exit_usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
function show_latest() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function show_current() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function do_upgrade() {
|
||||||
|
}
|
||||||
|
|
||||||
|
function show_progress() {
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
case "$1" in
|
||||||
|
latest)
|
||||||
|
show_latest
|
||||||
|
;;
|
||||||
|
|
||||||
|
current)
|
||||||
|
show_current
|
||||||
|
;;
|
||||||
|
|
||||||
|
upgrade)
|
||||||
|
if [ -z "$2" ];
|
||||||
|
exit_usage
|
||||||
|
fi
|
||||||
|
|
||||||
|
do_upgrade $2
|
||||||
|
;;
|
||||||
|
|
||||||
|
progress)
|
||||||
|
show_progress
|
||||||
|
;;
|
||||||
|
|
||||||
|
*)
|
||||||
|
exit_usage
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
15
board/common/overlay/usr/libexec/list-versions-bitbucket
Executable file
15
board/common/overlay/usr/libexec/list-versions-bitbucket
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Usage: $0 <account/project>" 1>&2
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
opts="-s -S -f"
|
||||||
|
test -n "$BITBUCKET_USERNAME" && opts+=" --user $BITBUCKET_USERNAME:$BITBUCKET_PASSWORD"
|
||||||
|
url=https://api.bitbucket.org/2.0/repositories/$1/downloads?pagelen=100
|
||||||
|
jq_expr='.values[] | [{a: .name | capture("[^-]+-(?<b>[^-]+)-(?<c>[^-]+)\\.img\\.?.*"), url: .links.self.href}] | map(.a.c, "false", .a.b, .url) | join("|")'
|
||||||
|
|
||||||
|
curl $opts $url | jq --raw-output "$jq_expr"
|
||||||
|
exit ${PIPESTATUS[0]}
|
||||||
|
|
15
board/common/overlay/usr/libexec/list-versions-github
Executable file
15
board/common/overlay/usr/libexec/list-versions-github
Executable file
@ -0,0 +1,15 @@
|
|||||||
|
#!/bin/bash
|
||||||
|
|
||||||
|
if [ -z "$1" ]; then
|
||||||
|
echo "Usage: $0 <account/project>" 1>&2
|
||||||
|
exit -1
|
||||||
|
fi
|
||||||
|
|
||||||
|
opts="-s -S -f"
|
||||||
|
test -n "$GITHUB_USERNAME" && opts+=" --user $GITHUB_USERNAME:$GITHUB_PASSWORD"
|
||||||
|
url=https://api.github.com/repos/$1/releases
|
||||||
|
jq_expr='.[] | {version: .name, prerelease: .prerelease | tostring, name: .assets[].name | capture("[^-]+-(?<b>[^-]+)") | flatten, asset: .assets[].browser_download_url} | flatten | join("|")'
|
||||||
|
|
||||||
|
curl $opts $url | jq --raw-output "$jq_expr"
|
||||||
|
exit ${PIPESTATUS[0]}
|
||||||
|
|
@ -50,7 +50,7 @@ def get_all_versions():
|
|||||||
url = _LIST_VERSIONS_URL
|
url = _LIST_VERSIONS_URL
|
||||||
url += '?_=' + str(int(time.time())) # prevents caching
|
url += '?_=' + str(int(time.time())) # prevents caching
|
||||||
|
|
||||||
want_prereleases = subprocess.check_output('source /data/etc/os.conf && echo $os_prereleases', shell=True, stderr=subprocess.STDOUT).strip() == 'true'
|
want_prereleases = subprocess.check_output('source /data/etc/os.conf && echo $os_prereleases', shell=True, stderr=subprocess.STDOUT).strip() == 'true'
|
||||||
|
|
||||||
try:
|
try:
|
||||||
logging.debug('board is %s' % _BOARD)
|
logging.debug('board is %s' % _BOARD)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user