diff --git a/luci-app-amlogic/Makefile b/luci-app-amlogic/Makefile index 39d86761f..69f9db4df 100644 --- a/luci-app-amlogic/Makefile +++ b/luci-app-amlogic/Makefile @@ -16,7 +16,7 @@ include $(TOPDIR)/rules.mk PKG_NAME:=luci-app-amlogic -PKG_VERSION:=3.1.217 +PKG_VERSION:=3.1.220 PKG_RELEASE:=1 PKG_LICENSE:=GPL-2.0 License diff --git a/luci-app-amlogic/root/usr/sbin/openwrt-backup b/luci-app-amlogic/root/usr/sbin/openwrt-backup index 0701ce929..80e88256e 100755 --- a/luci-app-amlogic/root/usr/sbin/openwrt-backup +++ b/luci-app-amlogic/root/usr/sbin/openwrt-backup @@ -16,7 +16,7 @@ backup_list_conf="/etc/amlogic_backup_list.conf" if [[ -s "${backup_list_conf}" ]]; then while IFS= read -r line; do BACKUP_LIST+="${line} " - done < "${backup_list_conf}" + done <"${backup_list_conf}" else BACKUP_LIST='./etc/AdGuardHome.yaml \ ./etc/amlogic_backup_list.conf \ @@ -118,9 +118,12 @@ backup() { restore() { # Find the partition where root is located ROOT_PTNAME=$(df / | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}') - if [ "${ROOT_PTNAME}" == "" ]; then - echo "Cannot find the partition corresponding to the root file system!" - exit 1 + if [[ -z "${ROOT_PTNAME}" ]]; then + ROOT_PTNAME="$(df /overlay | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')" + if [[ -z "${ROOT_PTNAME}" ]]; then + echo "Cannot find the partition corresponding to the root file system!" + exit 1 + fi fi # Find the disk where the partition is located, only supports mmcblk?p? sd?? hd?? vd?? and other formats @@ -164,9 +167,12 @@ restore() { gen_fstab() { # Find the partition where root is located ROOT_PTNAME=$(df / | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}') - if [ "${ROOT_PTNAME}" == "" ]; then - echo "Cannot find the partition corresponding to the root file system!" - exit 1 + if [[ -z "${ROOT_PTNAME}" ]]; then + ROOT_PTNAME="$(df /overlay | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')" + if [[ -z "${ROOT_PTNAME}" ]]; then + echo "Cannot find the partition corresponding to the root file system!" + exit 1 + fi fi # Find the disk where the partition is located, only supports mmcblk?p? sd?? hd?? vd?? and other formats @@ -186,9 +192,12 @@ gen_fstab() { esac ROOT_MSG=$(lsblk -l -o NAME,PATH,MOUNTPOINT,UUID,FSTYPE,LABEL | awk '$3 ~ /^\/$/ {print $0}') - if [ "$ROOT_MSG" == "" ]; then - echo "Get rootfs message failed!" - exit 1 + if [[ -z "${ROOT_MSG}" ]]; then + ROOT_MSG=$(lsblk -l -o NAME,PATH,MOUNTPOINT,UUID,FSTYPE,LABEL | awk '$3 ~ /^\/overlay$/ {print $0}') + if [[ -z "${ROOT_MSG}" ]]; then + echo "Get rootfs message failed!" + exit 1 + fi fi ROOT_NAME=$(echo $ROOT_MSG | awk '{print $1}') @@ -380,10 +389,13 @@ delete_snapshot() { migrate_snapshot() { cur_rootdev=$(lsblk -l -o NAME,MOUNTPOINT | awk '$2~/^\/$/ {print $1}') - if [ "${cur_rootdev}" == "" ]; then - echo "The disk device corresponding to the current rootfs cannot be found!" - read -p "Press [ enter ] to return." q - return + if [[ -z "${cur_rootdev}" ]]; then + cur_rootdev=$(lsblk -l -o NAME,MOUNTPOINT | awk '$2~/^\/overlay$/ {print $1}') + if [[ -z "${cur_rootdev}" ]]; then + echo "The disk device corresponding to the current rootfs cannot be found!" + read -p "Press [ enter ] to return." q + return + fi fi dev_pre=$(echo "${cur_rootdev}" | awk '{print substr($1, 1, length($1)-1);}') rootdev_idx=$(echo "${cur_rootdev}" | awk '{print substr($1, length($1),1);}') diff --git a/luci-app-amlogic/root/usr/sbin/openwrt-ddbr b/luci-app-amlogic/root/usr/sbin/openwrt-ddbr index 564aa10c1..f7ad8069f 100755 --- a/luci-app-amlogic/root/usr/sbin/openwrt-ddbr +++ b/luci-app-amlogic/root/usr/sbin/openwrt-ddbr @@ -53,6 +53,9 @@ do_checkemmc() { # Find the partition where root is located root_ptname="$(df / | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')" + if [[ -z "${root_ptname}" ]]; then + root_ptname="$(df /overlay | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')" + fi [[ -z "${root_ptname}" ]] && error_msg "Cannot find the partition corresponding to the root file system!" # Find the EMMC drive @@ -136,7 +139,7 @@ do_checkemmc echo -ne "${OPT} Do you want to backup or restore? Backup=(b) Restore=(r): " read br case "${br}" in - b | B | backup) do_backup ;; - r | R | restore) do_restore ;; - *) exit 0 ;; +b | B | backup) do_backup ;; +r | R | restore) do_restore ;; +*) exit 0 ;; esac diff --git a/luci-app-amlogic/root/usr/sbin/openwrt-install-amlogic b/luci-app-amlogic/root/usr/sbin/openwrt-install-amlogic index c87f05e90..4532dad7a 100755 --- a/luci-app-amlogic/root/usr/sbin/openwrt-install-amlogic +++ b/luci-app-amlogic/root/usr/sbin/openwrt-install-amlogic @@ -65,6 +65,9 @@ fi # Find the device name of / root_devname=$(df / | tail -n1 | awk '{print $1}' | awk -F '\/' '{print substr($3, 1, length($3)-2)}') +if [[ -z "${root_devname}" ]]; then + root_devname="$(df /overlay | tail -n1 | awk '{print $1}' | awk -F '\/' '{print substr($3, 1, length($3)-2)}')" +fi if lsblk -l | grep -E "^${root_devname}boot0" >/dev/null; then echo "you are running in emmc mode, please boot system with usb or tf card!" exit 1 diff --git a/luci-app-amlogic/root/usr/sbin/openwrt-kernel b/luci-app-amlogic/root/usr/sbin/openwrt-kernel index 1ad564757..0f792d59f 100755 --- a/luci-app-amlogic/root/usr/sbin/openwrt-kernel +++ b/luci-app-amlogic/root/usr/sbin/openwrt-kernel @@ -83,6 +83,9 @@ init_var() { # Find the partition where root is located ROOT_PTNAME="$(df / | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')" + if [[ -z "${ROOT_PTNAME}" ]]; then + ROOT_PTNAME="$(df /overlay | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')" + fi [[ -n "${ROOT_PTNAME}" ]] || error_msg "Cannot find the partition corresponding to the root file system!" # Find the disk where the partition is located, only supports mmcblk?p? sd?? hd?? vd?? and other formats diff --git a/luci-app-amlogic/root/usr/sbin/openwrt-update-allwinner b/luci-app-amlogic/root/usr/sbin/openwrt-update-allwinner index 4e98408b3..0dcc522b5 100755 --- a/luci-app-amlogic/root/usr/sbin/openwrt-update-allwinner +++ b/luci-app-amlogic/root/usr/sbin/openwrt-update-allwinner @@ -50,9 +50,12 @@ fi # Find the partition where root is located ROOT_PTNAME=$(df / | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}') -if [ "${ROOT_PTNAME}" == "" ]; then - echo "Cannot find the partition corresponding to the root file system!" - exit 1 +if [[ -z "${ROOT_PTNAME}" ]]; then + ROOT_PTNAME="$(df /overlay | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')" + if [[ -z "${ROOT_PTNAME}" ]]; then + echo "Cannot find the partition corresponding to the root file system!" + exit 1 + fi fi # Find the disk where the partition is located, only supports mmcblk?p? sd?? hd?? vd?? and other formats @@ -142,16 +145,19 @@ n* | N*) ;; esac -BOOT_NAME=$(echo $BOOT_PART_MSG | awk '{print $1}') -BOOT_PATH=$(echo $BOOT_PART_MSG | awk '{print $2}') -BOOT_UUID=$(echo $BOOT_PART_MSG | awk '{print $4}') +BOOT_NAME=$(echo ${BOOT_PART_MSG} | awk '{print $1}') +BOOT_PATH=$(echo ${BOOT_PART_MSG} | awk '{print $2}') +BOOT_UUID=$(echo ${BOOT_PART_MSG} | awk '{print $4}') # find root partition ROOT_PART_MSG=$(lsblk -l -o NAME,PATH,TYPE,UUID,MOUNTPOINT | awk '$3~/^part$/ && $5 ~ /^\/$/ {print $0}') -ROOT_NAME=$(echo $ROOT_PART_MSG | awk '{print $1}') -ROOT_PATH=$(echo $ROOT_PART_MSG | awk '{print $2}') -ROOT_UUID=$(echo $ROOT_PART_MSG | awk '{print $4}') -case $ROOT_NAME in +if [[ -z "${ROOT_PART_MSG}" ]]; then + ROOT_PART_MSG=$(lsblk -l -o NAME,PATH,TYPE,UUID,MOUNTPOINT | awk '$3~/^part$/ && $5 ~ /^\/overlay$/ {print $0}') +fi +ROOT_NAME=$(echo ${ROOT_PART_MSG} | awk '{print $1}') +ROOT_PATH=$(echo ${ROOT_PART_MSG} | awk '{print $2}') +ROOT_UUID=$(echo ${ROOT_PART_MSG} | awk '{print $4}') +case ${ROOT_NAME} in ${EMMC_NAME}${PARTITION_NAME}2) NEW_ROOT_NAME="${EMMC_NAME}${PARTITION_NAME}3" NEW_ROOT_LABEL="${LB_PRE}ROOTFS2" diff --git a/luci-app-amlogic/root/usr/sbin/openwrt-update-amlogic b/luci-app-amlogic/root/usr/sbin/openwrt-update-amlogic index e154c8909..679fd6005 100755 --- a/luci-app-amlogic/root/usr/sbin/openwrt-update-amlogic +++ b/luci-app-amlogic/root/usr/sbin/openwrt-update-amlogic @@ -33,9 +33,12 @@ fi # Find the partition where root is located ROOT_PTNAME=$(df / | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}') -if [ "${ROOT_PTNAME}" == "" ]; then - echo "Cannot find the partition corresponding to the root file system!" - exit 1 +if [[ -z "${ROOT_PTNAME}" ]]; then + ROOT_PTNAME="$(df /overlay | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')" + if [[ -z "${ROOT_PTNAME}" ]]; then + echo "Cannot find the partition corresponding to the root file system!" + exit 1 + fi fi # Find the disk where the partition is located, only supports mmcblk?p? sd?? hd?? vd?? and other formats @@ -151,11 +154,14 @@ esac # find root partition ROOT_PART_MSG=$(lsblk -l -o NAME,PATH,TYPE,UUID,MOUNTPOINT | awk '$3~/^part$/ && $5 ~ /^\/$/ {print $0}') +if [[ -z "${ROOT_PART_MSG}" ]]; then + ROOT_PART_MSG=$(lsblk -l -o NAME,PATH,TYPE,UUID,MOUNTPOINT | awk '$3~/^part$/ && $5 ~ /^\/overlay$/ {print $0}') +fi ROOT_NAME=$(echo ${ROOT_PART_MSG} | awk '{print $1}') ROOT_PATH=$(echo ${ROOT_PART_MSG} | awk '{print $2}') ROOT_UUID=$(echo ${ROOT_PART_MSG} | awk '{print $4}') -case $ROOT_NAME in +case ${ROOT_NAME} in ${EMMC_NAME}${PARTITION_NAME}2) NEW_ROOT_NAME="${EMMC_NAME}${PARTITION_NAME}3" NEW_ROOT_LABEL="${LB_PRE}ROOTFS2" diff --git a/luci-app-amlogic/root/usr/sbin/openwrt-update-kvm b/luci-app-amlogic/root/usr/sbin/openwrt-update-kvm index b3ce21b60..84035a64c 100755 --- a/luci-app-amlogic/root/usr/sbin/openwrt-update-kvm +++ b/luci-app-amlogic/root/usr/sbin/openwrt-update-kvm @@ -49,9 +49,12 @@ fi # Find the partition where root is located # vda2 or vda3 ROOT_PTNAME=$(df / | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}') -if [ "${ROOT_PTNAME}" == "" ]; then - echo "Cannot find the partition corresponding to the root file system!" - exit 1 +if [[ -z "${ROOT_PTNAME}" ]]; then + ROOT_PTNAME="$(df /overlay | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')" + if [[ -z "${ROOT_PTNAME}" ]]; then + echo "Cannot find the partition corresponding to the root file system!" + exit 1 + fi fi # Find the disk where the partition is located, only supports sd?? hd?? vd?? @@ -166,11 +169,14 @@ fi # find root partition ROOT_PART_MSG=$(lsblk -l -o NAME,PATH,TYPE,UUID,MOUNTPOINT | awk '$3~/^part$/ && $5 ~ /^\/$/ {print $0}') -ROOT_NAME=$(echo $ROOT_PART_MSG | awk '{print $1}') -ROOT_DEV=$(echo $ROOT_PART_MSG | awk '{print $2}') -ROOT_UUID=$(echo $ROOT_PART_MSG | awk '{print $4}') +if [[ -z "${ROOT_PART_MSG}" ]]; then + ROOT_PART_MSG=$(lsblk -l -o NAME,PATH,TYPE,UUID,MOUNTPOINT | awk '$3~/^part$/ && $5 ~ /^\/overlay$/ {print $0}') +fi +ROOT_NAME=$(echo ${ROOT_PART_MSG} | awk '{print $1}') +ROOT_DEV=$(echo ${ROOT_PART_MSG} | awk '{print $2}') +ROOT_UUID=$(echo ${ROOT_PART_MSG} | awk '{print $4}') -case $ROOT_NAME in +case ${ROOT_NAME} in ${DISK_NAME}${PART_PRESTR}2) NEW_ROOT_NAME="${DISK_NAME}${PART_PRESTR}3" NEW_ROOT_LABEL="${LABEL_PRESTR}ROOTFS2" diff --git a/luci-app-amlogic/root/usr/sbin/openwrt-update-rockchip b/luci-app-amlogic/root/usr/sbin/openwrt-update-rockchip index 29c090f65..efe5113e1 100755 --- a/luci-app-amlogic/root/usr/sbin/openwrt-update-rockchip +++ b/luci-app-amlogic/root/usr/sbin/openwrt-update-rockchip @@ -216,9 +216,12 @@ sleep 3 # Find the partition where root is located ROOT_PTNAME=$(df / | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}') -if [ "${ROOT_PTNAME}" == "" ]; then - echo "Cannot find the partition corresponding to the root file system!" - exit 1 +if [[ -z "${ROOT_PTNAME}" ]]; then + ROOT_PTNAME="$(df /overlay | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')" + if [[ -z "${ROOT_PTNAME}" ]]; then + echo "Cannot find the partition corresponding to the root file system!" + exit 1 + fi fi # Find the disk where the partition is located, only supports mmcblk?p? sd?? hd?? vd?? and other formats @@ -319,6 +322,9 @@ BOOT_UUID=$(echo ${BOOT_PART_MSG} | awk '{print $4}') # find root partition ROOT_PART_MSG=$(lsblk -l -o NAME,PATH,TYPE,UUID,MOUNTPOINT | awk '$3~/^part$/ && $5 ~ /^\/$/ {print $0}') +if [[ -z "${ROOT_PART_MSG}" ]]; then + ROOT_PART_MSG=$(lsblk -l -o NAME,PATH,TYPE,UUID,MOUNTPOINT | awk '$3~/^part$/ && $5 ~ /^\/overlay$/ {print $0}') +fi ROOT_NAME=$(echo ${ROOT_PART_MSG} | awk '{print $1}') ROOT_PATH=$(echo ${ROOT_PART_MSG} | awk '{print $2}') ROOT_UUID=$(echo ${ROOT_PART_MSG} | awk '{print $4}') diff --git a/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_firmware.sh b/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_firmware.sh index 17b87ab8c..f6eb55f6a 100755 --- a/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_firmware.sh +++ b/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_firmware.sh @@ -52,7 +52,10 @@ fi # Find the partition where root is located ROOT_PTNAME="$(df / | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')" if [[ -z "${ROOT_PTNAME}" ]]; then - tolog "Cannot find the partition corresponding to the root file system!" "1" + ROOT_PTNAME="$(df /overlay | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')" + if [[ -z "${ROOT_PTNAME}" ]]; then + tolog "Cannot find the partition corresponding to the root file system!" "1" + fi fi # Find the disk where the partition is located, only supports mmcblk?p? sd?? hd?? vd?? and other formats diff --git a/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_kernel.sh b/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_kernel.sh index 2f828618e..d67fd8ee5 100755 --- a/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_kernel.sh +++ b/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_kernel.sh @@ -51,7 +51,12 @@ fi # Find the partition where root is located ROOT_PTNAME="$(df / | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')" -[[ -n "${ROOT_PTNAME}" ]] || tolog "Cannot find the partition corresponding to the root file system!" "1" +if [[ -z "${ROOT_PTNAME}" ]]; then + ROOT_PTNAME="$(df /overlay | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')" + if [[ -z "${ROOT_PTNAME}" ]]; then + tolog "Cannot find the partition corresponding to the root file system!" "1" + fi +fi # Find the disk where the partition is located, only supports mmcblk?p? sd?? hd?? vd?? and other formats case "${ROOT_PTNAME}" in diff --git a/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_plugin.sh b/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_plugin.sh index ad849d364..475446d4e 100755 --- a/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_plugin.sh +++ b/luci-app-amlogic/root/usr/share/amlogic/amlogic_check_plugin.sh @@ -50,31 +50,6 @@ else echo -e "${this_running_log}" >${RUNNING_LOG} 2>/dev/null && sync fi -# Find the partition where root is located -ROOT_PTNAME="$(df / | tail -n1 | awk '{print $1}' | awk -F '/' '{print $3}')" -if [[ -z "${ROOT_PTNAME}" ]]; then - tolog "Cannot find the partition corresponding to the root file system!" "1" -fi - -# Find the disk where the partition is located, only supports mmcblk?p? sd?? hd?? vd?? and other formats -case "${ROOT_PTNAME}" in -mmcblk?p[1-4]) - EMMC_NAME="$(echo ${ROOT_PTNAME} | awk '{print substr($1, 1, length($1)-2)}')" - PARTITION_NAME="p" - ;; -[hsv]d[a-z][1-4]) - EMMC_NAME="$(echo ${ROOT_PTNAME} | awk '{print substr($1, 1, length($1)-1)}')" - PARTITION_NAME="" - ;; -nvme?n?p[1-4]) - EMMC_NAME="$(echo ${ROOT_PTNAME} | awk '{print substr($1, 1, length($1)-2)}')" - PARTITION_NAME="p" - ;; -*) - tolog "Unable to recognize the disk type of ${ROOT_PTNAME}!" "1" - ;; -esac - # Check release file if [[ -s "${AMLOGIC_SOC_FILE}" ]]; then source "${AMLOGIC_SOC_FILE}" 2>/dev/null @@ -87,7 +62,7 @@ if [[ -z "${PLATFORM}" || -z "$(echo "${support_platform[@]}" | grep -w "${PLATF tolog "Missing [ PLATFORM ] value in ${AMLOGIC_SOC_FILE} file." "1" fi -tolog "PLATFORM: [ ${PLATFORM} ], SOC: [ ${SOC} ], Use in [ ${EMMC_NAME} ]" +tolog "PLATFORM: [ ${PLATFORM} ], SOC: [ ${SOC} ]" sleep 2 # 01. Query local version information