install.sh 1.3 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243
  1. #!/bin/sh
  2. #source var/function
  3. . ./function.sh
  4. #read -p "WARNING: This script is experimental. Press Ctrl+C to cancel or Enter to continue." readEnterKey
  5. # NOTE: This requires GNU getopt. On Mac OS X and FreeBSD, you have to install this
  6. # separately; see below.
  7. TEMP=`getopt -o d: -l destdir: -- "$@"`
  8. if [ $? != 0 ] ; then echo "Terminating..." >&2 ; exit 1 ; fi
  9. # Note the quotes around `$TEMP': they are essential!
  10. eval set -- "$TEMP"
  11. eval set -- "$TEMP"
  12. while [ $# -gt 0 ]
  13. do
  14. case "$1" in
  15. (-d | --destdir) PKG_PATH="$2"; shift;;
  16. esac
  17. shift
  18. done
  19. echo "destdir = $PKG_PATH "
  20. check_inst_right
  21. check_files
  22. mkdir -p $PKG_PATH/bin/
  23. mkdir -p $PKG_PATH/etc/$PKG/conf
  24. mkdir -p $PKG_PATH/var/$PKG/log
  25. #we copy all file into opt/ dir and treat dir like normal unix arborescence
  26. cp -r db/ $PKG_PATH/var/$PKG/db
  27. if [ -d log ]; then cp -r log/ $PKG_PATH/var/$PKG/log; fi
  28. cp -r conf/ $PKG_PATH/etc/$PKG/conf
  29. cp -r npc/ $PKG_PATH/npc
  30. cp athena-start $PKG_PATH/
  31. mv *-server* $PKG_PATH/bin/
  32. ln -fs $PKG_PATH/var/$PKG/db/ $PKG_PATH/db
  33. ln -fs $PKG_PATH/var/$PKG/log/ $PKG_PATH/log
  34. ln -fs $PKG_PATH/etc/$PKG/conf/ $PKG_PATH/conf
  35. ln -fs $PKG_PATH/athena-start /usr/bin/$PKG
  36. for f in $(ls $PKG_PATH/bin/) ; do ln -fs $PKG_PATH/bin/$f $PKG_PATH/$f; done
  37. echo "Installation is done. You can now control the server with '$PKG start'"