QQ登录

只需一步,快速开始

 找回密码
 注册

QQ登录

只需一步,快速开始

楼主: MichaelBibby

关于分区自动挂载并在桌面建立相关图标

[复制链接]
发表于 2004-10-27 15:52:26 | 显示全部楼层
也许这个是gnome的版本问题。我还没2.8版本的。

不过,如果是文本文件,一切都好办啊。您说呢?

找找说明,有没有解释[Desktop Entry] 的
回复

使用道具 举报

 楼主| 发表于 2004-10-27 15:56:18 | 显示全部楼层
嗯,searching ...
回复

使用道具 举报

 楼主| 发表于 2004-10-27 16:40:52 | 显示全部楼层
[quote:2b5b1dc7af="aaaa"]也许这个是gnome的版本问题。我还没2.8版本的。[/quote]
2.6的gnome也有这个文件的,看这里就知道了,6月份时发的贴,那时候2.8还没出来呢:
http://www.linuxfans.org/nuke/modules.php?name=Forums&file=viewtopic&t=71988
回复

使用道具 举报

发表于 2004-10-28 20:50:38 | 显示全部楼层
老版本的红旗的automount脚本,也发上来让大家分析:


包括两部分,一个是/etc/rc.d/init.d/WinAutoMnt:
[code:1]
#!/bin/sh
#
# WinAutoMnt        mount the windows partitions automatically
#
# chkconfig:        345 17 05
# description:        mount the windows partitions automatically

# source function library
. /etc/rc.d/init.d/functions

WINAUTOMNTCMD=/sbin/WinAutoMnt.sh
UNMOUNTCMD=/bin/umount
if [ ! -x $UNMOUNTCMD -a -x /sbin/umount ]; then
        UNMOUNTCMD=/sbin/umount
fi

if [ -x $WINAUTOMNTCMD ]; then
        case "$1" in
                  start)
                        # mount the windows partitions automatically
                        rmdir /mnt/win_*
                        rm -f /root/win_*
                        /bin/sh $WINAUTOMNTCMD >/dev/null 2>&1
                        ;;
                stop)
                        if [ -x $UNMOUNTCMD ]; then
                                $UNMOUNTCMD /mnt/win_* >/dev/null 2>&1
                        else
                                umount /mnt/win_* >/dev/null 2>&1
                        fi
                        # delete all the win mount points
                        rmdir /mnt/win_*
                        rm -f /root/win_*
                        ;;
                restart|reload)
                        /bin/sh $0 stop
                        /bin/sh $0 start
                        ;;
                  *)
                echo "Usage: $0 {start|stop|restart}"
                exit 1
        esac
fi
[/code:1]

另一个是/sbin/WinAutoMnt.sh

[code:1]
#!/bin/sh

# mount path : mount in /bin/mount, /usr/bin/mount
if [ -x /bin/mount ]
then
        MOUNT=/bin/mount
elif [ -x /usr/bin/mount ]
then
        MOUNT=/usr/bin/mount
fi
if [ ! -x $MOUNT ]
then
        echo "mount command cann't be found, exit here!"
        exit 1
fi

# mount parameters
# fdisk path
if [ -x /sbin/fdisk ]
then
        FDISK=/sbin/fdisk
elif [ -x /usr/sbin/fdisk ]
then
        FDISK=/usr/sbin/fdisk
fi
if [ ! -x $FDISK ]
then
        echo        "fdisk command cann't be found, exit here!"
        exit 1
fi



# if this have been done, exit with 1
if [ -d /mnt/win_C ]; then
        if [ `ls /mnt/win_C | wc | awk '{printf $1}'` != "0" ] ; then
                echo         "windows partitions have been mounted!"
                exit 1
        fi
fi

# delete all the mounted points here
rmdir /mnt/win_* >/dev/null 2>&1

# mount location
MntLoc[0]=C ; MntLoc[1]=D ; MntLoc[2]=E ; MntLoc[3]=F ;
MntLoc[4]=G ; MntLoc[5]=H ; MntLoc[6]=I ; MntLoc[7]=J ;
MntLoc[8]=K ; MntLoc[9]=L ; MntLoc[10]=M ; MntLoc[11]=N ;
MntLoc[12]=O ; MntLoc[13]=P ; MntLoc[14]=Q ; MntLoc[15]=R ;
MntLoc[16]=S ; MntLoc[17]=T ; MntLoc[18]=U ; MntLoc[19]=V ;
MntLoc[20]=W ; MntLoc[21]=X ; MntLoc[22]=Y ; MntLoc[23]=Z ;

# get all the hard disk partitions we need to think over:
# ntfs, fat16, fat32 etc
# get all  the partitions first, then filter out the informations
# about comments. The next thing is to get all the
# NTFS, FAT16, FAT32, and Extended.
# Extended Key word for dividing Primary and Extended partitions.
# delete the * , which mark the bootable partitions
# get only the partitions and partitions mark.

# get all the harddisk in /dev/hd?
PARTITIONS=""                   # partitions string
if [ ! -x /bin/dmesg ]; then
        echo "/bin/dmesg is not exit!"
        exit 1
fi
for HDDEV in `/bin/dmesg | grep "^hd.*DISK drive" | awk -F: '{print $1}'`
do                                # do for every hard disk devices
                                # until the last available one
                                # get the NTFS, FAT16, FAT32, and Extended
                                # delete things between /dev/hda? and FAT32
        PARTITIONONE=`$FDISK -l /dev/$HDDEV 2>/dev/null | \
        grep ^\/dev | \
        sed 's/\*/ /g' | \
        grep -i "['FAT'|'NTFS']" | \
        sed 's/ (LBA)$//g' | sed 's/ .* /        /g' `
        if [ "${PARTITIONONE}" = "" ]; then
                break
        fi
                        # for the logical partitions in windows
                        # the Primary state before the logical one
                        # so we need to do something mark the Primary
                        # one
                        # we know the non-primary partitions is after
                        # the Extended one
                        # so here mark the primary one with BEFOREXTENDED
BFEX=1          # BFEX = 1 means before Extended partitions,
                        # BFEX = 0 means after Extended partitions,

for LOGICALPART in $PARTITIONONE
do
if [ "$LOGICALPART" = "Extended" ]
then
        BFEX=0
fi
if [ $BFEX -eq 1 ]
then
        MODIFYPARTITIONS="$MODIFYPARTITIONS BEFOREXTENDED$LOGICALPART        "
else
        MODIFYPARTITIONS="$MODIFYPARTITIONS $LOGICALPART"
fi
PARTITIONS="$PARTITIONS  $MODIFYPARTITIONS"
MODIFYPARTITIONS=""
done                # end for one devcice
done                # end for all available hard disk devices
                # $PARTITIONS store all the informations about the
                # partitions name and its type(NTFS, FAT.., Extended,etc)
#echo $PARTITIONS

# deal with the PARTITIONS, sort it in the following orders, ex.:
# /dev/hda1  primaryone
# /dev/hda2  primaryone
# /dev/hdb1  primaryone
# /dev/hdb2  primaryone
# /dev/hda4  extended one
# /dev/hda5  extended one
# /dev/hdb4  extended one

{
        { STEP=0
        for ParaOne in $PARTITIONS
        do
                echo -e -n "$ParaOne        "
                STEP=`expr $STEP + 1`
                STEP=`expr $STEP % 2`
                if [ $STEP  -eq 0 ]
                then
                        echo  ""
                fi
        done
        } | \
        sort | sed -e '/Extended        $/d' -e 's/BEFOREXTENDED//g'
} | \
{
        WINPARTSTEP=0
        while        read PartitionName PartitionType
        do
                # mount location is located at /mnt/..., named from C, D,...
                # if the mount location doesn't exist, make it with mkdir
                MOUNTLOCATITION=/mnt/win_${MntLoc[$WINPARTSTEP]}
                if [ ! -d $MOUNTLOCATITION ]
                then
                        mkdir -p $MOUNTLOCATITION
                ln -sf $MOUNTLOCATITION /root/win_${MntLoc[$WINPARTSTEP]}
                fi

                echo $PartitionName $PartitionType
                echo $MOUNTLOCATITION

                # mount partition according to the PartitionType
                WINPARTSTEP=`expr $WINPARTSTEP + 1`
                MountType=""
                case $PartitionType in
                        FAT16)        MountType=vfat
                                        MNTFLAGS="-o rw"
                                        ;;
                        FAT32)         MountType=vfat
                                        MNTFLAGS="-o rw"
                                        ;;
                        HPFS/NTFS) MountType=ntfs
                                                MNTFLAGS="-o ro,iocharset=cp936"
                                        ;;
                esac
                if [ "$MountType" != "" ]
                then
                        $MOUNT $MNTFLAGS -t $MountType $PartitionName $MOUNTLOCATITION >/dev/null 2>&1
                        if [ $? != 0 ]; then
                                echo -e "\tERROR in mount $PartitionName at $MOUNTLOCATITION, fs: $MountType"
                                rmdir  $MOUNTLOCATITION
                                WINPARTSTEP=`expr $WINPARTSTEP - 1`
                        else
                                echo "mount $PartitionName Readonly at $MOUNTLOCATITION, fs: $MountType";
                        fi
                fi
        done
}
[/code:1]
回复

使用道具 举报

 楼主| 发表于 2004-10-28 23:04:12 | 显示全部楼层
多谢 llc 大哥

俺研究ing ...
回复

使用道具 举报

发表于 2005-1-9 17:06:01 | 显示全部楼层
已经过去二个多月了,不知道MichaelBibby研究得如何了?有进展么?
回复

使用道具 举报

发表于 2005-1-15 00:49:27 | 显示全部楼层
[quote:feb11e76d9="zhanglang0214"]有空玩玩红旗桌面4.1亚洲版嘛!~~感觉还不错哦,用得挺爽的,特别是要安装第二张盘以后,功能很棒,wine 方面也做的很好。工具很多[/quote]
能告诉我红旗桌面4。1亚洲版在哪里下吗??和其他版本的区别是什么??
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

GMT+8, 2024-6-6 07:15 , Processed in 0.059774 second(s), 12 queries .

© 2021 Powered by Discuz! X3.5.

快速回复 返回顶部 返回列表