Date: Wed, 23 Mar 2011 19:21:32 +0000 From: four.harrisons@googlemail.com To: editor@d3photography.com Cc: freebsd-questions@freebsd.org Subject: Re: Automating mounting of ISO images Message-ID: <4d8b710e.9104df0a.595e.04b7@mx.google.com>
next in thread | raw e-mail | index | archive | help
On Wed, 23 Mar 2011 13:49:46 -0500, Ryan Coleman <editor@d3photography.co= m> wrote:=0D=0A> I have a folder full of ISOs that we're sharing on the=0D= =0A> network instead of having the discs available (seems=20=0D=0A> like = a good idea, right?)=0D=0A=0D=0APlease use the correct terminology: FreeB= SD (as any UNIX=0D=0Aoperating systems) calls them DIRECTORIES. "Folders"= is=0D=0Asomething else, it's not equivalent to a directory, so=0D=0A"fol= ders" is wrong.=0D=0A=0D=0A=0D=0A=0D=0A> But I want to automate the proce= ss on boot instead of=0D=0A> having to write a static script to do the w= ork.=0D=0A>=20=0D=0A> Disc images are located in /mount/disc_images/ (all= are ISOs)=0D=0A> They need to mount into /mount/office_files/images/FILE= NAME=0D=0A> [without the .iso extension]=0D=0A>=20=0D=0A> How can I do th= is? I've always been given these types of=0D=0A> scripts in the past at a= n old job but I don't have access=0D=0A> to those examples anymore.=0D=0A= =0D=0ASomething like this (not even tested, but quite verbose and=0D=0Aun= elegant) should work:=0D=0A=0D=0A#!/bin/sh=0D=0ANODE=3D0=0D=0Afor IMAGE i= n /mount/disc_images/*.iso; do=0D=0A=09mdconfig -a -t vnode -u $NODE -f $= IMAGE=0D=0A=09mount -t cd9660 -o ro /dev/md$NODE /mount/office_files/imag= es/`basename $IMAGE .iso`=0D=0A=09NODE=3D`expr $NODE + 1`=0D=0Adone=0D=0A= =0D=0AThis of course assumes that you have PROPER file names. In=0D=0Acas= e the ISO file names contain special characters, attention=0D=0Ahas to be= paid for quoting and escaping. Worth reading:=0D=0A=0D=0Ahttp://www.dwhe= eler.com/essays/filenames-in-shell.html=0D=0A=0D=0Ahttp://www.dwheeler.co= m/essays/fixing-unix-linux-filenames.html=0D=0A=0D=0AAfter reading it, yo= u'll easily recognize that I did it wrong=0D=0Ain the suggestive script. = :-)=0D=0A=0D=0A=0D=0A=0D=0AI'm not sure if you can mount from ISO files d= irectly, but=0D=0Amaybe you can try that too.=0D=0A=0D=0ARemember unmount= ing the files when not in use (scripted: umount=0D=0Aand mdconfig -d).=0D= =0A=0D=0A=0D=0A=0D=0A=0D=0A--=20=0D=0APolytropon=0D=0AMagdeburg, Germany=0D= =0AHappy FreeBSD user since 4.0=0D=0AAndra moi ennepe, Mousa, ...=0D=0A__= _____________________________________________=0D=0Afreebsd-questions@free= bsd.org mailing list=0D=0Ahttp://lists.freebsd.org/mailman/listinfo/freeb= sd-questions=0D=0ATo unsubscribe, send any mail to "freebsd-questions-uns= ubscribe@freebsd.org"=0D=0A
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?4d8b710e.9104df0a.595e.04b7>