moveoldfs 1.3 KB

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