diff --git a/iopsys-ramips/base-files/lib/upgrade/iopsys.sh b/iopsys-ramips/base-files/lib/upgrade/iopsys.sh index fe2cee8fb336efabf06289d206d9723ac8c0a0f4..dc665d8edb0af9256bc3c1f6a903221a12b939bd 100644 --- a/iopsys-ramips/base-files/lib/upgrade/iopsys.sh +++ b/iopsys-ramips/base-files/lib/upgrade/iopsys.sh @@ -22,7 +22,7 @@ log() { } #-------------------------------------------------------------- -is_inteno_image() { +is_iop_image() { local magic [ -n "$1" ] || return 1 @@ -39,7 +39,7 @@ is_inteno_image() { #-------------------------------------------------------------- get_image_type() { - if is_inteno_image "$1"; then + if is_iop_image "$1"; then echo "INTENO" else echo "UNKNOWN" @@ -49,7 +49,7 @@ get_image_type() { #-------------------------------------------------------------- -get_inteno_tag_val() { +get_iop_tag_val() { local from="$1" local tag="$2" local val @@ -64,21 +64,21 @@ get_inteno_tag_val() { #-------------------------------------------------------------- get_image_model_name() { - get_inteno_tag_val $1 model + get_iop_tag_val $1 model } #-------------------------------------------------------------- get_image_customer() { - get_inteno_tag_val $1 customer + get_iop_tag_val $1 customer } #-------------------------------------------------------------- get_image_chip_id() { - get_inteno_tag_val $1 chip + get_iop_tag_val $1 chip } @@ -91,7 +91,7 @@ get_section_size_v3() { local sec="$2" # Named section local sz - sz="$(get_inteno_tag_val $from $sec)" + sz="$(get_iop_tag_val $from $sec)" [ -z "$sz" ] && sz=0 echo -n $sz } @@ -143,8 +143,8 @@ get_section_offset_v5() { local from="$1" # Image file local sec="$2" # Named section - ofs="$(get_inteno_tag_val $from ${sec}ofs)" - filesize="$(get_inteno_tag_val $from size)" + ofs="$(get_iop_tag_val $from ${sec}ofs)" + filesize="$(get_iop_tag_val $from size)" [ -n "$ofs" ] || ofs=0 [ -n "$filesize" ] || filesize=0 [ $ofs -ge 1024 -a $ofs -lt $filesize ] || ofs=0 # Verify tag is less than file size @@ -159,7 +159,7 @@ get_section_size() { local from="$1" # Image file local ver - ver=$(get_inteno_tag_val "$from" version) + ver=$(get_iop_tag_val "$from" version) if [ $ver -ge 3 -a $ver -le 8 ]; then # Version 4 differs from 3 in having a larger cfe. get_section_size_v3 "$@" || return # Version 5 appear in .y3 and have section offsets. else @@ -175,7 +175,7 @@ get_section_offset() { local from="$1" # Image file local ver - ver=$(get_inteno_tag_val "$from" version) + ver=$(get_iop_tag_val "$from" version) if [ $ver -ge 3 -a $ver -le 4 ]; then # Version 4 differs from 3 in having a larger cfe. get_section_offset_v3 "$@" || return elif [ $ver -ge 5 -a $ver -le 8 ]; then # Version 5 appear in .y3 and have section offsets. @@ -329,7 +329,7 @@ get_bootbank() { check_crc() { local from="$1" - case $(get_inteno_tag_val "$from" integrity) in + case $(get_iop_tag_val "$from" integrity) in MD5SUM) tail -c 32 "$from" >"${from}-$$.md5" echo " *-" >>"${from}-$$.md5" @@ -407,7 +407,7 @@ iopsys_check_image() { ;; esac - is_inteno_image "$from" || { + is_iop_image "$from" || { echo "Header magic failed" return 1 } @@ -442,12 +442,12 @@ iopsys_check_image() { k_sz=$(get_section_size $from vmlinux) || return 1 ubi_sz=$(get_section_size $from ubi) || return 1 ubifs_sz=$(get_section_size $from ubifs) || return 1 - ver=$(get_inteno_tag_val "$from" version) || return 1 + ver=$(get_iop_tag_val "$from" version) || return 1 if [ $ver -eq 3 ]; then echo "y2 image unsupported" return 1 fi - filesize=$(get_inteno_tag_val "$from" size) || return 1 + filesize=$(get_iop_tag_val "$from" size) || return 1 if [ $ver -le 4 -a $cfe_sz -eq 0 -a $k_sz -eq 0 -a $ubi_sz -eq 0 \ -a $ubifs_sz -eq 0 ]; then echo "Unexpected image file contents, upgrade aborted!" @@ -615,7 +615,7 @@ perhaps_image_self_upgrade() { # the image do a self upgrade.) Instead we try a best effort # approach. Are there SOME backwards compatible parts we # recognize? Then try to satisfy with those parts only. - is_inteno_image "$from" || return 0 + is_iop_image "$from" || return 0 head -c 1024 "$from" | strings | \ awk '$1 ~ "^version" && $2 ~ "[[:digit:]]+" { if($2 < 7) { exit 1; }; # .y3 version 7 at least.