1
0

backuparenas 1.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263
  1. #!/bin/rc
  2. # backuparenas dev name ... - dump arena `name' from $fs to blu-ray disc.
  3. # assumes $set is set.
  4. rfork ne
  5. # tunable variables
  6. fs=pie
  7. if (test -e /sys/lib/backup/funcs)
  8. . /sys/lib/backup/funcs
  9. exits=''
  10. fsroot=/n/$fs
  11. if (! test -e $fsroot/!THIS_IS_^`{echo $fs | tr a-z A-Z}^_MAIN) {
  12. import $fs / $fsroot || exit
  13. }
  14. unmount /mnt/cd >[2]/dev/null
  15. cdfs -d $1 || exit
  16. shift
  17. done=no
  18. echo -n figuring out disc type...
  19. for (i in `{seq 1 20})
  20. if (~ $done no) {
  21. m=`{ls -l /mnt/cd | grep bd-r-dl}
  22. if (~ $m '' ()) {
  23. echo -n .
  24. sleep 3
  25. }
  26. if not
  27. done=yes
  28. }
  29. echo
  30. ls -l /mnt/cd
  31. grep next /mnt/cd/ctl
  32. echo -n 'nwa ok? '
  33. ok=`{read}
  34. if (! ~ $ok [Yy]*)
  35. exit bad-nwa
  36. cd $fsroot/dev/fs
  37. shname = `{basename $arenas}
  38. if (! test -r $shname){
  39. echo $0: $shname in `{pwd} not readable >[1=2]
  40. exit unreadable-arenas
  41. }
  42. for (name) {
  43. grep next /mnt/cd/ctl
  44. # use -o 8192 to avoid devmnt fragmentation if bd drive is imported
  45. venti/rdarena $shname $name |
  46. pump -i 65536 -o 8192 -k 100000 -d 5 >/mnt/cd/wd/$name
  47. # pump -i 65536 -o 1048576 -k 51200 -d 10 >/mnt/cd/wd/$name
  48. quitonfailure $status
  49. # ls -l /mnt/cd
  50. if (test -e '/env/fn#dumpdone' -a -e '/env/set')
  51. dumpdone $shname $name
  52. }
  53. echo 'remember to *not* remove /mnt/cd/wd' >[1=2]
  54. # don't remove /mnt/cd/wd, since that would finalize the disc
  55. # and bugger the permanent toc, at least on bd-r.
  56. exit ''