changelog shortlog tags branches changeset files revisions annotate raw help

Mercurial > hg > plan9front / rc/bin/diskparts

changeset 7243: 34f64dcbbc25
parent: d9377210c5a3
author: cinap_lenrek@felloff.net
date: Fri, 17 May 2019 18:14:10 +0200
permissions: -rwxr-xr-x
description: 7l: don't hardcode 4k pagesize, use INITRND
1 #!/bin/rc
2 rfork e
3 
4 # note that really big disks (e.g., aoe devices) may have no mbr
5 # partition table because the mbr partition table can't cope with large
6 # block numbers, so we may have to examine the data file with prep if
7 # there's no plan9 file. beware that `disk/prep -p data' on a disk with
8 # no plan 9 partition table will delete all extant partitions.
9 fn setup {
10  if(test -f $1/data && test -f $1/ctl)
11  {@{disk/edisk -p $1/data
12  || disk/fdisk -p $1/data} |
13  grep -v '^delpart ' >$1/ctl } >[2]/dev/null
14  if(test -f $1/plan9)
15  parts=($1/plan9*)
16  if not
17  parts=($1/data)
18  for(part in $parts)
19  if(test -f $part)
20  { disk/prep -p $part |
21  grep -v '^delpart ' >$1/ctl } >[2]/dev/null
22 }
23 
24 if(~ $#* 0){
25  # set up any disk partitions
26  if (! test -e /dev/sdctl)
27  bind -b '#S' /dev
28  for(disk in /dev/sd*) {
29  setup $disk
30  }
31  sysname=`{cat /dev/sysname}
32  # set up any fs(3) partitions
33  if (! test -e /dev/fs/ctl && test -e '#k/fs')
34  bind -b '#k' /dev
35  if (~ $#sysname 1 && ! ~ $sysname '' &&
36  test -r /cfg/$sysname/fsconfig && test -w /dev/fs/ctl)
37  awk '{print $0; fflush}' /cfg/$sysname/fsconfig >/dev/fs/ctl
38 }
39 if not {
40  for(disk) {
41  setup $disk
42  }
43 }