install_linux.sh 2.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899
  1. #!/bin/bash
  2. YELLOW="\e[93m"
  3. GREEN="\e[32m"
  4. RED="\e[31m"
  5. ENDCOLOR="\e[0m"
  6. printMessage() {
  7. printf "${YELLOW}AppFlowy : $1${ENDCOLOR}\n"
  8. }
  9. printSuccess() {
  10. printf "${GREEN}AppFlowy : $1${ENDCOLOR}\n"
  11. }
  12. printError() {
  13. printf "${RED}AppFlowy : $1${ENDCOLOR}\n"
  14. }
  15. # Note: This script does not install applications which are installed by the package manager. There are too many package managers out there.
  16. # Install Rust
  17. printMessage "The Rust programming language is required to compile AppFlowy."
  18. printMessage "We can install it now if you don't already have it on your system."
  19. read -p "$(printSuccess "Do you want to install Rust? [y/N]") " installrust
  20. if [ ${installrust^^} == "Y" ]; then
  21. printMessage "Installing Rust."
  22. curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
  23. source $HOME/.cargo/env
  24. rustup toolchain install stable
  25. rustup default stable
  26. else
  27. printMessage "Skipping Rust installation."
  28. fi
  29. printMessage "Setting up Flutter"
  30. # Get the current Flutter version
  31. FLUTTER_VERSION=$(flutter --version | grep -oP 'Flutter \K\S+')
  32. # Check if the current version is 3.7.5
  33. if [ "$FLUTTER_VERSION" = "3.7.5" ]; then
  34. echo "Flutter version is already 3.7.5"
  35. else
  36. # Get the path to the Flutter SDK
  37. FLUTTER_PATH=$(which flutter)
  38. FLUTTER_PATH=${FLUTTER_PATH%/bin/flutter}
  39. current_dir=$(pwd)
  40. cd $FLUTTER_PATH
  41. # Use git to checkout version 3.7.5 of Flutter
  42. git checkout 3.7.5
  43. # Get back to current working directory
  44. cd "$current_dir"
  45. echo "Switched to Flutter version 3.7.5"
  46. fi
  47. # Enable linux desktop
  48. flutter config --enable-linux-desktop
  49. # Fix any problems reported by flutter doctor
  50. flutter doctor
  51. printMessage "Installing keybinder-3.0"
  52. if command apt-get &>/dev/null; then
  53. sudo apt-get install keybinder-3.0-dev
  54. elif command dnf &>/dev/null; then
  55. sudo dnf install keybinder3-devel
  56. else
  57. echo 'Your system is not supported, please install keybinder3 manually.'
  58. fi
  59. # Add the githooks directory to your git configuration
  60. printMessage "Setting up githooks."
  61. git config core.hooksPath .githooks
  62. # Install go-gitlint
  63. printMessage "Installing go-gitlint."
  64. GOLINT_FILENAME="go-gitlint_1.1.0_linux_x86_64.tar.gz"
  65. wget https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME}
  66. tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint
  67. rm ${GOLINT_FILENAME}
  68. # Change to the frontend directory
  69. cd frontend
  70. # Install cargo make
  71. printMessage "Installing cargo-make."
  72. cargo install --force cargo-make
  73. # Install duckscript
  74. printMessage "Installing duckscript."
  75. cargo install --force duckscript_cli
  76. # Check prerequisites
  77. printMessage "Checking prerequisites."
  78. cargo make appflowy-flutter-deps-tools