Overlay: add silent update setting to sysupgrade (#1320)

pull/1321/head
viktorxda 2024-02-17 11:41:10 +01:00 committed by GitHub
parent 8ec76c3d6b
commit 84858247b6
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 19 additions and 10 deletions

View File

@ -3,7 +3,7 @@
# OpenIPC.org | 2024 # OpenIPC.org | 2024
# #
scr_version=1.0.37 scr_version=1.0.38
args=" $@" args=" $@"
@ -51,7 +51,7 @@ do_update_kernel() {
esac esac
compare_versions "$kernel_version" "$(get_kernel_version "$x")" && return 0 compare_versions "$kernel_version" "$(get_kernel_version "$x")" && return 0
fi fi
busybox flashcp -v "$x" "$kernel_device" set_progress flashcp -v "$x" "$kernel_device"
echo_c 32 "Kernel updated to $(get_kernel_version "$kernel_device")" echo_c 32 "Kernel updated to $(get_kernel_version "$kernel_device")"
} }
@ -71,7 +71,7 @@ do_update_rootfs() {
else else
die "Unable to mount $y!" die "Unable to mount $y!"
fi fi
busybox flashcp -v "$x" "$(get_device "rootfs")" set_progress flashcp -v "$x" "$(get_device "rootfs")"
echo_c 32 "RootFS updated to $rootfs_version" echo_c 32 "RootFS updated to $rootfs_version"
} }
@ -79,12 +79,11 @@ do_wipe_overlay() {
echo_c 33 "\nOverlayFS" echo_c 33 "\nOverlayFS"
echo "Erase overlay partition" echo "Erase overlay partition"
[ "$flash_type" = "nand" ] || jffs2="-j" [ "$flash_type" = "nand" ] || jffs2="-j"
busybox flash_eraseall $jffs2 "$(get_device "rootfs_data")" set_progress flash_eraseall $jffs2 "$(get_device "rootfs_data")"
} }
download_firmware() { download_firmware() {
[ "$flash_type" = "nand" ] && echo_c 31 "\nNote: the updater uses the NOR package for updating NAND" [ "$flash_type" = "nand" ] && echo_c 31 "\nNote: the updater uses the NOR package for updating NAND"
echo_c 33 "\nFirmware" echo_c 33 "\nFirmware"
[ "$branch_dev" = "1" ] && branch="dev" || branch="latest" [ "$branch_dev" = "1" ] && branch="dev" || branch="latest"
osr=$(get_system_build) osr=$(get_system_build)
@ -104,23 +103,20 @@ free_resources() {
echo_c 37 "\nStop services, sync files, free up memory" echo_c 37 "\nStop services, sync files, free up memory"
if [ "$vendor" = "sigmastar" ]; then if [ "$vendor" = "sigmastar" ]; then
killall -q -3 majestic killall -q -3 majestic
sleep 1
else else
kill_process majestic kill_process majestic
fi fi
for proc in crond klogd ntpd rngd syslogd; do for proc in crond klogd ntpd rngd syslogd; do
kill_process $proc kill_process $proc
done done
sync sync
echo 3 > /proc/sys/vm/drop_caches echo 3 > /proc/sys/vm/drop_caches
echo_c 34 "\nUptime:" echo_c 34 "\nUptime:"
uptime uptime
echo_c 34 "\nMemory:" echo_c 34 "\nMemory:"
free free -h
echo_c 34 "\nProcesses:" echo_c 34 "\nProcesses:"
ps | grep -v '\[' ps | grep -v '\['
} }
@ -135,6 +131,14 @@ kill_process() {
echo ". OK" echo ". OK"
} }
set_progress() {
if [ "1" = "$silent_update" ]; then
busybox $@ | awk '{print NR, $1}'
else
busybox $@
fi
}
sync_time() { sync_time() {
echo_c 37 "\nSynchronizing time" echo_c 37 "\nSynchronizing time"
ntpd -Nnq ntpd -Nnq
@ -324,6 +328,11 @@ for i in "$@"; do
shift shift
;; ;;
-s)
silent_update=1
shift
;;
--url=*) --url=*)
url="${i#*=}" url="${i#*=}"
shift shift