download.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/bin/bash
  2. { # this ensures the entire script is downloaded #
  3. lsb_release -d | grep 'Ubuntu' >& /dev/null
  4. [[ $? -ne 0 ]] && { echo "仅支持 Ubuntu 16.04 系统"; exit 1; }
  5. DISTRO=$(lsb_release -c -s)
  6. [[ ${DISTRO} -ne "xenial" ]] && { echo "仅支持 Ubuntu 16.04 系统"; exit 1; }
  7. green="\e[1;32m"
  8. nc="\e[0m"
  9. echo -e "${green}===> 开始下载...${nc}"
  10. cd $HOME
  11. wget -q https://github.com/summerblue/laravel-ubuntu-init/archive/master.tar.gz -O laravel-ubuntu-init.tar.gz
  12. rm -rf laravel-ubuntu-init
  13. tar zxf laravel-ubuntu-init.tar.gz
  14. mv laravel-ubuntu-init-master laravel-ubuntu-init
  15. rm -f laravel-ubuntu-init.tar.gz
  16. echo -e "${green}===> 下载完毕${nc}"
  17. echo ""
  18. echo -e "${green}安装脚本位于: ${HOME}/laravel-ubuntu-init${nc}"
  19. [ $(id -u) != "0" ] && {
  20. source ${HOME}/laravel-ubuntu-init/common/ansi.sh
  21. ansi -n --bold --bg-yellow --black "当前账户并非 root,请用 root 账户执行安装脚本(使用命令:sudo -H -s 切换为 root)"
  22. } || {
  23. bash ./laravel-ubuntu-init/16.04/install.sh
  24. }
  25. cd - > /dev/null
  26. } # this ensures the entire script is downloaded #