mirror of https://github.com/OpenIPC/firmware.git
sysupgrade: adjust get_flash_type function
parent
547ab7fbc7
commit
0544704257
|
@ -1,9 +1,9 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
#
|
#
|
||||||
# OpenIPC.org | v.20221118
|
# OpenIPC.org | v.20230503
|
||||||
#
|
#
|
||||||
|
|
||||||
scr_version=1.0.16
|
scr_version=1.0.17
|
||||||
|
|
||||||
args=" $@"
|
args=" $@"
|
||||||
|
|
||||||
|
@ -65,7 +65,7 @@ do_update_rootfs() {
|
||||||
check_soc "$(head -1 ${y}/etc/hostname | cut -d- -f2)"
|
check_soc "$(head -1 ${y}/etc/hostname | cut -d- -f2)"
|
||||||
compare_versions "$system_version" "$(get_system_version "$y")" && exit_update=1
|
compare_versions "$system_version" "$(get_system_version "$y")" && exit_update=1
|
||||||
umount "$y" && rm -rf "$y" && losetup -d "$loop"
|
umount "$y" && rm -rf "$y" && losetup -d "$loop"
|
||||||
[ "$exit_update" ] && return 0
|
[ "1" = "$exit_update" ] && return 0
|
||||||
else
|
else
|
||||||
die "Unable to mount $y!"
|
die "Unable to mount $y!"
|
||||||
fi
|
fi
|
||||||
|
@ -77,15 +77,14 @@ do_update_rootfs() {
|
||||||
do_wipe_overlay() {
|
do_wipe_overlay() {
|
||||||
echo_c 33 "\nOverlayFS"
|
echo_c 33 "\nOverlayFS"
|
||||||
echo "Erase overlay partition"
|
echo "Erase overlay partition"
|
||||||
[ $(ipcinfo -F) = "nand" ] || jffs2="-j"
|
[ $(get_flash_type mtd) = "nand" ] || jffs2="-j"
|
||||||
flash_eraseall $jffs2 "$(get_device "rootfs_data")"
|
flash_eraseall $jffs2 "$(get_device "rootfs_data")"
|
||||||
}
|
}
|
||||||
|
|
||||||
download_firmware() {
|
download_firmware() {
|
||||||
echo_c 33 "\nFirmware"
|
echo_c 33 "\nFirmware"
|
||||||
osr=$(get_system_build)
|
osr=$(get_system_build)
|
||||||
ftype=$(ipcinfo -F 2>/dev/null)
|
ftype=$(get_flash_type)
|
||||||
[ ${#ftype} -ge 4 ] && ftype=$(get_flash_type)
|
|
||||||
build="${soc}-${ftype}-${osr}"
|
build="${soc}-${ftype}-${osr}"
|
||||||
[ -z "$url" ] && url="https://github.com/OpenIPC/firmware/releases/download/latest/openipc.${build}.tgz"
|
[ -z "$url" ] && url="https://github.com/OpenIPC/firmware/releases/download/latest/openipc.${build}.tgz"
|
||||||
echo "Download from $url"
|
echo "Download from $url"
|
||||||
|
@ -206,10 +205,10 @@ get_system_build() {
|
||||||
grep "BUILD_OPTION" "/etc/os-release" | head -1 | cut -d= -f2
|
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() {
|
get_flash_type() {
|
||||||
has_nand=$(fw_printenv bootcmd | grep nand | wc -l)
|
local x=$(ipcinfo -F)
|
||||||
[ "1" = "$has_nand" ] && echo "nand" || echo "nor"
|
[ -z "$1" ] && [ "$x" = "nand" ] && $(fw_printenv bootcmd | grep -qv nand) && x=nor
|
||||||
|
echo "$x"
|
||||||
}
|
}
|
||||||
|
|
||||||
print_sysinfo() {
|
print_sysinfo() {
|
||||||
|
|
Loading…
Reference in New Issue