From owner-freebsd-questions@FreeBSD.ORG Wed Mar 23 20:45:19 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 125131065670 for ; Wed, 23 Mar 2011 20:45:19 +0000 (UTC) (envelope-from freebsd@edvax.de) Received: from mx01.qsc.de (mx01.qsc.de [213.148.129.14]) by mx1.freebsd.org (Postfix) with ESMTP id C42518FC08 for ; Wed, 23 Mar 2011 20:45:18 +0000 (UTC) Received: from r55.edvax.de (port-92-195-86-215.dynamic.qsc.de [92.195.86.215]) by mx01.qsc.de (Postfix) with ESMTP id 06A473CD41; Wed, 23 Mar 2011 21:45:17 +0100 (CET) Received: from r55.edvax.de (localhost [127.0.0.1]) by r55.edvax.de (8.14.2/8.14.2) with SMTP id p2NKjGqt001913; Wed, 23 Mar 2011 21:45:17 +0100 (CET) (envelope-from freebsd@edvax.de) Date: Wed, 23 Mar 2011 21:45:16 +0100 From: Polytropon To: Ryan Coleman Message-Id: <20110323214516.47d71026.freebsd@edvax.de> In-Reply-To: <2A377C8B-D9E6-4E60-834C-5BD7C03AA552@d3photography.com> 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> Organization: EDVAX X-Mailer: Sylpheed 2.4.7 (GTK+ 2.12.1; i386-portbld-freebsd7.0) Mime-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Content-Transfer-Encoding: 7bit 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 Reply-To: Polytropon List-Id: User questions List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Wed, 23 Mar 2011 20:45:19 -0000 On Wed, 23 Mar 2011 15:35:21 -0500, Ryan Coleman wrote: > Here's the working script (Yay!) > > #! /bin/sh > > for FILE in /mount/disc_images/*.iso; do > DEST=$FILE > DIRNAME=`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 > > Thanks to Polytropon and Chuck for their guidance. Just a little note: 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. If you want to omit one external program call (one per iteration step), use DIRNAME=${FILE%.iso} instead of the `basename ${FILE} .iso` - although it's more obvious what DIRNAME gets designated to. :-) -- Polytropon Magdeburg, Germany Happy FreeBSD user since 4.0 Andra moi ennepe, Mousa, ...