install 1.3 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374
  1. #!/bin/bash
  2. # Default instalation directory
  3. INSTALL_DIR="/usr/share/berusky2"
  4. function help() {
  5. echo "Berusky2 install script. It copies Berusky2 data at '$INSTALL_DIR'"
  6. echo "unless you specify a different directory. You may run it as root"
  7. echo "when you install it under /usr. Usage:"
  8. echo ""
  9. echo "install [OPTIONS]"
  10. echo ""
  11. echo "Options:"
  12. echo ""
  13. echo " -d --dir <install_dir> Target directory. The default is $INSTALL_DIR"
  14. echo " -h --help This help."
  15. echo ""
  16. }
  17. # Prepare command line arguments
  18. pass_arg_count=0
  19. while [ $# -gt $pass_arg_count ]
  20. do
  21. case "$1" in
  22. -h | --help)
  23. help
  24. exit
  25. ;;
  26. -d | --dir)
  27. if [ $# -gt 1 ]; then
  28. INSTALL_DIR="$2"
  29. shift 2
  30. else
  31. shift
  32. fi
  33. ;;
  34. *)
  35. echo "Unknown argument: '$1'"
  36. help
  37. exit
  38. ;;
  39. esac
  40. done
  41. if ! [ -x $INSTALL_DIR ]; then
  42. mkdir -p $INSTALL_DIR
  43. if ! [ $? ]; then
  44. echo "Unable to create a target directory! - '$INSTALL_DIR'"
  45. exit
  46. fi
  47. fi
  48. cp -r AUTHORS \
  49. COPYING \
  50. README \
  51. bitmap \
  52. data \
  53. game \
  54. game_data \
  55. items \
  56. materials \
  57. out \
  58. textures \
  59. music \
  60. sound \
  61. $INSTALL_DIR
  62. if ! [ $? ]; then
  63. echo "Unable to copy files at '$INSTALL_DIR'!"
  64. exit
  65. else
  66. echo "Installed at '$INSTALL_DIR'."
  67. fi