setupdirs 408 B

12345678910111213141516171819202122232425262728293031323334
  1. #!/bin/rc
  2. rfork en
  3. if(! ~ $#libreplica 1)
  4. libreplica=$home/lib/replica
  5. fn usage {
  6. echo 'usage: replica/setupdirs' >[1=2]
  7. exit usage
  8. }
  9. fn fatal {
  10. echo $* >[1=2]
  11. exit $"*
  12. }
  13. fn must {
  14. $* || fatal $"*^': '^$status
  15. }
  16. if(! ~ $#* 0)
  17. usage
  18. for (i in \
  19. $libreplica\
  20. $libreplica/db\
  21. $libreplica/db/client\
  22. $libreplica/db/server\
  23. $libreplica/log\
  24. $libreplica/cfg)
  25. if(! test -d $i)
  26. must mkdir $i