From owner-freebsd-questions@FreeBSD.ORG Wed Mar 23 21:05:27 2011 Return-Path: Delivered-To: freebsd-questions@freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:4f8:fff6::34]) by hub.freebsd.org (Postfix) with ESMTP id 54239106568B for ; Wed, 23 Mar 2011 21:05:27 +0000 (UTC) (envelope-from editor@d3photography.com) Received: from server.cwis.biz (70-89-202-5-invergrove-mn.hfc.comcastbusiness.net [70.89.202.5]) by mx1.freebsd.org (Postfix) with ESMTP id 259F98FC08 for ; Wed, 23 Mar 2011 21:05:27 +0000 (UTC) Received: from server.cwis.biz (localhost [127.0.0.1]) by server.cwis.biz (Postfix) with ESMTP id A231E2639A0F; Wed, 23 Mar 2011 16:05:49 -0500 (CDT) X-Virus-Scanned: amavisd-new at cwis.biz Received: from server.cwis.biz ([127.0.0.1]) by server.cwis.biz (server.cwis.biz [127.0.0.1]) (amavisd-new, port 10024) with ESMTP id BCAsAvm9ju4m; Wed, 23 Mar 2011 16:05:36 -0500 (CDT) Received: from [192.168.46.76] (unknown [64.122.64.171]) by server.cwis.biz (Postfix) with ESMTPSA id C83F72639A0E; Wed, 23 Mar 2011 16:05:36 -0500 (CDT) Mime-Version: 1.0 (Apple Message framework v1082) Content-Type: text/plain; charset=us-ascii From: Ryan Coleman In-Reply-To: <20110323214516.47d71026.freebsd@edvax.de> Date: Wed, 23 Mar 2011 16:05:12 -0500 Content-Transfer-Encoding: quoted-printable Message-Id: References: <21012F71-5038-45F1-98C6-72A0B1239009@d3photography.com> <31D3BED1-7035-435F-B127-EFAAF6AFF076@mac.com> <20D9B390-3190-4865-A19E-BDEDC595E7A2@d3photography.com> <20110323211605.4c893e70.freebsd@edvax.de> <2A377C8B-D9E6-4E60-834C-5BD7C03AA552@d3photography.com> <20110323214516.47d71026.freebsd@edvax.de> To: Polytropon X-Mailer: Apple Mail (2.1082) Cc: FreeBSD Mailing List Subject: Re: Automating mounting of ISO images X-BeenThere: freebsd-questions@freebsd.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Mar 2011 21:05:27 -0000 On Mar 23, 2011, at 3:45 PM, Polytropon wrote: > On Wed, 23 Mar 2011 15:35:21 -0500, Ryan Coleman = wrote: >> Here's the working script (Yay!) >>=20 >> #! /bin/sh >>=20 >> for FILE in /mount/disc_images/*.iso; do >> DEST=3D$FILE >> DIRNAME=3D`basename ${FILE} .iso` >> echo ${DIRNAME} ${FILE} >> mkdir /mount/new_brighton/images/${DIRNAME} >> mount -t cd9660 /dev/`mdconfig -f ${FILE}` = /mount/new_brighton/images/${DIRNAME} >> done >>=20 >> Thanks to Polytropon and Chuck for their guidance. >=20 > Just a little note: >=20 > Make sure you're mounting the ISOs as "-o ro" to prevent > write access to them. If users don't have +w access to > the mounted directories, you can leave out this step. > Depending on the permissions used, this might corrupt > (or at least change) the image files which may not be > desired. >=20 > If you want to omit one external program call (one per > iteration step), use DIRNAME=3D${FILE%.iso} instead of the > `basename ${FILE} .iso` - although it's more obvious what > DIRNAME gets designated to. :-) I did try that once and it didn't strip the directory structure out so = when basename worked I didn't mess with it too much. If we have 100+ = ISOs to mount then I'll worry.