Re: Is there a non file manager daemon for automounting like the ones provided by "pcmanfm -d"

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]



from my .bashrc:

mounted() {
    mount | grep -q "on $1 type"
}

safe_umount() {
    while mounted "$1"; do
        echo sudo umount "$1"
        sudo umount "$1" || sleep 5
    done
}

penmount() {
    local target="$HOME/mnt" options
    . "$HOME/bin/mount_lib"
    if [[ $1 == -u ]]; then
        if ! mounted "$target"; then
            echo "Error: ${target/$HOME/~} not mounted" >&2
            return 1
        fi
        sync
        safe_umount "$target"
    else
        if mounted "$target"; then
            echo "Error: ${target/$HOME/~} is already mounted" >&2
            return 1
        fi
        echo sudo blkid -p "$1"
        eval local "$(/usr/bin/sudo /usr/bin/blkid -p "$1" | cut -d : -f 2-)"
        [[ "$TYPE" == "vfat" || "$TYPE" == "ntfs" ]] &&
options="uid=$UID,gid=$UID"
        echo sudo mount -o "$options" "$1" "$target"
        sudo mount -o "$options" "$1" "$target"
    fi
}

Function is in regular use, I don't know if it's useful to the topic,
and needs a tweak if your user doesn't have a group with the same
group id.

cheers!
mar77i


[Index of Archives]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [Share Photos]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]
  Powered by Linux