backuparenas 1.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  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. for (name) {
  38. grep next /mnt/cd/ctl
  39. # use -o 8192 to avoid devmnt fragmentation if bd drive is imported
  40. venti/rdarena arena0 $name |
  41. pump -i 65536 -o 8192 -k 100000 -d 5 >/mnt/cd/wd/$name
  42. # pump -i 65536 -o 1048576 -k 51200 -d 10 >/mnt/cd/wd/$name
  43. quitonfailure $status
  44. # ls -l /mnt/cd
  45. if (test -e '/env/fn#dumpdone' -a -e '/env/set')
  46. dumpdone arena0 $name
  47. }
  48. echo 'remember to *not* remove /mnt/cd/wd' >[1=2]
  49. # don't remove /mnt/cd/wd, since that would finalize the disc
  50. # and bugger the permanent toc, at least on bd-r.
  51. exit ''