Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions usb2jffs/usb2jffs/init.d/M01usb2jffs.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
19 changes: 10 additions & 9 deletions usb2jffs/usb2jffs/scripts/usb2jffs_config.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
4 changes: 2 additions & 2 deletions usb2jffs/usb2jffs/scripts/usb2jffs_mount_status.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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挂载路径:<em>${usb_path}/.koolshare_jffs → /jffs</em>@@1"
else
if [ -d "${usb2jffs_mount_path}/.koolshare_jffs" ];then
Expand Down