diff --git a/usb2jffs/usb2jffs/init.d/M01usb2jffs.sh b/usb2jffs/usb2jffs/init.d/M01usb2jffs.sh index 73c47686..a7e67c7a 100755 --- a/usb2jffs/usb2jffs/init.d/M01usb2jffs.sh +++ b/usb2jffs/usb2jffs/init.d/M01usb2jffs.sh @@ -135,7 +135,7 @@ JFFS2USB(){ # 防止用户在路由器开机状态,并且已经替换了JFFS为USB的情况下,再插入一个有.koolshare_jffs目录的USB储存设备导致重复挂载 get_current_jffs_device local mounted_nu=$(mount | /bin/grep "${jffs_device}" | grep -E "/tmp/mnt/|/jffs"|/bin/grep -c "/dev/s") - if [ "${mounted_nu}" == "2" ]; then + if [ "${mounted_nu}" -ge "2" ]; then # echo_date "USB2JFFS:检测到你的USB磁盘${jffs_device}已经挂载在/jffs上了,跳过!" return 1 fi @@ -290,7 +290,7 @@ JFFS2USB(){ nvram commit # 把原来的jffs分区挂载到cifs - if [ "${LINUX_VER}" == "419" -o "${LINUX_VER}" == "54" ];then + if [ "${LINUX_VER}" == "44" -o "${LINUX_VER}" == "419" -o "${LINUX_VER}" == "54" ];then mount -t ubifs ${mtd_disk} /cifs2 else mount -t jffs2 -o rw,noatime ${mtd_disk} /cifs2 diff --git a/usb2jffs/usb2jffs/scripts/usb2jffs_config.sh b/usb2jffs/usb2jffs/scripts/usb2jffs_config.sh index 410548e7..9ca7e4ad 100755 --- a/usb2jffs/usb2jffs/scripts/usb2jffs_config.sh +++ b/usb2jffs/usb2jffs/scripts/usb2jffs_config.sh @@ -303,7 +303,8 @@ start_usb2jffs(){ # 把原来的jffs分区挂载到cifs2 echo_date "将${mtd_disk}挂载在/cifs2" - if [ "${LINUX_VER}" == "419" -o "${LINUX_VER}" == "54" ];then + umount -l /cifs2 2>/dev/null + if [ "${LINUX_VER}" == "44" -o "${LINUX_VER}" == "419" -o "${LINUX_VER}" == "54" ];then mount -t ubifs ${mtd_disk} /cifs2 else mount -t jffs2 -o rw,noatime ${mtd_disk} /cifs2 @@ -320,7 +321,7 @@ start_usb2jffs(){ else echo_date "USB型JFFS挂载失败!!" echo_date "尝试恢复原始挂载方式!" - if [ "${LINUX_VER}" == "419" -o "${LINUX_VER}" == "54" ];then + if [ "${LINUX_VER}" == "44" -o "${LINUX_VER}" == "419" -o "${LINUX_VER}" == "54" ];then mount -t ubifs ${mtd_disk} /jffs else mount -t jffs2 -o rw,noatime ${mtd_disk} /jffs @@ -343,7 +344,7 @@ stop_usb2jffs(){ # 检测是否有USB磁盘挂载在/jffs上 get_current_jffs_device local mounted_nu=$(mount | /bin/grep "${jffs_device}" | grep -E "/tmp/mnt/|/jffs"|/bin/grep -c "/dev/s") - if [ "$mounted_nu" == "2" ]; then + if [ "$mounted_nu" -ge "2" ]; then local usb_path=$(mount | /bin/grep "${jffs_device}" | /bin/grep "/tmp/mnt/" | awk '{print $3}') echo_date "检测到USB磁盘的${usb_path}/.koolshare_jffs挂载在/jffs上" else @@ -401,7 +402,7 @@ stop_usb2jffs(){ if [ "$?" == "0" ]; then echo_date "/jffs卸载成功..." echo_date "将文件系统${mtd_disk}挂载到jffs分区..." - if [ "${LINUX_VER}" == "419" -o "${LINUX_VER}" == "54" ];then + if [ "${LINUX_VER}" == "44" -o "${LINUX_VER}" == "419" -o "${LINUX_VER}" == "54" ];then mount -t ubifs ${mtd_disk} /jffs else mount -t jffs2 -o rw,noatime ${mtd_disk} /jffs @@ -444,7 +445,7 @@ sync_usb_mtd(){ # 检测是否有USB磁盘挂载在/jffs上 get_current_jffs_device local mounted_nu=$(mount | /bin/grep "${jffs_device}" | grep -E "/tmp/mnt/|/jffs"|/bin/grep -c "/dev/s") - if [ "${mounted_nu}" == "2" ]; then + if [ "${mounted_nu}" -ge "2" ]; then local usb_path=$(mount | /bin/grep "${jffs_device}" | /bin/grep "/tmp/mnt/" | awk '{print $3}') #echo_date "检测到USB磁盘的${usb_path}/.koolshare_jffs挂载在/jffs上" else @@ -591,7 +592,7 @@ del_sync_job(){ set_sync_job(){ get_current_jffs_device local mounted_nu=$(mount | /bin/grep "${jffs_device}" | grep -E "/tmp/mnt/|/jffs"|/bin/grep -c "/dev/s") - if [ "${mounted_nu}" == "2" ]; then + if [ "${mounted_nu}" -ge "2" ]; then local usb_path=$(mount | /bin/grep "${jffs_device}" | /bin/grep "/tmp/mnt/" | awk '{print $3}') #echo_date "检测到USB磁盘的${usb_path}/.koolshare_jffs挂载在/jffs上" else @@ -634,7 +635,7 @@ set_sync_job(){ set_stop_sync(){ get_current_jffs_device local mounted_nu=$(mount | /bin/grep "${jffs_device}" | grep -E "/tmp/mnt/|/jffs"|/bin/grep -c "/dev/s") - if [ "${mounted_nu}" == "2" ]; then + if [ "${mounted_nu}" -ge "2" ]; then local usb_path=$(mount | /bin/grep "${jffs_device}" | /bin/grep "/tmp/mnt/" | awk '{print $3}') #echo_date "检测到USB磁盘的${usb_path}/.koolshare_jffs挂载在/jffs上" else @@ -664,7 +665,7 @@ make_backup(){ fi local mounted_nu=$(mount | /bin/grep "${jffs_device}" | grep -E "/tmp/mnt/|/jffs"|/bin/grep -c "/dev/s") - if [ "${mounted_nu}" != "2" ]; then + if [ "${mounted_nu}" -lt "2" ]; then echo_date "错误!没有检测到USB磁盘挂载在/jffs,无法备份!" echo_date "请先挂载USB磁盘到/jffs后再使用本功能!" return 1 @@ -744,7 +745,7 @@ restore_backup(){ fi local mounted_nu=$(mount | /bin/grep "${jffs_device}" | grep -E "/tmp/mnt/|/jffs"|/bin/grep -c "/dev/s") - if [ "${mounted_nu}" != "2" ]; then + if [ "${mounted_nu}" -lt "2" ]; then echo_date "错误!没有检测到USB磁盘挂载在/jffs,无法恢复!" echo_date "请先挂载USB磁盘到/jffs后再使用本功能!" return 1 diff --git a/usb2jffs/usb2jffs/scripts/usb2jffs_mount_status.sh b/usb2jffs/usb2jffs/scripts/usb2jffs_mount_status.sh index aab8c584..d820c572 100755 --- a/usb2jffs/usb2jffs/scripts/usb2jffs_mount_status.sh +++ b/usb2jffs/usb2jffs/scripts/usb2jffs_mount_status.sh @@ -29,8 +29,8 @@ get_current_jffs_device(){ start(){ get_current_jffs_device local mounted_nu=$(mount | /bin/grep "${jffs_device}" | grep -E "/tmp/mnt/|/jffs" | /bin/grep -v "DockRootData" | /bin/grep -c "/dev/s") - if [ "${mounted_nu}" -eq "2" ]; then - local usb_path=$(mount | /bin/grep "${jffs_device}" | /bin/grep "/tmp/mnt/" | /bin/grep -v "DockRootData" | awk '{print $3}') + if [ "${mounted_nu}" -ge "2" ]; then + local usb_path=$(mount | /bin/grep "${jffs_device}" | /bin/grep "/tmp/mnt/" | /bin/grep -v "DockRootData" | /bin/grep -v "asusware" | awk '{print $3}' | head -n1) http_response "$(get_current_jffs_status)@@jffs挂载路径:${usb_path}/.koolshare_jffs → /jffs@@1" else if [ -d "${usb2jffs_mount_path}/.koolshare_jffs" ];then