@@ -37,6 +37,16 @@ error_msg() {
3737    exit  1
3838}
3939
40+ #  Get the partition name of the /boot file system
41+ get_boot_partition_name () {
42+     local  paths=" /boot" 
43+     local  partition_name
44+ 
45+     partition_name=$( df " ${paths} " |  awk ' NR==2 {print $1}' |  awk -F ' /' ' {print $3}' ) 
46+ 
47+     echo  " ${partition_name} " 
48+ }
49+ 
4050#  Get the partition name of the root file system
4151get_root_partition_name () {
4252    local  paths=(" /" " /overlay" " /rom" 
@@ -47,7 +57,6 @@ get_root_partition_name() {
4757        [[ -n  " ${partition_name} " &&  break 
4858    done 
4959
50-     [[ -z  " ${partition_name} " &&  error_msg " Cannot find the root partition!" 
5160    echo  " ${partition_name} " 
5261}
5362
@@ -91,6 +100,12 @@ init_var() {
91100    support_platform=(" allwinner" " rockchip" " amlogic" " qemu-aarch64" 
92101    [[ -n  " $( echo " ${support_platform[@]} " |  grep -w " ${PLATFORM} " ) " ||  error_msg " [ ${PLATFORM}  ] is not supported." 
93102
103+     #  Check and repair partition mount points
104+     [[ -z  " $( get_boot_partition_name) " ||  -z  " $( get_root_partition_name) " &&  {
105+         echo  -e " Partition mount point error, start repairing..." 
106+         openwrt-backup -g
107+     }
108+ 
94109    #  Set /boot/vmlinuz-* replication names for different SoCs
95110    MYBOOT_VMLINUZ=" $( ls -l /boot/* Image 2> /dev/null |  awk ' {print $9}' |  head -n 1) " 
96111    MYBOOT_VMLINUZ=" ${MYBOOT_VMLINUZ##*/ } " 
@@ -268,8 +283,8 @@ update_kernel() {
268283        rm -f /boot/uInitrd* 
269284    else 
270285        valid_files=" vmlinuz-${kernel_name}  uInitrd-${kernel_name}  config-${kernel_name}  System.map-${kernel_name} " 
271-         #  wxy-oect: MODEL_ID numbers r304 and r306 , require special handling of uInitrd
272-         [[ " ${MODEL_ID} " =~  ^(r304| r306)$ ]] ||  rm -f /boot/initrd.img* 
286+         #  wxy-oect: MODEL_ID numbers r304,r306  and w[0-9]{3} , require special handling of uInitrd
287+         [[ " ${MODEL_ID} " =~  ^(r304| r306| w[0-9]{3} )$ ]] ||  rm -f /boot/initrd.img* 
273288    fi 
274289    for  f  in  ${valid_files} ;  do  [[ -f  " /boot/${f} " ||  restore_kernel;  done 
275290
0 commit comments