sysupgrade: adjust get_flash_type function

pull/753/head
viktorxda 2023-04-28 17:15:53 +02:00
parent 547ab7fbc7
commit 0544704257
1 changed files with 8 additions and 9 deletions

View File

@ -1,9 +1,9 @@
#!/bin/sh
#
# OpenIPC.org | v.20221118
# OpenIPC.org | v.20230503
#
scr_version=1.0.16
scr_version=1.0.17
args=" $@"
@ -65,7 +65,7 @@ do_update_rootfs() {
check_soc "$(head -1 ${y}/etc/hostname | cut -d- -f2)"
compare_versions "$system_version" "$(get_system_version "$y")" && exit_update=1
umount "$y" && rm -rf "$y" && losetup -d "$loop"
[ "$exit_update" ] && return 0
[ "1" = "$exit_update" ] && return 0
else
die "Unable to mount $y!"
fi
@ -77,15 +77,14 @@ do_update_rootfs() {
do_wipe_overlay() {
echo_c 33 "\nOverlayFS"
echo "Erase overlay partition"
[ $(ipcinfo -F) = "nand" ] || jffs2="-j"
[ $(get_flash_type mtd) = "nand" ] || jffs2="-j"
flash_eraseall $jffs2 "$(get_device "rootfs_data")"
}
download_firmware() {
echo_c 33 "\nFirmware"
osr=$(get_system_build)
ftype=$(ipcinfo -F 2>/dev/null)
[ ${#ftype} -ge 4 ] && ftype=$(get_flash_type)
ftype=$(get_flash_type)
build="${soc}-${ftype}-${osr}"
[ -z "$url" ] && url="https://github.com/OpenIPC/firmware/releases/download/latest/openipc.${build}.tgz"
echo "Download from $url"
@ -206,10 +205,10 @@ get_system_build() {
grep "BUILD_OPTION" "/etc/os-release" | head -1 | cut -d= -f2
}
# This flash type detection is deprecated and will be removed in the next updates...
get_flash_type() {
has_nand=$(fw_printenv bootcmd | grep nand | wc -l)
[ "1" = "$has_nand" ] && echo "nand" || echo "nor"
local x=$(ipcinfo -F)
[ -z "$1" ] && [ "$x" = "nand" ] && $(fw_printenv bootcmd | grep -qv nand) && x=nor
echo "$x"
}
print_sysinfo() {