bash_functions.sh 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758
  1. #!/bin/sh
  2. # If you are running a large number of installs back to back
  3. # (e.g. for FwBm development), then setting this variable
  4. # will cause apt-get and wget to use your proxy server. If
  5. # your proxy server has a cache for static content, this can
  6. # save you quite a lot of download time
  7. # export http_proxy=http://10.0.1.0:3128
  8. fw_get () {
  9. wget --no-check-certificate --trust-server-names "$@"
  10. }
  11. fw_untar() {
  12. # tar xzf "$@"
  13. tar xvzf "$@"
  14. }
  15. fw_unzip() {
  16. unzip "$@"
  17. }
  18. # Requires dependencies to come in order e.g. Nimrod before
  19. # Jester, etc. Users should be know this
  20. # fairly well (e.g. you can't use Yaf without PHP)
  21. fw_depends() {
  22. for depend in "$@"
  23. do
  24. echo Searching for $depend
  25. if [ -f ../toolset/setup/linux/systools/${depend}.sh ]; then
  26. echo Installing system tool: $depend
  27. sh ../toolset/setup/linux/systools/${depend}.sh
  28. fi
  29. if [ -f ../toolset/setup/linux/languages/${depend}.sh ]; then
  30. echo Installing language: $depend
  31. sh ../toolset/setup/linux/languages/${depend}.sh
  32. fi
  33. if [ -f ../toolset/setup/linux/webservers/${depend}.sh ]; then
  34. echo Installing webserver: $depend
  35. sh ../toolset/setup/linux/webservers/${depend}.sh
  36. fi
  37. if [ -f ../toolset/setup/linux/frameworks/${depend}.sh ]; then
  38. echo Installing framework: $depend
  39. sh ../toolset/setup/linux/frameworks/${depend}.sh
  40. fi
  41. done
  42. }
  43. # Exits 0 if file or directory exists
  44. fw_exists() {
  45. if [ -f $1 ] || [ -d $1 ]; then
  46. return 0
  47. else
  48. return 1
  49. fi
  50. }