fn_deps_detect 1.4 KB

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. # LGSM fn_dep_detect function
  3. # Author: Daniel Gibbs
  4. # Website: http://gameservermanagers.com
  5. # Version: 200615
  6. # Description: Detects dependencies the server binary requires.
  7. local modulename="Backup"
  8. fn_check_root
  9. fn_check_systemdir
  10. cd ${executabledir}
  11. readelf -d ${executable} |grep NEEDED|awk '{ print $5 }'|sed 's/\[//g'|sed 's/\]//g' > ${rootdir}/.depdetect_readelf
  12. echo "yum install " > ${rootdir}/.depdetect_centos
  13. echo "apt-get install " > ${rootdir}/.depdetect_ubuntu
  14. echo "apt-get install " > ${rootdir}/.depdetect_debian
  15. while read lib; do
  16. sharedlib=${lib}
  17. if [ ${lib} == "libm.so.6" ]||[ ${lib} == "libc.so.6" ]||[ ${lib} == "libpthread.so.0" ]||[ ${lib} == "libdl.so.2" ]||[ ${lib} == "libnsl.so.1" ];then
  18. echo "glibc.i386" >> ${rootdir}/.depdetect_centos_list
  19. echo "lib32gcc1" >> ${rootdir}/.depdetect_ubuntu_list
  20. echo "lib32gcc1" >> ${rootdir}/.depdetect_debian_list
  21. elif [ ${lib} == "libstdc++.so.6" ];then
  22. echo "libstdc++.i686" >> ${rootdir}/.depdetect_centos_list
  23. echo "libstdc++6:i386" >> ${rootdir}/.depdetect_ubuntu_list
  24. echo "libstdc++6:i386" >> ${rootdir}/.depdetect_debian_list
  25. else
  26. echo "${lib}" >> ${rootdir}/.depdetect_unknown
  27. fi
  28. done < ${rootdir}/.depdetect_readelf
  29. uniq ${rootdir}/.depdetect_centos_list > ${rootdir}/.depdetect_centos_list_uniq
  30. uniq ${rootdir}/.depdetect_ubuntu_list > ${rootdir}/.depdetect_ubuntu_list_uniq
  31. uniq ${rootdir}/.depdetect_debian_list > ${rootdir}/.depdetect_debian_list_uniq