function.sh 622 B

123456789101112131415161718192021222324252627
  1. L_SRV=login-server
  2. C_SRV=char-server
  3. M_SRV=map-server
  4. W_SRV=web-server
  5. INST_PATH=/opt
  6. PKG=rathena
  7. PKG_PATH="${INST_PATH}/${PKG}"
  8. check_files() {
  9. for i in ${L_SRV} ${C_SRV} ${M_SRV} ${W_SRV}
  10. do
  11. if [ ! -f ./$i ]; then
  12. echo "$i does not exist... exiting..."
  13. exit 1;
  14. fi
  15. done
  16. }
  17. check_inst_right(){
  18. if [ ! -w "${INST_PATH}" ]; then echo "You must have sudo right to use this install (write/read permission in ${INST_PATH}/ )" && exit; fi
  19. }
  20. inst_launch_workaround(){
  21. if [ -d "${PKG_PATH}" ]; then
  22. if [ "$(pwd)" != "${PKG_PATH}" ]; then cd "${PKG_PATH}"; fi
  23. fi
  24. }