mk_distr_syms 616 B

12345678910111213141516171819202122232425262728293031323334353637383940
  1. #!/bin/sh
  2. : Utility to make a tree of symbolic links to source tree.
  3. : Mount the source tree read-only, use this script, and then try installation.
  4. case $# in
  5. 2) ;;
  6. *) echo "Usage: $0 <source-tree> <symlink-tree>" 1>&2
  7. exit 1
  8. ;;
  9. esac
  10. if [ -f $1/.distr ]
  11. then
  12. for i in `cat $1/.distr`
  13. do
  14. if [ -d $1/$i ]
  15. then
  16. if mkdir $2/$i && $0 $1/$i $2/$i
  17. then
  18. :
  19. else
  20. exit 2
  21. fi
  22. else
  23. if [ -f $1/$i ]
  24. then
  25. if ln -s $1/$i $2/$i
  26. then
  27. :
  28. else
  29. exit 3
  30. fi
  31. else
  32. echo "Missing file $1/$i" 1>&2
  33. exit 4
  34. fi
  35. fi
  36. done
  37. else
  38. echo "No .distr file in $1" 1>&2
  39. exit 5
  40. fi