wjping119 发表于 2005-5-18 17:03:13

To BOoRFGOnZ, rc.local 脚本测试这里


#!/bin/sh
hd_vfat=`fdisk -l | awk '/FAT32/{print $1}'`
hd_ntfs=`fdisk -l | awk '/NTFS/{print $1}'`

i=0
for file in $hd_vfat
   do
      vfat_hd[i]=$file
      let i="$i+1"
   done
j=0
for file in $hd_ntfs
   do
      ntfs_hd[i]=$file
      let j="$j+1"
   done

I=0
while [ $I -lt $i ]
   do
      umount "${vfat_hd[$I]}"
      vfat_mnt=`echo ${vfat_hd[$I]} | awk -F/ '{print $3}' `
      mount -t vfat -o iocharset=cp936 "${vfat_hd[$I]}" "/mnt/$vfat_mnt"
      let I="$I+1"
   done
J=0
while [ $J -lt $j ]
   do
      umount "${ntfs_hd[$J]}"
      ntfs_mnt=`echo ${ntfs_hd[$J]} | awk -F/ '{print $3}' `
      mount -t ntfs -o iocharset=cp936 "${ntfs_hd[$J]}" "/mnt/$ntfs_mnt"
      let J="$J+1"
   done

很奇怪这个脚本对fat分区支持的很好,可是对ntfs似乎没有起到什么作用,(如果手动挂载加上cp936是没有问题的) 运行时显示有如下信息
Cannot umount ""

mount: wrong fs type, bad option, bad superblock on ,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tailor so

Cannot umount ""

mount: wrong fs type, bad option, bad superblock on ,
       missing codepage or other error
       In some cases useful info is found in syslog - try
       dmesg | tailor so

对了,还要增加对FAT格式的支持,还有人在用,这个看上去很简单

BOoRFGOnZ 发表于 2005-5-18 21:06:32

就怕ntfs中建立的文件名称是utf8的

BOoRFGOnZ 发表于 2005-5-18 21:07:22

那样的话 要更改locale了

BOoRFGOnZ 发表于 2005-5-18 21:12:25

我还是不明白
fanx是怎么自动生成fstab的
在内存中放着吗>?

wjping119 发表于 2005-5-18 22:20:31

我想应该是在内存中呢
但是修改也可以在/etc/fstab生效
FanX中locale用的是gbk,我可以用iocharset=zh_CN.gbk试试是否与utf8有关系.ntfs文件系统在启动时也显示出错信息,不过看样子可以忽略
但是用 mount -o iocharset=cp936 这样挂载ntfs也没有问题的,这应该算是gb2312的级别吧

wjping119 发表于 2005-5-18 22:23:07

我有大把的时间,希望明天能连续测试
脚本我能看懂是怎么实现的了,不过要写要修改还得靠你 :mrgreen:

BOoRFGOnZ 发表于 2005-5-19 13:14:03


下午还是晚上? :mrgreen:

BOoRFGOnZ 发表于 2005-5-19 13:26:34

怎么我在的时候
你不在。。。

BOoRFGOnZ 发表于 2005-5-19 19:06:35

我在啊
你去那里了
把 fanx的fstab的加载 与 没有加载 的分别给我一份

BOoRFGOnZ 发表于 2005-5-19 19:39:28

我等啊等啊 等啊等

wjping119 发表于 2005-5-19 21:41:55

呵呵
我基本上都在的啊
进行了两天的配置,所有的东西都弄完了,脚本调试好后就可以发布了
什么加载和不加载?

wjping119 发表于 2005-5-19 21:45:29

总之我觉得还是脚本有点问题
最原始的系统中,umount /mnt/hda5
然后 mount -o iocharset=cp936 /dev/hda5 /mnt/hda5
这样一点问题都没有,不管是fat还是ntfs都好使的.

BOoRFGOnZ 发表于 2005-5-19 21:52:38

那你再给我一次fanx的fstab 和 fdisk -l的显示吧..我看看错在那里
要不你用 bash -x 脚本file 看看是哪个地方错的 :-D

BOoRFGOnZ 发表于 2005-5-19 21:55:03

#!/bin/sh
hd_vfat=`fdisk -l | awk '/FAT32/{print $1}'`
hd_ntfs=`fdisk -l | awk '/NTFS/{print $1}'`

i=0
for file in $hd_vfat
   do
      vfat_hd[i]=$file
      let i="$i+1"
   done
j=0
for file in $hd_ntfs
   do
      ntfs_hd[j]=$file
      let j="$j+1"
   done

I=0
while [ $I -lt $i ]
   do
      umount "${vfat_hd[$I]}"
      vfat_mnt=`echo ${vfat_hd[$I]} | awk -F/ '{print $3}' `
      mount -t vfat -o iocharset=cp936 "${vfat_hd[$I]}" "/mnt/$vfat_mnt"
      let I="$I+1"
   done
J=0
while [ $J -lt $j ]
   do
      umount "${ntfs_hd[$J]}"
      ntfs_mnt=`echo ${ntfs_hd[$J]} | awk -F/ '{print $3}' `
      mount -t ntfs -o iocharset=cp936 "${ntfs_hd[$J]}" "/mnt/$ntfs_mnt"
      let J="$J+1"
   done

知道错那了有的地方搞错i和j了
粗心 粗心:oops:

wjping119 发表于 2005-5-19 21:56:41

好我试试,先下一下,虚拟机实在是太慢了
页: [1] 2 3
查看完整版本: To BOoRFGOnZ, rc.local 脚本测试这里