9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
From: erik quanstrom <quanstro@quanstro.net>
To: 9fans@9fans.net
Subject: Re: [9fans] Problem caused by recent change to diskparts
Date: Tue, 17 Jun 2008 15:19:33 -0400	[thread overview]
Message-ID: <66268015ee737bc6696d5a135916601d@quanstro.net> (raw)
In-Reply-To: <ba0d3bc70806171159h32e6997dvd0d9fc4a2dcca0a8@mail.gmail.com>

> for(disk in /dev/sd[0-9A-Zabd-z]*) {
> 	if(test -f $disk/data && test -f $disk/ctl)
> 		disk/fdisk -p $disk/data >$disk/ctl >[2]/dev/null
> 	if(test -f $disk/plan9)
> 		parts=($disk/plan9*)
> 	if not
> 		parts=($disk/data)
> 	for(part in $parts)
> 		if(test -f $part)
> 			disk/prep -p $part >$disk/ctl >[2]/dev/null
> }

definately a bug.

there are certainly better solutions to this, but the one that
requires the least code would be something like this

for(disk in /dev/sd?[0-9]) {
	if(test -f $disk/data && test -f $disk/ctl){
		disk/fdisk -p $disk/data >$disk/ctl >[2]/dev/null
		if(test -f $disk/plan9){
			for(part in $disk/plan9*)
				disk/prep -p $part >$disk/ctl >[2]/dev/null
		}
		if not{
			part=$disk/data
			if(! disk/prep -p $part>[2=1] | grep -s '^no plan 9')
				disk/prep -p $part >$disk/ctl >[2]/dev/null
			parts=($disk/data)
		}
	}
}

- erik




      reply	other threads:[~2008-06-17 19:19 UTC|newest]

Thread overview: 2+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-17 18:59 Sander van Dijk
2008-06-17 19:19 ` erik quanstrom [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=66268015ee737bc6696d5a135916601d@quanstro.net \
    --to=quanstro@quanstro.net \
    --cc=9fans@9fans.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).