You are not logged in.
working fine for me, thanks!
Offline
working fine for me, thanks!
Awesome, thanks for the feedback
bashmount 1.2.0 just released, with some code refactoring and a fix for the "unmount all" command.
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
bashmount 1.3.0 released with various bug fixes.
There is a new configuration option called fancy_sort. This option is basically a big hack to get around a shortcoming of the sort command, which causes /dev/sdc11 to be shown in the menu before /dev/sdc2. This option deals with /dev/sd* and /dev/dm-* devices, but not /dev/mmcblk* devices as the sorting is not that simple. I have disabled this option by default. I introduced this change in response to a request by an obdevicemenu user.
Kudos to anyone who can implement it in a less hacky way than I did
Last edited by jnguyen (2011-05-26 21:24:58)
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
bashmount 1.3.1 released, which just fixes a typo when displaying optical devices.
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
Hi jnguyen,
bashmount looks very interesting to me! I use arch (64bit version) with Xfce and compiz. I have this file:
# cat /etc/polkit-1/localauthority/50-local.d/org.freedesktop.udisks.pkla
[Local Users]
#Identity=unix-user: your_username
Identity=unix-group:storage
Action=org.freedesktop.udisks.*
ResultAny=yes
ResultInactive=no
ResultActive=yes
I don't know exactly what this is for, but my guess is, it should allow normal users (that are a member of the storage group) to mount and unmount partitions which is otherwise reserved to the root user.
My user is a member of the storage group:
~> groups
sys lp wheel video audio optical storage power users vboxusers
If I try to mount a partition from a USB stick with bashmount, I get this:
Command: 1m
==> Mounting /dev/sdc1 ...
Mount failed: Not Authorized
==> ERROR: /dev/sdc1 could not be mounted.
I can run and successfully mount partitions if I call bashmount as root. But then my normal user has no permission to access the files in the resulting /media/XYZ directory. I guess, I am doing something wrong...
@jnguyen: Perhaps you can give me a hint what it is or could be.
Thanks in advance & kind regards,
jamesbond007.
Offline
Hi jamesbond007. Sorry for the late reply.
It sounds like a policykit problem. How do you start your X session? Is it a login manager, or do you use ~/.xinitrc ? If you use xinitrc, perhaps you could post it?
Last edited by jnguyen (2011-08-03 11:28:32)
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
Hi jnguyen,
thanks for your reply.
How do you start your X session?
I use SLiM (Simple Login Manager) and the .xinitrc looks like this:
#!/bin/sh
#
# ~/.xinitrc
#
# Executed by startx (run your window manager from here)
if [ -d /etc/X11/xinit/xinitrc.d ]; then
for f in /etc/X11/xinit/xinitrc.d/*; do
[ -x "$f" ] && . "$f"
done
unset f
fi
exec ck-launch-session startxfce4
Anything wrong with that?
Offline
You could try doing this.
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
Hi jnguyen,
/etc/slim.conf already contained this (no need to modify):
login_cmd exec ck-launch-session /bin/bash -login ~/.xinitrc %session
So the only thing I changed in .xinitrc was from
exec ck-launch-session startxfce4
to
exec startxfce4
I did not really expect this to cause any improvement, but: now bashmount seems to work like a charm!
Do you think this was caused by the modification of .xinitrc or could it be just some kind of strange coincidence?
Offline
Wooosh.. Finally some non-GUI, cli based simpliticy! Works like a charm and helps me quite a bit with things.
Offline
So the only thing I changed in .xinitrc was from
exec ck-launch-session startxfce4
to
exec startxfce4
Do you think this was caused by the modification of .xinitrc or could it be just some kind of strange coincidence?
Yes I believe it was the change to xinitrc that fixed the problem. I think ck-launch-session need only be used in either slim.conf or xinitrc, not both.
Wooosh.. Finally some non-GUI, cli based simpliticy! Works like a charm and helps me quite a bit with things.
I'm glad you are finding it useful
Last edited by jnguyen (2011-08-08 08:28:41)
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
Thanks a lot, I've been looking for this for a long time.
I have one suggestion, to improve user friendliness you can substitute:
read -r -e -p "Command: " action
with:
read -s -n1 -p "Command: " action
This will not wait for _Enter_ after user input.
Offline
Thanks a lot, I've been looking for this for a long time.
I have one suggestion, to improve user friendliness you can substitute:read -r -e -p "Command: " action
with:
read -s -n1 -p "Command: " action
This will not wait for _Enter_ after user input.
Thanks for your feedback
Personally, I think not waiting for [enter] here would be inconsistent with the behaviour of other menu screens in bashmount. Having to press [enter] also reduces the chance of choosing the wrong option by accident.
Last edited by jnguyen (2011-09-03 13:14:40)
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
Could you add support for hd-idle? As far as I know, it is the only way to spin down hard drives in linux. (If it is not the only, then it is certainly the easiest.) Before hd-idle I was breaking an external drive every six months. My latest crop of drives has been running fine for a year.
Using it is pretty simple. Its got a bunch of fancy daemon stuff, but you don't need that. All you need is to spin down the drive once there are no more mounted partitions. This is just
hd-idle -t sdb
(for /dev/sdb)
Offline
Could you add support for hd-idle? As far as I know, it is the only way to spin down hard drives in linux.
Hi keenerd, could you try changing this function in bashmount to look like this:
action_unmount() {
local -i info_mounted=
check_device "${1}" || return 1
info_mounted="$(info_mounted "${1}")"
if [[ "${info_mounted}" -eq 0 ]]; then
printf '\n'
error "${1} is already unmounted."
enter_to_continue
return 1
fi
printf '\n'
msg "Unmounting ${1} ..."
printf '\n'
$udisks --unmount ${1}
info_mounted="$(info_mounted "${1}")"
if [[ "${info_mounted}" -eq 1 ]]; then
printf '\n'
error "${1} could not be unmounted."
enter_to_continue
return 1
fi
msg "${1} unmounted successfully."
msg "Running post_unmount ..."
dev=${1#/dev/}; hd-idle -t ${dev%%[0-9]*}
enter_to_continue
}
I'll obviously implement it differently so that it's configurable via bashmount.conf. I just wanted to check that it works how you want. I haven't installed hd-idle but I have a feeling hd-idle needs sudo, so put that in if required.
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
It does need sudo. It also does the wrong thing on the edge case I mentioned, when you have multiple partitions on a drive and some are still mounted. So it needs something like
dev=${1%%[0-9]*}
if ( ! mount | grep -q "^$dev" ); then
sudo hd-idle -t ${dev#/dev/}
fi
hd-idle also seems to be harmless for the handful of flash drives I tested it on.
Offline
By the way, does this command work for your devices?
udisks --detach /dev/sdb
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
I never use --detach. It powers down the port. This has the same effect as ripping the plug out - the drive will attempt an emergency park and over time the drive will break. Detaching a few tenths of a second after hd-idle is probably a good idea though.
Offline
This is nicely done, jnguyen. Thanks for your work on it.
Offline
nice.i think udev is more concise.
KERNEL!="[hs]d[b-z][0-9]|mmcblk[0-9]p[0-9]",GOTO="am_usb_end"
# Import FS infos
IMPORT{program}="/sbin/blkid -o udev -p %N"
# specify a label
ENV{dir_name}="u-%k"
# Global mount options
ACTION=="add",ENV{mount_options}="defaults"
# Filesystem-specific mount options
ACTION=="add",ENV{ID_FS_TYPE}=="vfat|ntfs",ENV{mount_options}="$env{mount_options},utf8,umask=000"
# Mount the device
ACTION=="add",ENV{ID_FS_TYPE}!="ntfs",RUN+="/bin/mkdir -p /media/$env{dir_name}", RUN+="/bin/mount -o $env{mount_options} /dev/%k /media/$env{dir_name}"
# Clean up after removal
ACTION=="remove",RUN+="/bin/umount -l /media/$env{dir_name}", RUN+="/bin/rmdir /media/$env{dir_name}",RUN+="/bin/rm /media/$env{dir_name}"
# Exit
LABEL="am_usb_end"
Offline
Could you add support for hd-idle
Done in bashmount 1.4.0.
I've added two options in bashmount.conf. post_mount is a hook that runs immediately after a successful mount operation. post_unmount is a hook that runs immediately after a successful unmount operation. These hooks can be edited in bashmount.conf to run any arbitrary commands.
Please let me know if you encounter any bugs!
This is nicely done, jnguyen. Thanks for your work on it.
Thanks for the kind words
nice.i think udev is more concise.
Those looks like automounting rules. bashmount doesn't try to do any automounting. In fact, you can use bashmount alongside any automounting solution, such as udev rules, udiskie or even nautilus.
Last edited by jnguyen (2011-09-06 10:10:19)
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
bashmount 1.5.0 released.
Development can now be followed at Gitorious.
Last edited by jnguyen (2011-09-16 14:42:20)
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
bashmount 1.5.1 released with a fix for the "fancy_sort" function.
Thanks to WorMzy for reporting: https://bbs.archlinux.org/viewtopic.php … 75#p992575
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
bashmount 1.5.3 released with a number of fixes for the device sub-menus.
TOMOYO Linux: Mandatory Access Control.
My AUR packages
Offline
Thank you for this wonderful little utility jnguyen! Bashmount is simplistic and useful
Last edited by rogue (2011-11-06 13:08:48)
Offline