This commit is contained in:
cinap_lenrek 2011-04-11 19:47:05 +00:00
parent 05569f6f2c
commit 45bab89362
173 changed files with 8022 additions and 261 deletions

0
mnt/apm/.dummy Normal file
View file

0
mnt/arch/.dummy Normal file
View file

0
mnt/cd/.dummy Normal file
View file

0
mnt/cons/.dummy Normal file
View file

0
mnt/cons/cons/.dummy Normal file
View file

0
mnt/cons/consctl/.dummy Normal file
View file

0
mnt/consoles/.dummy Normal file
View file

0
mnt/doc/.dummy Normal file
View file

0
mnt/exportfs/.dummy Normal file
View file

0
mnt/exportfs/0/.dummy Normal file
View file

0
mnt/exportfs/1/.dummy Normal file
View file

0
mnt/exportfs/10/.dummy Normal file
View file

0
mnt/exportfs/11/.dummy Normal file
View file

0
mnt/exportfs/12/.dummy Normal file
View file

0
mnt/exportfs/13/.dummy Normal file
View file

0
mnt/exportfs/14/.dummy Normal file
View file

0
mnt/exportfs/15/.dummy Normal file
View file

0
mnt/exportfs/16/.dummy Normal file
View file

0
mnt/exportfs/2/.dummy Normal file
View file

0
mnt/exportfs/3/.dummy Normal file
View file

0
mnt/exportfs/4/.dummy Normal file
View file

0
mnt/exportfs/5/.dummy Normal file
View file

0
mnt/exportfs/6/.dummy Normal file
View file

0
mnt/exportfs/7/.dummy Normal file
View file

0
mnt/exportfs/8/.dummy Normal file
View file

0
mnt/exportfs/9/.dummy Normal file
View file

0
mnt/keys/.dummy Normal file
View file

0
mnt/lp/.dummy Normal file
View file

0
mnt/netkeys/.dummy Normal file
View file

0
mnt/news/.dummy Normal file
View file

0
mnt/plumb/.dummy Normal file
View file

0
mnt/rdb/.dummy Normal file
View file

0
mnt/temp/.dummy Normal file
View file

0
mnt/term/.dummy Normal file
View file

0
mnt/ums/.dummy Normal file
View file

0
mnt/vmware/.dummy Normal file
View file

0
mnt/web/.dummy Normal file
View file

0
mnt/webcookies/.dummy Normal file
View file

0
mnt/wiki/.dummy Normal file
View file

0
mnt/wrap/.dummy Normal file
View file

0
mnt/wsys/.dummy Normal file
View file

0
n/.dummy Normal file
View file

View file

View file

View file

221
sys/lib/dist.old/mkfile Normal file
View file

@ -0,0 +1,221 @@
# /sys/lib/dist/mkfile
src9=/n/sources/plan9 # what to export
dist=/sys/lib/dist.old # where this machinery lives
scr=/n/other/dist # scratch space before copying to web.protect
# import /sys/lib/dist/web.protect from the outside
x=`{setup}
cd:V: $scr/plan9.iso
ncd:V: $scr/plan9-new.iso.bz2
ncd-dist:V: $scr/plan9-new.iso.bz2
mk $dist/web.protect/plan9-new.iso.bz2
cd-dist:V: $scr/plan9.iso.bz2
mk $dist/web.protect/plan9.iso.bz2
contrib-cd:V: $scr/contrib.iso.bz2
mk $dist/web.protect/contrib.iso.bz2
$scr/%.iso:D: $src9/dist/replica/plan9.log
@ { cd pc; mk cddisk }
rm -f $target
bind pc/cddisk cdstub/bootdisk.img
if(! test -f $src9/bootdisk.img)
bind -a cdstub $src9
title=`{date | sed 's/(...) (...) (..) (..:..):.. (...) (....)/Plan 9 - \2 \3 \6 \4/'}
title=$"title
echo 'CD:' $title
disk/mk9660 -9cj -v $title -s $src9 -b bootdisk.img $target
# copy compressed file from scratch space to the distribution, carefully
$dist/web.protect/%.iso.bz2: $scr/%.iso.bz2
>>$target.new
chmod +t $target.new # waste write buf, not venti store
cp $prereq $target.new
# replace previous version with a flash cut
if (test -e $target)
mv $target $target.old # try to not clobber downloads in progress
mv $target.new $target
cd-cleanup:V:
rm -f $dist/web.protect/*.iso.bz2.old # remove old versions after a delay
# generate replica log & db for $src9 only
scan:V:
test -d $scr # make sure other was mounted above
test -d $src9
test -d $dist/web.protect
lock scan.lock replica/scan $dist/sources.replica
chmod +t $src9/dist/replica/*.^(db log)
# generate replica log & db for all of /n/sources
scanall:V:
@ {
rfork ne
d=/n/sources
test -d $src9
lock scanall.lock replica/scan $dist/sourcesall.replica
chmod +t $src9/dist/replica/*.^(db log)
}
compresslog:V:
{
awk -f logcompress.awk $src9/dist/replica/plan9.log |
awk -f logtime.awk -v 't='^`{date -n} >/tmp/plan9.log
rm -f $src9/dist/replica/plan9.new.log
cp /tmp/plan9.log $src9/dist/replica/plan9.new.log &&
mv $src9/dist/replica/plan9.new.log $src9/dist/replica/plan9.log
} <scan.lock
#restart:V:
# rm -f $src9/dist/replica/plan9.db
# rm -f $src9/dist/replica/plan9.log
# chmod 664 $src9/dist/replica/plan9.db >$src9/dist/replica/plan9.db
# chmod 664 $src9/dist/replica/plan9.log >$src9/dist/replica/plan9.log
# chmod +a $src9/dist/replica/plan9.log
# mk scan
odump:V:
disk/dump9660 -9cj -v 'Plan 9 4e Dumps' -s $src9 \
-p /sys/lib/sysconfig/proto/allproto $scr/distdump.iso
cd.install:V:
# if(~ $sysname achille){
# echo; echo; echo '*** run this on a real machine, like chips.'
# exit bad
# }
bzip2 -9 <$scr/plan9.iso >web.protect/nplan9.iso.bz2
D.install:V:
D=/n/roro/usr/rob/testplan9
9fs roro
test -d $D
cp $D$dist/pc/ndisk $dist/web.protect/ndisk
cp $D$dist/pc/9loaddebug $dist/web.protect/n9loaddebug
reallyinstall:V:
if(! ~ $sysname achille){
echo; echo; echo '*** this needs to run on achille.'
exit bad
}
cd web.protect
for (i in plan9.iso.bz2 disk 9loaddebug vmware.zip)
if(test -f n$i){
mv $i _$i && { mv n$i $i || mv _$i $i }
}
rm /srv/ramfs.9down4e
$dist/startcache
dump:V:
rm -f /srv/9660.xxx
9660srv 9660.xxx
mount /srv/9660.xxx /n/kremvax $scr/plan9.iso
now=`{mtime $dist/web.protect/plan9.iso.bz2 | awk '{print $1}'}
ls -l /rls/plan9/4e.iso
disk/dump9660 -9cj -s /n/kremvax -n $now /rls/plan9/4e.iso
ls -l /rls/plan9/4e.iso
rm /srv/9660.xxx
reencode:V:
rm -f $scr/nplan9.iso
rm -f /srv/9660.xxx
9660srv 9660.xxx
mount /srv/9660.xxx /n/kremvax $scr/plan9.iso
disk/mk9660 -9cj -v 'Plan 9 4th Edition' -s /n/kremvax \
-b bootdisk.img $scr/nplan9.iso
rm /srv/9660.xxx
# compress a cd image in scratch space
$scr/%.iso.bz2:D: $scr/%.iso
@ {
cd $scr
bzip2 -9 <$stem.iso >n$stem.iso.bz2 &&
{
if (test -e $stem.iso.bz2)
mv $stem.iso.bz2 _$stem.iso.bz2
mv n$stem.iso.bz2 $stem.iso.bz2
}
echo `{date} md5 `{md5sum <$stem.iso.bz2} \
sha1 `{sha1sum <$stem.iso.bz2} \
$stem.iso.bz2 >>/usr/web/plan9checksums.txt
}
$scr/contrib.iso:DV:
rm -f $target
disk/mk9660 -9cj -v 'Plan 9 Extras' -s /n/sources \
-p ./contrib.proto $target
rebuild:V:
chmod +l build.lock >>build.lock
rebuild <build.lock
rebuild-mail:V:
chmod +l build.lock >>build.lock
rebuild <build.lock
datemail 'nightly build errors' 9trouble <buildit.out
datemail 'nightly build differences' 9trouble <checkbuild.out
status=''
scansources-mail:V:
scansources | datemail 'nightly fs vs. sources scan' 9trouble
worldwritable-mail:V:
test -e $src9
@ {cd /n/sources; /usr/rsc/bin/$cputype/lsr -t -d} |
awk '$2 ~ /[2367]$/' | grep -vf ok-writable |
datemail 'WRITABLE FILES ON SOURCES' 9trouble || status=''
status=''
@ {
cd $src9
/usr/rsc/bin/$cputype/lsr -t -d $src9
} |
awk '$2 ~ /[2367][^2367].$/' |
datemail 'non-group-writable files on sources' 9trouble
status=''
# use /n/boot to avoid walking the archives mounted under
# /lib/vac, or other mounts or binds.
rfork n
9fs boot
test -e /n/boot/sys
/usr/rsc/bin/$cputype/lsr -t -d /n/boot/sys /n/boot/lib |
grep -v '/lib/audio/|/sys/src/cmd/vac/test/' | # give us a break
awk '$2 ~ /[2367][^2367].$/' |
datemail 'non-group-writable files on fs' 9trouble
status=''
9.tar.gz:V:
@{
rfork n
9fs sources
test -e $src9
bind -a $src9 $src9/sys/src
cd $src9/sys/src
tar c LICENSE NOTICE 9
} | gzip >$target
9-export:V: 9.tar.gz
9fs sources
cp 9.tar.gz /n/sources/extra/9.tgz
chmod +t /n/sources/extra/9.tgz
plan9.tar.bz2:V:
@{
rfork n
9fs sources
cd /n/sources
test -e $src9
bind /n/empty $src9/lib/font
bind /n/empty $src9/sys/lib/postscript/font
bind /n/empty $src9/sys/lib/ghostscript
bind /n/empty $src9/sys/src/cmd/gs
tar c plan9/LICENSE* plan9/NOTICE plan9/*/mkfile plan9/*/include \
plan9/acme/*/src plan9/acme/bin/source \
plan9/^(adm cron lib lp mail rc sys tmp usr)
} | bzip2 >$target
plan9-export:V: plan9.tar.bz2
9fs sources
chmod +t plan9.tar.bz2
mv plan9.tar.bz2 /n/sources/extra/plan9.tar.bz2

View file

View file

@ -0,0 +1,4 @@
#!/bin/rc
window '0 0 100 100' games/clock
window '80 80 610 360' /usr/glenda/lib/first.window

View file

@ -0,0 +1,11 @@
#!/bin/rc
echo -n readme > /dev/label
echo 'You have completed the Installation Process.'
cat<<'!'
Welcome to Plan 9.
This is rc.
!
exec rc

View file

@ -0,0 +1,16 @@
if(test -f '#m/mousectl') {
echo -n accelerated > '#m/mousectl'
echo -n 'res 3' > '#m/mousectl'
}
user=`{cat /dev/user}
home=/usr/$user
bind -a $home/bin/rc /bin
bind -a $home/bin/$cputype /bin
bind -c $home/tmp /tmp
rio -si inst/gui
echo
echo
echo 'failed to start rio. you can start a text-based installation by running'
echo
echo ' inst/textonly'
echo

View file

@ -0,0 +1,47 @@
#!/bin/rc
rfork e
echo
echo 'Insert a disk other than your installation boot disk'
echo 'into your floppy drive; it will be erased to create'
echo 'the boot floppy.'
echo
echo -n 'Press enter when ready.'
read >/dev/null >[2]/dev/null
if(~ $#adisk 1)
; # do nothing
if not if(~ $#bootfile 0)
adisk=/dev/fd0disk
if not {
switch($bootfile) {
case sd*
adisk=`{echo $bootfile | sed 's#(sd..).*#/dev/\1/data#'}
case fd*
adisk=`{echo $bootfile | sed 's#(fd.).*#/dev/\1disk#'}
case *
echo 'unknown bootfile '^$bootfile^'; mail 9trouble@plan9.bell-labs.com'
exit oops
}
}
if(! ~ `{ls -l $adisk | awk '{print $6}'} 1474560){
echo 'Will not format non-floppy disk '^$"adisk. >[1=2]
exit 'bad adisk'
}
log Formatting boot floppy
if (test -e /n/newfs/386/9loadnousb)
bind /n/newfs/386/9loadnousb /n/newfs/386/9load # cater to old bioses
disk/format -b /386/pbs \
-fd $adisk /n/newfs/386/9load /n/newfs/386/9pcdisk.gz \
/tmp/plan9ini.bak
x=$status
if(~ $x ''){
echo
echo 'Done!'
echo
}
exit $x

View file

@ -0,0 +1,55 @@
#!/bin/rc
first=`{ls -p '#S' | sed 1q}
if(! ~ $first $disk) {
echo 'warning: The plan 9 partition is not on the boot disk,'
echo 'so making it the active partition will have no effect.'
}
p9offset=`{grep '^part 9fat ' /dev/$disk/ctl |awk '{print $3}'}
if(! ~ $#p9offset 1) {
echo 'could not find plan 9 partition.'
echo 'cannot happen'
exit bad
}
if(test $p9offset -gt 4128695) { # 65536 * 63 - 10
echo
echo 'Your Plan 9 partition is more than 2GB into your disk,'
echo 'and the master boot records used by Windows 9x/ME'
echo 'cannot access it (and thus cannot boot it).'
echo
echo 'You can install the Plan 9 master boot record, which can load'
echo 'partitions far into the disk.'
echo
}
echo 'If you use the Windows NT/2000/XP master boot record'
echo 'or a master boot record from a Unix clone (e.g., LILO or'
echo 'FreeBSD bootmgr), it is probably safe to continue using'
echo 'that boot record rather than install the Plan 9 boot record.'
echo
prompt 'Install the Plan 9 master boot record' y n
switch($rd) {
case n
;
case y
disk/mbr -m /386/mbr /dev/$disk/data
}
log Setting Plan 9 partition active.
p9part=`{disk/fdisk /dev/$disk/data >[2]/dev/null </dev/null |
grep PLAN9 | sed 1q | sed 's/ *(p.) .*/\1/'}
if(~ $#p9part 0){
echo 'You have no Plan 9 partitions (How could this happen?)' >[1=2]
exit 'no plan 9 partition found'
}
p9part=$p9part(1)
{ echo 'A '^$p9part; echo w } | disk/fdisk /dev/$disk/data >[2]/dev/null >/dev/null
x=$status
if(~ $x '' '|'){
echo
echo 'The Plan 9 partition is now marked as active.'
exit ''
}
exit $x

View file

@ -0,0 +1,125 @@
#!/bin/rc
# desc: create a boot floppy or configure hard disk to boot plan 9
# prereq: copydist
switch($1) {
case go
echo
echo 'Initializing Plan 9 FAT configuration partition (9fat)'
echo
fat=(/dev/sd*/9fat)
fat=$fat(1)
disk=`{echo $fat | sed 's:/dev/::;s:/9fat::'}
bootfs=`{echo $fs | sed 's:/dev/(sd..)/(.*):\1!\2:'}
bootfat=`{echo $fs | sed 's:/dev/(sd..)/(.*):\1!9fat:'}
if(! test -f /dev/$disk/9fat) {
echo 'You have no 9fat partition. Can''t setup booting.'
exit
}
if(! test -f /tmp/plan9.ini) {
{
sfs=`{echo $fs | sed 's;/dev;#S;'}
if(~ $fstype fossil fossil+venti){
echo bootfile'='$bootfat!9pcf
echo 'bootargs=local!'^$sfs
echo 'bootdisk=local!'^$sfs
}
if not {
echo bootfile'='$bootfs!/386/9pcdisk
echo 'bootdisk=local!'^$sfs
}
if(~ $fstype fossil+venti){
venti=`{echo $ventiarena | sed 's;/dev;#S;'}
echo venti'='^$venti
}
# sort -u avoids dups which could otherwise trigger
# pointless boot menus.
grep -v '(^\[)|menuitem|adisk|bootfile|bootdisk|bootargs|nobootprompt|mouseport|vgasize|monitor|cdboot' /tmp/plan9.orig |
sort -u
echo 'mouseport='^$mouseport
echo 'monitor='^$monitor
echo 'vgasize='^$vgasize
} >/tmp/plan9.ini
}
if(! test -f /tmp/plan9ini.bak)
cp /tmp/plan9.ini /tmp/plan9ini.bak
need9fatformat=no
if(! isfat /dev/$disk/9fat)
need9fatformat=yes
if not if(! mount -c /srv/dos /n/9fat /dev/$disk/9fat >[2]/dev/null)
need9fatformat=yes
if not if(! test -f /n/9fat/plan9.ini)
need9fatformat=yes
if (test -e /n/newfs/386/9loadnousb)
bind /n/newfs/386/9loadnousb /n/newfs/386/9load # cater to old bioses
if(~ $need9fatformat yes){
log Initializing Plan 9 FAT partition.
disk/format -r 2 -d -b /386/pbs \
/dev/$disk/9fat /n/newfs/386/9load
# silently install pbslba if the partition is way into the disk.
# it''s our only hope. only need this for >8.5GB into the disk.
# but...
# there are so few non-LBA bioses out
# there anymore that we'll do this even if we're only 2GB into
# the disk. it's just not worth the headaches of dealing with
# crappy bioses that don't address the whole 8.5GB properly
9fatoffset=`{grep '^part 9fat ' /dev/$disk/ctl | awk '{print $4}'}
if(! ~ $#9fatoffset 1) {
echo 'could not find plan 9 partition.'
echo 'cannot happen'
exit bad
}
if(test $9fatoffset -gt 2097152) # 2GB
disk/format -b /386/pbslba /dev/$disk/9fat
mount -c /srv/dos /n/9fat /dev/$disk/9fat
}
if(! test -f /n/9fat/4e){
logprog cp /n/newfs/386/9load /n/9fat/9load
logprog cp /n/newfs/386/9pcf /n/9fat/9pcf
if(test -f /n/9fat/plan9.ini && ! test -f /n/9fat/plan9-3e.ini)
logprog mv /n/9fat/plan9.ini /n/9fat/plan9-3e.ini
if(test -f /n/9fat/9pcdisk && ! test -f /n/9fat/9pc3e)
logprog mv /n/9fat/9pcdisk /n/9fat/9pc3e
awk -f /bin/inst/mkini.awk >/n/9fat/plan9.ini
>/n/9fat/4e
}
echo
echo 'There are myriad ways to boot a Plan 9 system.'
echo 'You can use any of the following.'
echo
echo ' floppy - create a boot floppy'
echo ' plan9 - make the plan 9 disk partition the default for booting'
echo ' win9x - add a plan 9 option to windows 9x boot menu'
echo ' winnt - add a plan 9 option to windows nt/2000/xp boot manager'
echo
echo 'If you are upgrading an extant third edition installation and booting'
echo 'from something other than a floppy, you needn''t run anything here.'
echo 'Just type ctl-d.'
oldbootsetup=$didbootsetup
didbootsetup=1
export didbootsetup
prompt 'Enable boot method' floppy plan9 win9x winnt
if(! boot$rd){
didbootsetup=$oldbootsetup
export didbootsetup
}
case checkdone
xxxfat=(/dev/sd*/9fat)
if(! isfat $xxxfat(1) || ! ~ $didbootsetup 1){
bootsetup=ready
export bootsetup
}
}

View file

@ -0,0 +1,117 @@
#!/bin/rc
dosdisk=`{ls /dev/sd??/dos >[2]/dev/null | sed 1q | sed 's!.*/(.*)/dos!\1!'}
if(~ $#dosdisk 0 || ! c: || ! test -f /n/c:/autoexec.bat || ! test -f /n/c:/config.sys) {
echo 'Could not find autoexec.bat or config.sys on the first FAT disk.'
exit bad
}
for (i in autoexec config msdos)
if(test -f /n/c:/$i.p9) {
echo 'A Plan 9 backup already exists; will not edit system files again.'
exit bad
}
for (i in autoexec.bat config.sys msdos.sys)
if(! cp /n/c:/$i /n/c:/^`{echo $i | sed 's/\.(bat|sys)$/.p9/'}) {
echo 'Could not back up '^$i^'; will not continue.'
exit bad
}
if(! test -d /n/c:/plan9 && ! mkdir /n/c:/plan9) {
echo 'Could not create directory /n/c:/plan9.'
exit bad
}
if(! cp /n/newfs/386/^(9load ld.com 9pcdisk) /tmp/plan9ini.bak /n/c:/plan9) {
echo 'Could not copy Plan 9 boot files into /n/c:/plan9.'
exit bad
}
chmod +w /n/c:/autoexec.bat /n/c:/config.sys /n/c:/msdos.sys
if(grep -si 'Plan ?9' /n/c:/config.sys || grep -si 'Plan ?9' /n/c:/autoexec.bat) {
echo 'Plan 9 entries already in config.sys or autoexec.bat.'
echo 'Not changing them; refer to Plan 9 install documentation'
echo 'to configure manually.'
exit bad
}
if(! grep -si '\[menu\]' /n/c:/config.sys) {
{
echo 1
echo i
echo '[menu] '
echo 'menuitem=windows, Windows '
echo 'menudefault=windows '
echo ' '
echo '[common] '
echo ' '
echo '[windows] '
echo .
echo w
echo q
} | ed /n/c:/config.sys >/dev/null >[2]/dev/null
}
{
echo 1
echo '/\[[Mm][Ee][Nn][Uu]\]'
echo '?^[Mm][Ee][Nn][Uu][Ii][Tt][Ee][Mm]='
echo a
echo 'menuitem=plan9, Plan 9 from Bell Labs '
echo .
echo '$'
echo a
echo ' '
echo '[plan9] '
echo ' '
echo .
echo w
echo q
} | ed /n/c:/config.sys >/dev/null>[2]/dev/null
{
echo 1
echo i
echo '@echo off '
echo 'if %config%==plan9 goto plan9 '
echo 'goto notplan9 '
echo ':plan9 '
echo 'plan9\ld '^$dosdisk^'!dos!plan9/9load '
echo ':notplan9 '
echo .
echo w
echo q
} | ed /n/c:/autoexec.bat >/dev/null>[2]/dev/null
fn zeroopt {
if(grep -s '^'^$1^'=1' /n/c:/msdos.sys) {
{
echo '/^'^$1^'=1/s/=1/=0/'
echo w
echo q
} | ed /n/c:/msdos.sys>/dev/null>[2]/dev/null
}
if not if (grep -s '^'^$1^'=0' /n/c:/msdos.sys)
;
if not {
{
echo 1
echo i
echo '[Options] '
echo 'Logo=0 '
echo .
echo w
echo q
} | ed /n/c:/msdos.sys>/dev/null>[2]/dev/null
}
}
if(grep -si '^\[paths\]' /n/c:/msdos.sys){ # Windows 9x rather than DOS
zeroopt Logo
# zeroopt BootGUI
}
echo 'Plan 9 added to Windows 9X boot menu.'
exit ''

View file

@ -0,0 +1,47 @@
#!/bin/rc
if(! c: || ! test -f /n/c:/boot.ini) {
echo 'Could not find NT''s boot.ini on the first FAT disk.'
exit bad
}
if(test -f /n/c:/boot.p9) {
echo 'A Plan 9 backup already exists; will not edit boot.ini again.'
exit bad
}
if(! cp /n/c:/boot.ini /n/c:/boot.p9) {
echo 'Could not back up boot.ini; will not continue.'
exit bad
}
chmod +w /n/c:/boot.ini
if(! grep -si '\[operating systems\]' /n/c:/boot.ini) {
echo 'Could not parse boot.ini.'
exit bad
}
if(grep -si 'Plan 9' /n/c:/boot.ini) {
p9file=`{grep 'Plan 9' /n/c:/boot.ini | sed 1q | sed 's/=.*//'}
if(! ~ $p9file [Cc]:'\'*) {
echo 'Unexpected Plan 9 entry in boot.ini already; not continuing.'
exit bad
}
}
if not {
p9file='c:\bootsect.p9'
echo 'c:\bootsect.p9 = "Plan 9 from Bell Labs" ' >>/n/c:/boot.ini
}
p9file=/n/^`{echo $p9file | sed 's!\\!/!g'}
if(dd -if /dev/$disk/plan9 -bs 512 -count 1 -of $p9file >/dev/null >[2]/dev/null) {
echo 'Plan 9 added to Windows NT boot menu.'
exit ''
}
echo 'Error copying Plan 9 boot sector to file.'
exit bad

View file

@ -0,0 +1,40 @@
#!/bin/rc
# desc: set source of distribution archives
# prereq: mountfs
switch($1) {
case go
echo
echo 'Will you be using a distribution archive on local media or the internet?'
echo
prompt 'Distribution is from' local internet
archmedium=$rd
export archmedium
switch($archmedium) {
case local
exec configlocal go
case internet
exec configip go
}
case checkdone
switch($#archmedium) {
case 1
switch($archmedium) {
case local
exec configlocal checkdone
case internet
exec configip checkdone
case *
configarch=notdone
export configarch
}
case *
configarch=notdone
export configarch
}
}

View file

@ -0,0 +1,22 @@
#!/bin/rc
# prereq: mountfs
# desc: choose the source of the distribution archive
switch($1){
case checkdone
if(! ~ $distisfrom net local){
configdist=ready
export configdist
}
case go
echo 'Are you going to download the distribution'
echo 'from the internet or do you have it on local media?'
echo
prompt -d local 'Distribution is from' local net
distisfrom=$rd
export distisfrom
}

View file

@ -0,0 +1,53 @@
#!/bin/rc
# desc: configure your internet connection via an ethernet card
switch($1) {
case go
echo
echo 'Please choose a method for configuring your ethernet connection.'
echo
echo ' manual - specify IP address, network mask, gateway IP address'
echo ' dhcp - use DHCP to automatically configure'
echo
prompt 'Configuration method' manual dhcp
ethermethod=$rd
gwaddr=xxx
ipaddr=xxx
ipmask=xxx
switch($ethermethod){
case dhcp
echo
echo 'Some ISPs, notably @HOME, require a host name passed with DHCP'
echo 'requests. An example for @HOME would be "cc1018221-a". If your'
echo 'ISP supplied you such a name, enter it.'
echo
prompt -d none 'host name'; dhcphost=$rd
switch($dhcphost){
case none
dhcphost=();
case *
dhcphost=(-h $dhcphost)
}
export dhcphost
case manual
prompt 'ip address'; ipaddr=$rd
prompt 'network mask'; ipmask=$rd
prompt 'gateway address'; gwaddr=$rd
export ipaddr ipmask gwaddr
}
export ethermethod gwaddr ipaddr ipmask dhcphost
exec startether go
case checkdone
if(! ~ $ethermethod manual dhcp) {
configether=notdone
export configether
}
if(~ $ethermethod manual && ~ 0 $#ipaddr $#ipmask $#gwaddr) {
configether=notdone
export configether
}
}

View file

@ -0,0 +1,23 @@
#!/bin/rc
# desc: choose the type of file system to install
switch($1){
case checkdone
if(! ~ $fstype fossil fossil+venti){
configfs=ready
export configfs
}
case go
echo 'You can install the following types of file systems:'
echo
echo ' fossil the new Plan9 fileserver'
echo ' fossil+venti fossil + a archival dump server'
echo
prompt -d fossil 'File system' fossil fossil+venti
fstype=$rd
export fstype
}

View file

@ -0,0 +1,64 @@
#!/bin/rc
switch($1) {
case go
devs=''
if(test -d '#l/ether0' >[2]/dev/null)
devs=$devs^ether
if(test -f '#t'/eia? >[2]/dev/null)
devs=$devs^ppp
switch($devs){
case ''
echo
echo 'Could not find ethernet card nor serial port nor modem.'
echo 'Please use a local copy of the distribution archive.'
echo
ifc=none
case ppp
echo
echo 'No ethernet card was detected, but there is a serial port or modem.'
echo 'We will configure PPP.'
echo
ifc=ppp
case ether
echo
echo 'No serial port or modem detected, but there is an ethernet card.'
echo 'We will configure the ethernet.'
echo
ifc=ether
case etherppp
echo
echo 'You can connect to the internet via'
echo 'a local ethernet or a dial-up PPP connection.'
echo
prompt 'Interface to use' ether ppp
ifc=$rd
}
ipinterface=$ifc
export ipinterface
switch($ifc) {
case ether
exec configether go
case ppp
exec configppp go
}
case checkdone
if(~ $#ipinterface 1)
switch($ipinterface) {
case ether
exec configether checkdone
case ppp
exec configppp checkdone
}
configarch=notdone
export configarch
}

View file

@ -0,0 +1,67 @@
#!/bin/rc
# prereq: configdist
# desc: configure the network to download the distribution
switch($1){
case checkready checkdone
if(! ~ $distisfrom net){
confignet=notdone
export confignet
exit
}
if(~ $distisfrom net && ~ $netisfrom ppp ether){
x=config$netisfrom
$x=done
config$netisfrom checkdone
confignet=$$x
export confignet
exit
}
confignet=ready
export confignet
exit
case go
devs=''
if(test -d '#l/ether0' >[2]/dev/null)
devs=$devs^ether
if(test -f '#t'/eia? >[2]/dev/null)
devs=$devs^ppp
switch($devs){
case ''
echo
echo 'Could not find ethernet card nor serial port nor modem.'
echo 'Please use a local copy of the distribution archive.'
echo
netisfrom=none
case ppp
echo
echo 'No ethernet card was detected, but there is a serial port or modem.'
echo 'We will configure PPP.'
echo
netisfrom=ppp
case ether
echo
echo 'No serial port or modem detected, but there is an ethernet card.'
echo 'We will configure the ethernet.'
echo
netisfrom=ether
case etherppp
echo
echo 'You can connect to the internet via'
echo 'a local ethernet or a dial-up PPP connection.'
echo
prompt 'Interface to use' ether ppp
netisfrom=$rd
}
export netisfrom
if(~ $netisfrom ether ppp)
exec config$netisfrom go
}

View file

@ -0,0 +1,63 @@
#!/bin/rc
# desc: configure your internet connection via ppp over a modem
switch($1) {
case go
devs=`{ls -p '#t/'eia? >[2]/dev/null}
if(~ $#devs 0) {
echo 'No serial port found; this can''t happen.' # because configip checks
exit
}
# not going to use the mouse for PPP
if(~ eia^$mouseport $devs)
devs=`{echo $devs | sed 's/eia'^$mouseport^'//'}
if(~ $#devs 0) {
echo 'The only serial port you have is your mouse.'
echo 'Cannot configure PPP.'
exit
}
echo
echo 'Please choose the serial port or modem to use to connect to your ISP.'
echo
for(i in $devs) {
n=`{echo $i | sed 's/eia//'}
n=`{hoc -e 1+$n}
echo ' '^$i^'(Windows'' COM'^$n^')'
}
echo
prompt 'Serial device' $devs
pppdev=$rd
echo
echo 'Pick a baud rate for the PPP connection.'
echo
prompt -d 115200 'Baud rate'
pppbaud=$rd
echo
echo 'You can specify your dialup phone number, username, and password,'
echo 'or you can log in manually by typing the modem commands yourself.'
echo
prompt 'Dialing method' auto manual
pppmethod=$rd
switch($pppmethod){
case auto
prompt 'PPP phone number'; pppphone=$rd
prompt 'PPP phone username'; pppuser=$rd
prompt 'PPP phone password'; ppppasswd=$rd
}
export pppdev pppmethod pppphone ppppasswd pppuser pppbaud
exec startppp go
case checkdone
if(! ~ $#pppmethod 1 || ! test -f /dev/$pppdev){
configppp=notdone
export configppp
}
}

View file

@ -0,0 +1,31 @@
#!/bin/rc
# prereq: mountdist
# desc: copy the distribution into the file system
switch($1){
case checkready
if(! test -d /n/dist/dist/replica){
copydist=notdone
export copydist
exit
}
if(test -f /n/newfs/dist/replica/didplan9){
copydist=done
export copydist
exit
}
case go
inst/watchfd applylog 0 `{ls -l /n/dist/dist/replica/plan9.log | awk '{print $6}'} 'Installing file system' &
replica/pull -c / /rc/bin/inst/replcfg
if(~ $status '' *conflicts || test -f /n/newfs/dist/replica/didplan9witherrors)
>/n/newfs/dist/replica/didplan9
if not
>/n/newfs/dist/replica/didplan9witherrors
case checkdone
if(! test -f /n/newfs/dist/replica/didplan9){
copydist=notdone
export copydist
}
}

162
sys/lib/dist.old/pc/inst/defs Executable file
View file

@ -0,0 +1,162 @@
nl='
'
tab=' '
if(~ $#distname 0)
distname=plan9
wctl=/dev/null
if(test -w /dev/wctl)
wctl=/dev/wctl
fn log {
echo $* >>/srv/log
}
fn logprog {
echo '% '^$"* >>/srv/log
$* >[2=1] >>/srv/log
}
fn sigint {
# nothing happens
}
fn prompt {
def=()
what=()
if(~ $1 -d && ! ~ $#* 1){
def=$2
shift
shift
}
optstr=()
if(~ $1 -w && ! ~ $#* 1){
optstr=$2
shift
shift
}
pr=$1
shift
opts=($*)
if(~ $#opts 0) {
suf=' '
}
if not if(! ~ $#optstr 0) {
if(~ $optstr '')
suf=' '
if not {
pr=$pr^' ('^$"optstr^')'
suf=''
}
}
if not {
pr=$pr^' ('^$1
shift
for(i)
pr=$pr^', '^$i
pr=$pr^')'
suf=''
}
if(~ $#def 1)
pr=$pr^$suf^'['^$def^']'
if not
pr=$pr^$suf^'[no default]'
pr=$pr^': '
okay=no
while(~ $okay no) {
echo -n current >$wctl
echo -n top >$wctl
echo -n $pr >[1=2]
ifs='' {rd=`{read}}
if(~ $#rd 0)
exit notdone
if(~ $rd !*){
ifs='' {rd=`{echo $rd | sed 's/!//'}}
echo $rd
rc -c $rd
echo !$status
}
if not{
rd=`{echo $rd}
if(~ $#rd 0 || ~ $rd '')
rd=$def
switch($#opts){
case 0
if(! ~ $rd '')
okay=yes
case *
if(~ $rd $opts)
okay=yes
}
}
}
echo -n $rd >/env/rd # just in case
}
fn desc {
echo -n ' '^$1^' - '
grep '^# desc: ' $1 | sed 's/# desc: //'
}
fn prereq {
grep '^# prereq:' $1 | sed 's/# prereq://'
}
fn mustdo {
echo You must `{grep '^# mustdo:' $1 | sed 's/# mustdo://'}
}
# there's no easy way to pass shell variables
# up from children to parents; the parents have
# to be coerced into noticing that the environment
# changed, even when in the same environment group.
#
# instead, we explicitly export the variables we want
# to percolate, and the parent calls coherence to reread
# the variables.
#
# we just append to the vars file, so that later exports
# override earlier ones; when we call coherence,
# the duplicates are thrown out.
fn export {
null=()
nonnull=()
for(i in $*){
if(~ $#$i 0)
null=($null $i)
if not
nonnull=($nonnull $i)
}
if(! ~ $#nonnull 0)
whatis $nonnull |grep -v '^\./' >>/tmp/vars >[2]/dev/null
for(i in $null)
echo $i^'=()' >>/tmp/vars
}
fn coherence {
if(test -f /tmp/vars) {
grep '^[a-z]*=' /tmp/vars >/tmp/vars2
v=`{sed 's/^([a-z]*)=.*/\1/' /tmp/vars2 | sort -u}
. /tmp/vars2
rm /tmp/vars2
rm /tmp/vars
export $v
}
}
# ip device stats
fn isipdevup {
grep -s $1 /net/ipifc/*/status >[2]/dev/null
}

View file

@ -0,0 +1,56 @@
#!/bin/rc
# prereq: mountfs
# desc: download or continue to download the distribution archives
switch($1) {
case checkready
devs=(`{cat /net/ipifc/*/status >[2]/dev/null |
grep -v '127\.0\.0\.1' |
sed 's/ .*//'})
if(~ $#devs 0) {
download=notdone
export download
}
if(~ $mountdist done){
download=notdone
export download
}
case go
if(! test -f /srv/cs) {
log starting cs, dns
logprog ndb/cs >>/srv/log >[2=1]
logprog ndb/dns -r >>/srv/log >[2=1]
}
if(! test -f /net/cs) {
logprog mount -a /srv/cs /net
logprog mount -a /srv/dns /net
}
# BUG make restartable
echo 'Downloading distribution package...'
baropt='-w 145,129,445,168'
if(~ $textinst 1)
baropt=-t
if(! hget -vo /n/newfs/dist/_plan9.iso.bz2 $installurl/plan9.iso.bz2 |[2] bargraph $baropt 'downloading '^plan9.iso.bz2)
exit
mv /n/newfs/dist/_plan9.iso.bz2 /n/newfs/dist/plan9.iso.bz2
if(~ $fstype fossil){
echo fsys main sync >>/srv/fscons
}
echo 'The distribution is downloaded.'
srvmedia=()
mountmedia=(mount /srv/fossil /n/distmedia)
distmediadir=/dist
export distmediadir mountmedia distmedia
case checkdone
if(! test -f /n/newfs/dist/plan9.iso.bz2) {
download=notdone
export download
}
}

19
sys/lib/dist.old/pc/inst/finish Executable file
View file

@ -0,0 +1,19 @@
#!/bin/rc
# desc: finish the installation and reboot
# prereq: bootsetup
# mustdo:
switch($1) {
case checkdone
finish=ready
export finish
case go
if(~ $cdboot yes){
echo 'Congratulations; you''ve completed the install.'
echo
halt
}
stop go finished
}

View file

@ -0,0 +1,91 @@
#!/bin/rc
# desc: initialize disks for a fossil server
# prereq: configfs
switch($1){
case checkready checkdone
if(! ~ $fstype fossil+venti fossil){
fmtfossil=notdone
export fmtfossil
exit
}
ff=`{ls /dev/sd*/fossil* /dev/fs/fossil* >[2]/dev/null}
if(~ $#ff 0){
fmtfossil=notdone
export fmtfossil
exit
}
gg=()
for(f in $ff)
if(isfossil $f)
gg=($gg $f)
if(~ $#gg 0){
fmtfossil=ready
export fmtfossil
exit
}
fmtfossil=done
export fmtfossil
exit
case go
ff=`{ls /dev/sd*/fossil* /dev/fs/fossil* >[2]/dev/null}
if(~ $#ff 0){
echo 'You need to create a partition or partitions to hold the Fossil write cache.'
echo 'The partition name must begin with "fossil".'
echo
fmtfossil=notdone
export fmtfossil
exit
}
default=()
if(~ $#ff 1){
default=(-d $ff)
}
echo You have the following fossil partitions.
echo
prompt $default 'Fossil partition to format' $ff
f=$rd
do=yes
if(isfossil $f){
echo $f appears to already be formatted as Fossil file system.
echo Do you really want to reformat it?
echo
prompt -d no 'Reformat '$f yes no
do=$rd
}
if(~ $do yes){
fossil/flfmt -y $f
n=`{cat /dev/swap | grep ' user' | sed 's/^[0-9]+\/([0-9]+) .*/\1/'}
if(test $n -gt 32768)
m=3000 # if have at least 128 user MB, use 24MB for fossil
if not if(test $n -gt 16384)
m=1500 # 64 user MB => 12MB for fossil
if not if(test $n -gt 8192)
m=750 # 32 user MB => 6MB for fossil
if not
m=256 # 2MB for fossil (this will be slow)
# if we're using a venti in the back, take hourly snapshots
# that retire after three days, in addition to the daily dumps at 5am
if(~ $fstype fossil+venti){
v=''
snap='fsys main snaptime -s 60 -a 0500 -t 2880'
}
# otherwise, take the daily dumps but nothing else --
# we can't retire snapshots unless dumps are being archived
if not{
v='-V'
snap=''
}
echo \
'fsys main config '^$f^'
fsys main open '^$v^' -c '^$m^'
'^$snap^'
' | fossil/conf -w $f
}
echo Done.
}

190
sys/lib/dist.old/pc/inst/fmtventi Executable file
View file

@ -0,0 +1,190 @@
#!/bin/rc
# desc: initialize disks for a venti server
# prereq: mountdist
switch($1){
case checkready checkdone
if(! ~ $fstype fossil+venti){
fmtventi=notdone
export fmtventi
exit
}
if(! test -e /bin/venti/fmtarenas || ! test -e /bin/venti/fmtisect || ! test -e /bin/venti/fmtindex){
bind -a /n/dist/386/bin/venti /bin/venti
if(! test -e /bin/venti/fmtarenas || ! test -e /bin/venti/fmtisect || ! test -e /bin/venti/fmtindex){
fmtventi=notdone
export fmtventi
exit
}
}
ff=`{ls /dev/sd*/arenas* /dev/fs/arenas* >[2]/dev/null}
if(~ $#ff 0){
fmtventi=notdone
export fmtventi
exit
}
gg=()
for(f in $ff)
if(isventi $f)
gg=($gg $f)
if(~ $#gg 0){
fmtventi=ready
export fmtventi
exit
}
ventiarena=$gg(1)
export ventiarena
fmtventi=done
export fmtventi
exit
case go
ff=`{ls /dev/sd*/arenas* /dev/fs/arenas* >[2]/dev/null}
if(~ $#ff 0){
echo 'You need to create a partition or partitions to hold the Venti arenas.'
echo 'The arena partition names must begin with "arenas".'
echo
fmtventi=notdone
export fmtventi
exit
}
default=(-d $"ff)
if(! ~ $#ventiarena 0){
default=(-d $"ventiarena)
}
echo You have the following Venti arena partitions.
ls -l $ff
echo
prompt $default 'Venti arena partitions to use'
aa=`{echo $rd}
bad=no
for(a in $aa){
if(! ~ $a $ff){
echo 'Bad venti arena partition' $a
fmtventi=notdone
export fmtventi
exit
}
}
ventiarena=$aa
export ventiarena
gg=`{ls /dev/sd*/isect* /dev/fs/isect* >[2]/dev/null}
if(~ $#gg 0){
echo 'You need to create a partition or partitions to hold the Venti indices.'
echo 'The index partition names must begin with "isect".'
echo
fmtventi=notdone
export fmtventi
exit
}
default=(-d $"gg)
if(! ~ $#ventiindex 0){
default=(-d $"ventiindex)
}
echo You have the following Venti index partitions.
ls -l $gg
echo
prompt $default 'Venti index partitions to use'
aa=`{echo $rd}
bad=no
for(a in $aa){
if(! ~ $a $gg){
echo 'Bad venti index partition' $a
fmtventi=notdone
export fmtventi
exit
}
}
ventiindex=$aa
export ventiindex
n=-1
fmta=()
for(a in $ventiarena){
do=yes
n=`{hoc -e 1+$n}
if(isventiarenas $a){
echo File $a is already formatted as a Venti arenas partition.
prompt -d no 'Reformat '$a yes no
do=$rd
}
if(~ $do yes)
fmta=($fmta arenas$n:$a)
}
n=-1
fmti=()
for(a in $ventiindex){
do=yes
n=`{hoc -e 1+$n}
if(isventiisect $a){
echo File $a is already formatted as a Venti index section.
prompt -d no 'Reformat '$a yes no
do=$rd
}
if(~ $do yes)
fmti=($fmti isect$n:$a)
}
echo Formatting Venti arenas and indices (this takes a while).
# do each disk in parallel
echo good >/tmp/fmt
dd=()
for(a in $fmta $fmti){
d=`{echo $a | sed 's!.*:(/.*/).*!\1!'}
if(! ~ $d $dd)
dd=($dd $d)
}
for(d in $dd){
{
for(a in $fmta){
i=`{echo $a | sed 's!(.*):(/.*/)(.*)!\1 \2 \2\3!'}
if(~ $i(2) $d){
echo $i(3) ...
venti/fmtarenas $i(1) $i(3) || echo bad >/tmp/fmt
echo done with $i(3)
}
}
for(a in $fmti){
i=`{echo $a | sed 's!(.*):(/.*/)(.*)!\1 \2 \2\3!'}
if(~ $i(2) $d){
echo $i(3) ...
venti/fmtisect $i(1) $i(3) || echo bad >/tmp/fmt
echo done with $i(3)
}
}
} &
}
wait
if(~ bad `{cat /tmp/fmt}){
echo There were errors formatting the indices and arenas.
fmtventi=ready
export fmtventi
exit errors
}
echo Done formatting Venti arenas and indices.
v=$ventiarena(1)
echo Storing Venti config on $v...
{
echo index main
for(i in $ventiindex)
echo isect $i
for(a in $ventiarena)
echo arenas $a
} | venti/conf -w $v
echo Initializing index...
venti/fmtindex $v
echo Done with Venti!
}

7
sys/lib/dist.old/pc/inst/gui Executable file
View file

@ -0,0 +1,7 @@
#!/bin/rc
cd /bin/inst
echo blanktime 0 >/dev/vgactl
. defs
startwin 640 480

18
sys/lib/dist.old/pc/inst/halt Executable file
View file

@ -0,0 +1,18 @@
#!/bin/rc
echo -n 'Halting file systems...'
if(ps | grep -s ' venti$')
venti/sync -h tcp!127.0.0.1!17034
if(ps | grep -s ' fossil$'){
echo fsys all halt >>/srv/fscons
slay fossil|rc
}
echo done
echo
echo Remember to take the install disk out of the drive.
echo Feel free to turn off your computer.
while()
sleep 3600

12
sys/lib/dist.old/pc/inst/hasmbr Executable file
View file

@ -0,0 +1,12 @@
#!/bin/rc
if(! ~ $#* 1) {
echo 'usage: hasmbr /dev/sdC0/part' >[1=2]
exit usage
}
x=`{xd -b $1 | sed -n '32p;32q'}
if(~ $x(16) 55 && ~ $x(17) aa)
exit ''
exit nope

7
sys/lib/dist.old/pc/inst/hdrs Executable file
View file

@ -0,0 +1,7 @@
#!/bin/rc
if(! ~ $#* 1) {
echo 'usage: hdrs file.9gz' >[1=2]
exit usage
}
gunzip < $1 | disk/mkext -h

12
sys/lib/dist.old/pc/inst/is9660 Executable file
View file

@ -0,0 +1,12 @@
#!/bin/rc
# 0000000 01 C D 0 0 1 01 00 P L A N 9
if(! ~ $#* 1) {
echo 'usage: is9660 /dev/sdC0/part' >[1=2]
exit usage
}
ifs=$nl {id=`{dd -if $1 -bs 2048 -skip 16>[2]/dev/null | xd -c | sed 1q | sed 's/.........(....................).*/\1/'}}
~ $id '01 C D 0 0 1 01'
exit $status

11
sys/lib/dist.old/pc/inst/isext2 Executable file
View file

@ -0,0 +1,11 @@
#!/bin/rc
if(! ~ $#* 1) {
echo 'usage: isext2 /dev/sdC0/part' >[1=2]
exit usage
}
cmp -s <{dd -if $1 -bs 1 -count 2 -skip 1080 >[2]/dev/null | xd -b |sed 1q} \
<{echo '0000000 53 ef'}
exit $status

22
sys/lib/dist.old/pc/inst/isfat Executable file
View file

@ -0,0 +1,22 @@
#!/bin/rc
rfork e
# 0000000 eb 3c 90 P l a n 9 . 0 0 00 02 04 02 00
# 0000010 02 00 02 02 P f8 14 00 ? 00 ff 00 ~ 04 } 00
# 0000020 02 P 00 00 80 00 ) a8 04 } 00 C Y L I N
# 0000030 D R I C A L F A T 1 6 fa 8c
if(! ~ $#* 1) {
echo 'usage: isfat /dev/sdC0/part' >[1=2]
exit usage
}
arg=$1
fn fat {
cmp -s <{dd -if $arg -bs 1 -count 3 -skip $1 >[2]/dev/null} <{echo -n FAT}
}
fat 54 || fat 82
exit $status

View file

@ -0,0 +1,16 @@
#!/bin/rc
if(! ~ $#* 1){
echo 'usage: isfossil /dev/sdC0/part' >[1=2]
exit usage
}
arg=$1
if(! cmp -s <{dd -quiet 1 -if $arg -bs 1024 -iseek 127 |
dd -quiet 1 -bs 14 -count 1} <{echo 'fossil config'})
exit noconfig
if(! cmp -s <{dd -quiet 1 -if $arg -bs 1024 -iseek 128 |
dd -quiet 1 -bs 4 -count 1 | xd -b | sed 1q} <{echo '0000000 37 76 ae 89'})
exit notwritebuffer
exit 0

View file

@ -0,0 +1,13 @@
#!/bin/rc
if(! ~ $#* 1){
echo 'usage: isventi /dev/sdC0/part' >[1=2]
exit usage
}
arg=$1
if(! cmp -s <{dd -quiet 1 -if $arg -bs 1024 -iseek 248 |
dd -quiet 1 -bs 13 -count 1} <{echo 'venti config'})
exit noconfig
exit 0

View file

@ -0,0 +1,13 @@
#!/bin/rc
if(! ~ $#* 1){
echo 'usage: isventiarenas /dev/sdC0/part' >[1=2]
exit usage
}
arg=$1
if(! cmp -s <{dd -quiet 1 -if $arg -bs 1024 -iseek 256 |
dd -quiet 1 -bs 4 -count 1 | xd -b | sed 1q} <{echo '0000000 a9 e4 a5 e7'})
exit notarenas
exit 0

View file

@ -0,0 +1,13 @@
#!/bin/rc
if(! ~ $#* 1){
echo 'usage: isventiisect /dev/sdC0/part' >[1=2]
exit usage
}
arg=$1
if(! cmp -s <{dd -quiet 1 -if $arg -bs 1024 -iseek 256 |
dd -quiet 1 -bs 4 -count 1 | xd -b | sed 1q} <{echo '0000000 d1 5c 5e c7'})
exit notisect
exit 0

115
sys/lib/dist.old/pc/inst/main Executable file
View file

@ -0,0 +1,115 @@
#!/bin/rc
. defs
while()
{
div=--------------------------------------
echo
echo $div
echo
echo -n 'Preparing menu...'
# must be topologically sorted (by prereq)
tasks=(\
configfs\
partdisk prepdisk\
fmtfossil\
mountfs\
configdist\
confignet\
mountdist\
fmtventi\
download\
copydist\
bootsetup finish stop\
stopether stopppp\
)
# startether startppp stopether stopppp download\
# these don't show up in the menu but still matter
pseudotasks=(configip havefiles etherup etherdown pppup pppdown)
for(i in $tasks $pseudotasks)
$i=notdone
coherence
for(i in $tasks $pseudotasks)
if(~ $#$i 0)
$i=notdone
#
# we believe the environment about what is done
# only if we've confirmed it. since the tasks list is sorted so that
# prereqs of xxx come before xxx, it's okay to assume xxx
# is done until proven otherwise -- either a prereq or checkdone
# will say so.
#
done=()
ready=()
rm /env/done
rm /env/ready
for(i in $tasks) {
$i=done
for(j in `{prereq $i})
if(! ~ $$j done)
$i=notdone
if(~ $$i done) {
export $i
$i checkdone
$i=`{grep '^'$i^'=' /tmp/vars | sed -n '$p' | sed 's/.*=//'}
}
if(~ $$i notdone ready) {
okay=yes
for(j in `{prereq $i})
if(! ~ $$j done)
okay=no
switch($okay){
case yes
$i=ready
export $i
$i checkready
$i=`{grep '^'$i^'=' /tmp/vars | sed -n '$p' | sed 's/.*=//'}
case no
$i=notdone
}
}
if(~ $$i done ready)
$$i=($$$i $i) # rc can be just as complicated as perl!
}
export $tasks $pseudotasks done ready
coherence
echo
if(! ~ $#done 0) {
echo 'The following tasks are done: '
for(i in $done)
desc $i
echo
}
echo 'The following unfinished tasks are ready to be done:'
for(i in $ready)
desc $i
echo
if(~ $#ready 0) {
echo hey you finished everything! not supposed to happen.
sleep 100
exit
}
prompt -d $ready(1) -w '' 'Task to do' $done $ready
echo
echo $div
$rd go
$rd=done # if it's not, the check will figure that out
export $rd
}

Some files were not shown because too many files have changed in this diff Show more