xref: /plan9/sys/lib/dist/pc/inst/moveoldfs (revision 375daca8932d0755549a5f8e4d068a24a49927d4)
1#!/bin/rc
2
3# desc: move an old third edition plan 9 file system out of the way
4# prereq: mountfs
5
6rootfiles=(\
7	386\
8	68000\
9	68020\
10	LICENSE\
11	NOTICE\
12	acme\
13	adm\
14	alpha\
15	arm\
16	cron\
17	dist\
18	fd\
19	lib\
20	lp\
21	mail\
22	mips\
23	mnt\
24	n\
25	power\
26	rc\
27	sparc\
28	sys\
29	tmp\
30	usr/glenda\
31	wrap\
32)
33
34switch($1){
35case checkready
36	if(! test -d /n/kfs/wrap){
37		moveoldfs=done
38		export moveoldfs
39	}
40
41case go
42	if(test -d /n/kfs/wrap){
43		echo 'You have a Third Edition Plan 9 installation on '^$fs^'.'
44		echo 'We need to move the old file system out of the way (into /3e)'
45		echo 'in order to continue.'
46		echo
47		prompt 'Move old file system' y n
48		switch($rd){
49		case y
50			kname=`{kfsname $fs}
51			log Moving old Plan 9 installation into /3e on kfs
52			logprog disk/kfscmd -n$kname 'create /3e sys sys 555 d' >>[2]/srv/log
53			logprog disk/kfscmd -n$kname 'create /3e/usr sys sys 555 d' >>[2]/srv/log
54			for(i in $rootfiles)
55				if(test -e /n/kfs/$i)
56					logprog disk/kfscmd -n$kname 'rename /'^$i^' /3e/'^$i
57			# copy extant /adm/users in case there have been modifications
58			logprog disk/kfscmd -n$kname 'create /adm adm adm 555 d' >>[2]/srv/log
59			logprog cp /n/kfs/3e/adm/users /n/kfs/adm/users >>[2]/srv/log
60
61		case n
62			echo 'Okay, but we can''t continue.'
63			echo
64		}
65	}
66
67case checkdone
68	if(test -d /n/kfs/wrap){
69		moveoldfs=notdone
70		export moveoldfs
71	}
72}
73