From owner-freebsd-stable@FreeBSD.ORG Sun Feb 26 10:19:48 2012 Return-Path: Delivered-To: freebsd-stable@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id B2F4C106564A for ; Sun, 26 Feb 2012 10:19:48 +0000 (UTC) (envelope-from smithi@nimnet.asn.au) Received: from sola.nimnet.asn.au (paqi.nimnet.asn.au [115.70.110.159]) by mx1.freebsd.org (Postfix) with ESMTP id 10FE68FC14 for ; Sun, 26 Feb 2012 10:19:47 +0000 (UTC) Received: from localhost (localhost [127.0.0.1]) by sola.nimnet.asn.au (8.14.2/8.14.2) with ESMTP id q1QAIiNS090805; Sun, 26 Feb 2012 21:18:44 +1100 (EST) (envelope-from smithi@nimnet.asn.au) Date: Sun, 26 Feb 2012 21:18:44 +1100 (EST) From: Ian Smith To: vermaden In-Reply-To: Message-ID: <20120226203949.H89643@sola.nimnet.asn.au> References: <4F3EE186.4020801@gmail.com> <201202181409.08859.hselasky@c2i.net> MIME-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII Cc: freebsd-stable@freebsd.org, lars.engels@0x20.net, Hans Petter Selasky Subject: Re: devd based AUTOMOUNTER X-BeenThere: freebsd-stable@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: Production branch of FreeBSD source code List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Sun, 26 Feb 2012 10:19:48 -0000 Ccs mightily trimmed to avoid not-subscribed bounces; readd as desired: On Mon, 20 Feb 2012 09:43:59 +0100, vermaden wrote: > To: freebsd-hackers@freebsd.org > Cc: matt , gleb.kurtsou@gmail.com, > freebsd-stable@freebsd.org, uffe@uffe.org, joe.culler@gmail.com, > Hans Petter Selasky , freebsd-current@freebsd.org, > lars.engels@0x20.net > > Hi, > > new version with new features (and BUGs ;p) [..] Well, I was busy composing this reply a few days ago when this system was taken out by a very near lightning strike .. losing the ADSL modem (blown into 4 pieces scattered about the room :), 2 scorched switches, the old xe pccard interface feeding the ADSL (its dongle also blown into several pieces), and a good deal of travelling - I was 80km remote at the time - but very fortunately not the server box itself .. close call! > Added 'noatime' as a default mount option when possible. Good idea for many use cases, but could that be optional? [..] > Added config file to be used from /usr/local/etc/automount.conf file, possible options are (these are defaults): > MNTPREFIX="/media" > LOG="/var/log/automount.log" > STATE="/var/run/automount.state" > ENCODING="en_US.ISO8859-1" > CODEPAGE="cp437" > DATEFMT="%Y-%m-%d %H:%M:%S" > USERUMOUNT="NO" > > Mine config currently has only these: > ENCODING="pl_PL.ISO8859-2" > CODEPAGE="cp852" > USERUMOUNT="YES" > > The USERMOUNT otions if set to YES (default to NO) will 'chmod +s /sbin/umount', > so You can click the ^ button on the devices list in NAUTILUS. Someone might explain why I needn't feel a bit uncomfortable about that chmod, even though it is optional, and even though I've been guilty myself of a 'chown root:nobody /sbin/tc' on a linux firewall box .. > These newly mounted devices appear on NAUTILUS sidebar (only with /media prefix). I wonder how it goes with KDE4? (still 3.5 here, which wouldn't count) [..] > /usr/local/sbin/automount.sh > ------------------------------------------------------------------------------- [..] > [ "${USERUMOUNT}" = "YES" ] && chmod u+s /sbin/umount # /* WHEEL group member */ > > __create_mount_point() { # /* 1=DEV */ > MNT="${MNTPREFIX}/$( basename ${1} )" > mkdir -p ${MNT} > chown 1000 ${MNT} > } Er, who's user 1000 ? Another config item perhaps? Or should that be the particular user currently invoking the script via devd (if that can be determined?)? Also, are you using sysctl vfs.usermount=1 ? > case ${2} in > (attach) > for I in /dev/${1}* > do [..] > (*Unix\ Fast\ File*) > __create_mount_point ${I} > fsck_ufs -y ${I} Mmm, fsck on every attachment? Maybe running fsck should be optional? We might be attaching, perhaps, a 2TB backup HD? .. > __check_already_mounted ${MNT} > mount -o noatime ${I} ${MNT} Again, I'd rather see that optional in an intended system tool, although it's an option I'd tend to use myself. > __log "${I}:mount (ufs)" > ;; [..] > (detach) > MOUNT=$( mount ) > __state_lock > grep ${1} ${STATE} \ > | while read DEV PROVIDER MNT > do > TARGET=$( echo "${MOUNT}" | grep -E "^${PROVIDER} " | awk '{print $3}' ) > [ -z ${TARGET} ] && { > __state_remove ${MNT} ${STATE} ${LINE} > continue > } > umount -f ${TARGET} & > unset TARGET > __state_remove ${MNT} ${STATE} ${LINE} > __log "${DEV}:umount" > done > __state_unlock > __log "/dev/${1}:detach" > find ${MNTPREFIX} -type d -empty -delete I don't see the need to remove all empty subdirs of, say, /media - this tool may not be the only thing wanting to manage that space? Removing directories that were added by this tool itself makes sense of course. Looks like a neat gadget, don't mind me picking up on a few aspects :) cheers, Ian