From 5928a842511e36afdeb44866f9c70ed90f428010 Mon Sep 17 00:00:00 2001 From: Paul Philippov Date: Sat, 27 Aug 2022 14:42:02 -0400 Subject: [PATCH 1/3] with -w for web ui update from dev branch (#415) --- general/overlay/usr/sbin/sysupgrade | 101 +++++++++++++++------------- 1 file changed, 56 insertions(+), 45 deletions(-) diff --git a/general/overlay/usr/sbin/sysupgrade b/general/overlay/usr/sbin/sysupgrade index e3e2317e..3208c8f4 100755 --- a/general/overlay/usr/sbin/sysupgrade +++ b/general/overlay/usr/sbin/sysupgrade @@ -1,14 +1,16 @@ #!/bin/sh # -# OpenIPC.org | v.20220824 +# OpenIPC.org | v.20220827 # -scr_version=1.0.5 +scr_version=1.0.6 args=" $@" set -e +LOCK_FILE=/tmp/sysupgrade.lock + echo_c() { # 31 red, 32 green, 33 yellow, 34 blue, 35 magenta, 36 cyan, 37 white, 38 grey [ -z "$HASERLVER" ] && t="\e[1;$1m$2\e[0m" || t="$2" @@ -21,13 +23,13 @@ die() { } check_soc() { - [ "$skip_soc" -eq 1 ] && echo "Skip SoC validation" && return 0 + [ "1" = "$skip_soc" ] && echo "Skip SoC validation" && return 0 [ "$1" = "$soc" ] && echo "SoC OK" && return 0 die "Wrong SoC!" } compare_versions() { - [ "$skip_ver" -eq 1 ] && echo "Skip version checking" && return 1 + [ "1" = "$skip_ver" ] && echo "Skip version checking" && return 1 [ "$1" = "$2" ] && echo_c 32 "Same version, nothing to update" && return 0 echo_c 32 "New version, going to update" && return 1 } @@ -82,7 +84,7 @@ download_firmware() { [ -z "$HASERLVER" ] && progress="-#" || progress="-s" [ "$(curl -o /dev/null -s -w '%{http_code}\n' "$url")" = "000" ] && die "Check your network!" curl --connect-timeout 30 -s -m 60 -L "$url" ${progress} -o - | gzip -d | tar xf - -C /tmp && echo_c 32 "Received and unpacked" || die "Cannot retrieve $url" - if [ "$skip_md5" -eq 0 ]; then + if [ "1" != "$skip_md5" ]; then (cd /tmp && md5sum -s -c *.md5sum) || die "Wrong checksum!" fi } @@ -148,11 +150,11 @@ check_sdcard() { } create_lock() { - if [ -f /tmp/sysupgrade.lock ]; then + if [ -f $LOCK_FILE ]; then echo_c 31 "\nAnother sysupgrade process is already running!" exit 1 fi - touch /tmp/sysupgrade.lock + touch $LOCK_FILE } get_device() { @@ -189,37 +191,36 @@ print_usage() { echo " Usage: $0 [options] Where: - -k update kernel from online repository - -r update rootfs from online repository - --url=[URL] custom URL to update from (.tgz format) - --kernel=[FILE] update kernel from file (uImage format) - --rootfs=[FILE] update rootfs from file (squashfs format) - --force_md5 do not validate MD5 hash - --force_soc do not validate processor - --force_ver do not validate release version - --force_all do not validate anything - -n, --wipe_overlay wipe overlay partition - -x, --no_reboot do not reboot after updating - -z, --no_update do not update self - -h, --help display this help and exit + -k Update kernel from online repository. + -r Update rootfs from online repository. + -w Update Web UI to development version. + --url=[URL] Custom URL to update from (.tgz format). + --kernel=[FILE] Update kernel from file (uImage format). + --rootfs=[FILE] Update rootfs from file (squashfs format). + --force_md5 Do not validate MD5 hash. + --force_soc Do not validate processor. + --force_ver Do not validate release version. + --force_all Do not validate anything. + -n, --wipe_overlay Wipe overlay partition. + -x, --no_reboot Do not reboot after updating. + -z, --no_update Do not update self. + -h, --help Display this help and exit. " } reboot_system() { - [ "$skip_reboot" -eq 1 ] && echo_c 31 "\nReboot needed!" && exit 1 - echo_c 37 "\nUnconditional reboot" - reboot -d 1 -f + if [ "1" = "$skip_reboot" ]; then + echo_c 33 "\nYou asked me not to reboot, so I won't." + echo_c 31 "Although a reboot is required to apply the changes." + echo_c 37 "Please reboot the camera manually whenever possible." + rm $LOCK_FILE + exit 1 + else + echo_c 37 "\nUnconditional reboot" + reboot -d 1 -f + fi } -clear_overlay=0 -remote_update=0 -skip_md5=0 -skip_soc=0 -skip_ver=0 -skip_reboot=0 -update_kernel=0 -update_rootfs=0 - for i in "$@"; do case $i in --force_all) @@ -277,6 +278,10 @@ for i in "$@"; do skip_reboot=1 shift ;; + -w) + update_webui=1 + shift + ;; -z | --no_update) skip_selfupdate=1 shift @@ -292,29 +297,35 @@ done print_sysinfo -[ "$update_kernel" -eq 0 ] && - [ "$update_rootfs" -eq 0 ] && - [ "$clear_overlay" -eq 0 ] && +[ "1" != "$clear_overlay" ] && +[ "1" != "$update_kernel" ] && +[ "1" != "$update_rootfs" ] && +[ "1" != "$update_webui" ] && echo_c 37 "\nTry '$(basename "$0") --help' for options." && exit 0 [ "1" != "$skip_selfupdate" ] && self_update +if [ "1" = "$update_webui" ]; then + if [ "1" = "$update_rootfs" ]; then + update_webui=0 + echo_c 31 "\nCannot update Web UI along with RootFS!" + echo_c 37 "Please update RootFS then reboot the camera and re-run $0 -w to update Web UI in a separate run." + sleep 5 + fi +fi + check_sdcard create_lock free_resources -[ "$remote_update" -eq 1 ] && download_firmware -[ "$update_kernel" -eq 1 ] && do_update_kernel "$kernel_file" -[ "$update_rootfs" -eq 1 ] && do_update_rootfs "$rootfs_file" -[ "$clear_overlay" -eq 1 ] && do_wipe_overlay +[ "1" = "$remote_update" ] && download_firmware +[ "1" = "$update_kernel" ] && do_update_kernel "$kernel_file" +[ "1" = "$update_rootfs" ] && do_update_rootfs "$rootfs_file" +[ "1" = "$clear_overlay" ] && do_wipe_overlay +[ "1" = "$update_webui" ] && updatewebui.sh -b dev -if [ "1" = "$skip_reboot" ]; then - echo_c 33 "You asked me not to reboot, so I won't." - echo_c 37 "Please reboot the camera manually whenever possible." -else - reboot_system -fi +reboot_system exit 0 From 4b7c6f935aca1bda76107f8bf0edcbc740c818f3 Mon Sep 17 00:00:00 2001 From: Dmitry Ilyin Date: Sun, 28 Aug 2022 08:11:59 +0300 Subject: [PATCH 2/3] Revert md5sum rearrange to fix broken sysupgrade (#417) --- .github/workflows/matrix_build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/matrix_build.yml b/.github/workflows/matrix_build.yml index 8621a82b..04eb4711 100644 --- a/.github/workflows/matrix_build.yml +++ b/.github/workflows/matrix_build.yml @@ -488,10 +488,10 @@ jobs: NORFW_FILE=$(basename $NORFW_PATH) echo "NORFW_FILE=$NORFW_FILE" >> $GITHUB_ENV - md5sum uImage > uImage.${{ matrix.platform }}.md5sum mv uImage uImage.${{ matrix.platform }} - md5sum rootfs.squashfs > rootfs.squashfs.${{ matrix.platform }}.md5sum mv rootfs.squashfs rootfs.squashfs.${{ matrix.platform }} + md5sum rootfs.squashfs.${{ matrix.platform }} > rootfs.squashfs.${{ matrix.platform }}.md5sum + md5sum uImage.${{ matrix.platform }} > uImage.${{ matrix.platform }}.md5sum tar -cvzf $NORFW_PATH uImage* *rootfs.squashfs.${{ matrix.platform }}* fi @@ -502,8 +502,8 @@ jobs: echo "NANDFW_FILE=$NANDFW_FILE" >> $GITHUB_ENV mv rootfs.ubi rootfs.ubi.${{ matrix.platform }} - md5sum rootfs.ubifs > rootfs.ubifs.${{ matrix.platform }}.md5sum mv rootfs.ubifs rootfs.ubifs.${{ matrix.platform }} + md5sum rootfs.ubifs.${{ matrix.platform }} > rootfs.ubifs.${{ matrix.platform }}.md5sum case ${{ matrix.platform }} in rv*) mv zboot.img boot.img.${{ matrix.platform }} From a2ae002ff902a8556ce42c1118c9347389b88e43 Mon Sep 17 00:00:00 2001 From: Dmitry Ilyin Date: Mon, 29 Aug 2022 08:34:54 +0300 Subject: [PATCH 3/3] Fix ipctool building issues (#414) --- .github/workflows/matrix_build.yml | 2 +- general/package/ipctool/ipctool.mk | 6 ++---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/.github/workflows/matrix_build.yml b/.github/workflows/matrix_build.yml index 04eb4711..e899a1b6 100644 --- a/.github/workflows/matrix_build.yml +++ b/.github/workflows/matrix_build.yml @@ -523,7 +523,7 @@ jobs: TG_CHANNEL: ${{ secrets.TELEGRAM_CHANNEL_OPENIPC_DEV }} if: ${{ !env.ACT && failure() && github.event_name != 'pull_request' }} run: | - TG_OPTIONS="-s --connect-timeout 30 --max-time 30" + TG_OPTIONS="-s --connect-timeout 30 --retry 10 --verbose" TG_NOTIFY="${TG_NOTIFY:=Warning, Buildroot compiling error... ${{ matrix.platform }} (${{ matrix.release }})}" TG_HEADER=$(echo -e "\r\n$TG_NOTIFY \r\n\r\nCommit: $GIT_HASH \r\nBranch: $BRANCH \r\nTag: $TAG_NAME \r\n\r\n\xE2\x9A\xA0 GitHub Actions") curl $TG_OPTIONS -H "Content-Type: multipart/form-data" -X POST https://api.telegram.org/bot$TG_TOKEN/sendMessage \ diff --git a/general/package/ipctool/ipctool.mk b/general/package/ipctool/ipctool.mk index 5709fb72..489eb33e 100644 --- a/general/package/ipctool/ipctool.mk +++ b/general/package/ipctool/ipctool.mk @@ -4,15 +4,13 @@ # ################################################################################ -IPCTOOL_VERSION = HEAD +IPCTOOL_VERSION = $(shell git ls-remote https://github.com/OpenIPC/ipctool/ master | awk '{ print $$1 }') IPCTOOL_SITE = https://github.com/OpenIPC/ipctool.git IPCTOOL_SITE_METHOD = git IPCTOOL_LICENSE = MIT IPCTOOL_LICENSE_FILES = LICENSE -IPCTOOL_OVERRIDE_SRCDIR_RSYNC_EXCLUSIONS=--include .git - -IPCTOOL_CONF_OPTS += -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release +IPCTOOL_CONF_OPTS += -DBUILD_SHARED_LIBS=ON -DCMAKE_BUILD_TYPE=Release -DSKIP_VERSION=ON IPCTOOL_MAKE_OPTS += VERBOSE=1