bash_functions.sh 1.3 KB

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