lxc-bootstrap 1.5 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061
  1. #!/bin/bash -e
  2. #-e Causes bash script to exit if any of the installers
  3. #return with a non-zero return value.
  4. if [[ $EUID -ne 0 ]]; then
  5. echo "Please run as root user."
  6. exit 1
  7. fi
  8. dist=$1
  9. release=$2
  10. name=airtime-install
  11. set +e
  12. echo -e "\n * Stopping ${name}..."
  13. lxc-stop -n airtime-install
  14. echo "...Done"
  15. echo -e "\n * Destroying ${name}..."
  16. lxc-destroy -n airtime-install
  17. echo "...Done"
  18. set -e
  19. ###
  20. # ! NOTE: If you run into errors resolving the archives when running apt-get update,
  21. # clear your /var/cache/lxc directory and retry.
  22. ###
  23. echo -e "\n * Creating ${name} with dist ${dist} and release ${release}..."
  24. lxc-create -t ${dist} -n ${name} -- --release ${release}
  25. echo "...Done"
  26. echo -e "\n * Starting ${name}..."
  27. lxc-start -n ${name} -d
  28. echo "...Done"
  29. echo -e "\n * Running apt update..."
  30. lxc-attach -n ${name} -- apt-get update
  31. echo "...Done"
  32. echo -e "\n * Installing git..."
  33. lxc-attach -n ${name} -- apt-get -y --force-yes install git
  34. echo "...Done"
  35. echo -e "\n * Cloning Airtime..."
  36. lxc-attach -n ${name} -- git clone https://github.com/sourcefabric/Airtime.git /usr/share/Airtime --branch 2.5.x-installer-monitless --depth 1
  37. echo "...Done"
  38. echo -e "\n * Running installer..."
  39. lxc-attach -n ${name} -e -- /usr/share/Airtime/install -ifapdIv
  40. echo "...Done"
  41. IP=$(lxc-info -i -n ${name} -H)
  42. echo -e "\n * Opening ${name} in your browser..."
  43. if hash xdg-open 2>/dev/null; then
  44. xdg-open "http://${IP}/"
  45. elif hash gnome-open 2>/dev/null; then
  46. gnome-open "http://${IP}/"
  47. fi
  48. echo "...Done"