在我Ubuntu linux框我可以很容易安装USB接盘或光盘点击设备的图标,我可以发现在桌面上。

例如,如果我点击USB接驱动标的发生以下情况:

  • a/media/标签的目录是自动建立(其标签标签的磁盘,并可能会有所不同盘磁盘)
  • 本文件系统上的设备被安装在/media/标签

这个过程明显不同的安装使用 mount 命令。特别是:

  • 你不需要根(或者你不需要修改/etc/手册,以允许普通用户安装的设备)
  • /media/LABEL目录的自动创建
  • 目录的名称变化,根据卷标。

有一个命令行命令的行为就像侏儒GUI安装的设施?

有帮助吗?

解决方案

看看 pmount 命令使用情况的信息

其他提示

你在找什么是 gio mount (它最近更换了 gvfs-mount, 取代 gnome-mount).

还有一个 man page在这里 或者你可以的类型 gio help mount 对于细节

基本使用的是:

gio mount --list --detail 获得一个名单的安装和安装的卷

gio mount [-u] <volume> 到[联合国]安装,例如 gio mount smb://server/sharegio mount WINDOWS.

可悲的是,似乎有一种错误,结果在一个"错误的安装位置:体积不实施安装"的信息试图安装量的名称,但是 gvfs-mount -d /dev/<devicename> 可能的工作。

在现代的分布哈尔不再使用,pmount仍然存在,但它已经过时了。...使用:

udisks --mount /dev/sdXN

是的是有的。这就是所谓 ivman 并处理所有HAL事件。我开始运行时 ion3.我只是开始 ivman 作为一个守护程序的过程,但是已加入的程序来我sudoers文件:

cat /etc/sudoers
[...]
ivman {hostname}=(root) NOPASSWD: /sbin/init, /usr/sbin/hibernate
[...]

因此,它的管理能力的设置。

我不相信侏儒本身处理安装的—这是HAL.因此,如果哈尔运行时,你应该能够自动挂载.我假设 pmount 谈到HAL某种程度上,这将是对的方式来处理卸载.我希望这能让你开始,至少。

你也可以使用侏儒安装用于安装/卸载从命令行。

我插在我的USB装置、类型"侏儒量管理",这似乎做什么你需要的。

这将是"devkit-disks --mount /dev/sdxx"在那里 xx 是字母和数字的分区安装...

我有一个脚本,以做你想做的。

#!/bin/bash
#====================================================================
# udmount.sh - mounts partitons by volume label.
#  usage: udmount.sh <label> [rw|ro|u]
#   rw - mount read-only (default) 
#   rw - mount read-write 
#   u  - unmount
# 
# Mounts on /media/<label>. Tested on Mint 13 and Fedora 19.
# Use and/or modify at your own risk. Your mileage may vary.
# Caveats:
#   * No spaces in volume label. Won't work.
#   * If the mount point (/media/<label>) already exists,
#     (usually from an unclean shutdown), udmount will mount
#     the volume on /media/<label>_  
#
# This program is free software: you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation, either version 3 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
# GNU General Public License for more details.
#
# You can view the GNU General Public License for this program at
# http://www.gnu.org/licenses/gpl.txt
# Copyright 2013 maxdev137@sbcglobal.net
#====================================================================

BEEP=$'\a'
VLABEL="$1"     # volume label
MPOINT="/media" # default mount point for gnome-mount/udisks
YN=""           # yes/no string

c_red() { echo -n $(tput setaf 1)$1$(tput sgr0) ; }
c_grn() { echo -n $(tput setaf 2)$1$(tput sgr0) ; }
c_yel() { echo -n $(tput setaf 3)$1$(tput sgr0) ; }
c_blu() { echo -n $(tput setaf 4)$1$(tput sgr0) ; }
c_pur() { echo -n $(tput setaf 5)$1$(tput sgr0) ; }
c_aqu() { echo -n $(tput setaf 6)$1$(tput sgr0) ; }
c_wht() { echo -n $(tput setaf 7)$1$(tput sgr0) ; }

Y="YEP " ; Y_c=$(c_grn "$Y")
N="NOPE" ; N_c=$(c_red "$N")
SNAME=`echo "$0" | sed -e 's|.*/\(.*\)$|\1|'`

#--------------------------------------------------
AMV_LABEL=""    # already mounted volume label
MMSG=""         # "is mounted on" msg
AMF=0           # already mounted flag
AMV=""          # already mounted volume (from "mount -l")
AMV_DETAILS=""  # already mounted volume details
AMV_HELPER=""   # "uhelper" subsystem for mount/unmount ("hal" or "udisks")
COPT="$2"       # command line option
MOPT="ro"       # user input for mount option
UOPT="ro"       # udisk mount options

#--------------------------------------------------
_usage ()      { echo "usage: $SNAME LABEL [rw|ro|u]" ; }
_error()       { echo "!!! Error: $1. !!!" >&2 ; echo -n "$BEEP"; _usage ; exit 1 ; }
_error_parm()  { _error "$2 Parameter Missing [$1]" ; }
_error_parm2() { _error "Command is wrong (only \"rw, ro, or u\") is alowed, not \"$1\"" ; }

_unmount () {
  ### unmount ###
  if [ "$COPT" = "u" ] ; then
    MPOINT=`echo "$AMV" | grep "\[$VLABEL\]" |sed -e 's|^.* \(/.*\) type.*$|\1|'`
    #echo "unmount MPOINT = [$MPOINT]"
    if [ -z "$MPOINT" ] ; then
      echo "$N_c - $VLABEL not mounted."
    else
      _MSG=`umount "$MPOINT" 2>&1`
      _STATUS=$?
      if [ "$_STATUS" -eq 0 ] ; then
        echo "$Y_c - \"$MPOINT\" is now unmounted"
      else echo "$N_c - unmount \"$MPOINT\" failed ($_MSG)"
      fi
    fi
  fi
}

#--------------------------------------------------
[ -n "$VLABEL" ]  || _error_parm "$VLABEL" "Volume Label"

### command line option checck
case "$COPT" in
  "ro" ) ;;
  "rw" ) ;;
  "u"  ) ;;
     * ) _error_parm2 "$COPT" ;;
esac

### is VLABEL already mounted?
AMV=$(mount -l | grep "\[$VLABEL\]")
AMF=$?

### VLABEL is mounted somewhere
if  [ $AMF -eq 0 ] ; then
  AMV_LABEL=$(echo "$AMV" | sed 's/^.* \[\(.*\)\]$/\1/')
  AMV_DETAILS=$(echo $AMV | sed 's|^.*on \(.*\) \[.*$|on \"\1\"|')
  AMV_UHELPER=$(echo $AMV | grep uhelper | sed 's/^.*uhelper=\(.*\)).*$/\1/')
  #echo "AMV = [$AMV]"
  #echo "AMV_LABEL = [$AMV_LABEL]"
  #echo "AMV_DETAILS = [$AMV_DETAILS]"
  #echo "AMV_UHELPER = [$AMV_UHELPER]"

  ### unmount ###
  [ "$COPT" = "u" ] && _unmount && exit $?

  ### mounted on MPOINT (usually /media)
  if [ -d "$MPOINT/$VLABEL" ] ; then
    MOPT="ro" ; YN="$N_c"
    [ -w "$MPOINT/$VLABEL" ] && MOPT="rw"
    [ "$MOPT" = "$COPT" ]     && YN="$Y_c"
  ### mounted somewhere else
  else
    MOPT=$(echo "$AMV_DETAILS" | sed 's/^.*(\(.*\)).*$/\1/')
  fi
  echo "$N_c - $VLABEL is already mounted \"$MOPT\" $AMV_DETAILS"

### $VLABEL is not mounted anywhere, decide on "rw" or "ro"
else
  if [ "$COPT" = "u" ] ; then
    echo "$N_c - \"$VLABEL\" is not mounted"
  else
    MOPT="ro"
    [ "$COPT" = "rw" ] && MOPT="rw"
    echo "udisks --mount /dev/disk/by-label/$VLABEL $UOPT"
    udisks --mount /dev/disk/by-label/"$VLABEL" --mount-options "$MOPT"
    _STATUS=$?
    [ $_STATUS -eq 0 ] && echo "$Y_c - $MPOINT/$VLABEL mounted ($MOPT)"
    [ $_STATUS -ne 0 ] && echo "$N_c - \"$VLABEL\""
  fi
fi
#====================================================================
许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top