install.sh 900 B

123456789101112131415161718192021222324252627282930313233343536
  1. #!/bin/bash
  2. branch="master"
  3. tar="https://codeload.github.com/calmh/zsnapper/tar.gz/$branch"
  4. instdir="/opt/local"
  5. config="/opt/local/etc/zsnapper.ini"
  6. smf="/opt/custom/smf/zsnapper.xml"
  7. fail() {
  8. echo Installation failed
  9. exit -1
  10. }
  11. echo "Installing into $instdir/zsnapper."
  12. cd "$instdir" || fail
  13. [ -d zsnapper.previous ] && rm -rf zsnapper.previous
  14. [ -d zsnapper ] && mv zsnapper zsnapper.previous
  15. ( curl -sk "$tar" | gtar zxf - ) || fail
  16. mv "zsnapper-$branch" zsnapper || fail
  17. if [ ! -f "$config" ] ; then
  18. echo "No config file, installing default into $config."
  19. cp zsnapper/zsnapper.ini "$config" || fail
  20. fi
  21. if [ ! -f "$smf" ] ; then
  22. echo "No SMF manifest, installing into $smf."
  23. cp zsnapper/zsnapper.xml "$smf" || fail
  24. fi
  25. echo
  26. echo "Installation complete."
  27. echo " 1. Edit the config file $config to taste."
  28. echo " 2. Import the SMF manifest to start the service:"
  29. echo " svccfg import $smf"