yangh 发表于 2005-4-29 16:16:17

哥哥,人家 atfa 要 patch 啦! initrd..

版主 wjping119 要的 initrd_create 中加 cp936 的 patch .


diff -Nur initrd_create-5.0.12.orig/liblinuxlive initrd_create-5.0.12/liblinuxlive
--- initrd_create-5.0.12.orig/liblinuxlive      2005-04-29 14:57:12.000000000 +0800
+++ initrd_create-5.0.12/liblinuxlive   2005-04-29 15:55:37.009248544 +0800
@@ -397,12 +397,27 @@
       echo "$DEVICE $MOUNTDIR iso9660 noauto,users 0 0" >>$FSTAB
    done

-   list_partition_devices | while read DEVICE; do
-      MOUNTDIR="/mnt/`basename $DEVICE`"
+   fdisk_list="/tmp/fdisk_list"      # Just let it be. rm -rf is painful.:-(
+   :> $fdisk_list
+   list_disk_devices | while read disk; do
+       fdisk -l $disk | grep ^/dev >> $fdisk_list
+   done
+
+   # Exclude disk/dev/hda, /dev/hdc...etc, partition only
+   list_partition_devices | grep -v "[a-z]$" | while read DEVICE; do
+      part=`basename $DEVICE`
+      MOUNTDIR="/mnt/$part"
       mount_device $DEVICE $1/$MOUNTDIR
       umount $1/$MOUNTDIR 2>/dev/null
       if [ $? -eq 0 ]; then # add to fstab only if mount+umount is OK
-         echo "$DEVICE $MOUNTDIR auto auto,users,suid,dev,exec 0 0" >>$FSTAB
+         wopt=""
+         for type in NTFS FAT; do
+         if grep $DEVICE $fdisk_list | grep "$type" > /dev/null 2>&1; then
+               wopt=",iocharset=cp936,codepage=cp936"
+               break
+            fi
+         done
+         echo "$DEVICE $MOUNTDIR auto auto,users,suid,dev,exec$wopt 0 0" >>$FSTAB
       else # remove empty directory
          rmdir $1/$MOUNTDIR 2>/dev/null
       fi

wjping119 发表于 2005-5-7 19:18:35

是的
不过因为脚本的更新也很快,想到了另一个好的办法
就是做一个开机运行的脚本rc.local
这样就不用每次都patch制作脚本了
差不多已经完成 :mrgreen:

atfa 发表于 2005-5-23 00:20:30

rc.local的想法真好

我当时怎么就忽略了呢

呵呵
页: [1]
查看完整版本: 哥哥,人家 atfa 要 patch 啦! initrd..