2022-07-18 18:31:13 +00:00
|
|
|
#!/bin/bash
|
|
|
|
|
2022-07-19 17:07:25 +00:00
|
|
|
YELLOW="\e[93m"
|
2022-07-19 00:08:13 +00:00
|
|
|
GREEN="\e[32m"
|
2022-07-18 19:24:25 +00:00
|
|
|
RED="\e[31m"
|
2022-07-18 18:31:13 +00:00
|
|
|
ENDCOLOR="\e[0m"
|
|
|
|
|
2022-07-19 17:07:25 +00:00
|
|
|
printMessage() {
|
2023-03-16 01:41:14 +00:00
|
|
|
printf "${YELLOW}AppFlowy : $1${ENDCOLOR}\n"
|
2022-07-19 17:07:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
printSuccess() {
|
2023-03-16 01:41:14 +00:00
|
|
|
printf "${GREEN}AppFlowy : $1${ENDCOLOR}\n"
|
2022-07-19 17:07:25 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
printError() {
|
2023-03-16 01:41:14 +00:00
|
|
|
printf "${RED}AppFlowy : $1${ENDCOLOR}\n"
|
2022-07-19 17:07:25 +00:00
|
|
|
}
|
|
|
|
|
2022-07-18 19:24:25 +00:00
|
|
|
# Note: This script does not install applications which are installed by the package manager. There are too many package managers out there.
|
2022-07-18 18:31:13 +00:00
|
|
|
|
2023-03-16 01:41:14 +00:00
|
|
|
# Install Rust
|
2022-07-19 17:07:25 +00:00
|
|
|
printMessage "The Rust programming language is required to compile AppFlowy."
|
|
|
|
printMessage "We can install it now if you don't already have it on your system."
|
2022-07-18 18:31:13 +00:00
|
|
|
|
2022-07-19 17:07:25 +00:00
|
|
|
read -p "$(printSuccess "Do you want to install Rust? [y/N]") " installrust
|
2022-07-18 18:31:13 +00:00
|
|
|
|
|
|
|
if [ ${installrust^^} == "Y" ]; then
|
2023-03-16 01:41:14 +00:00
|
|
|
printMessage "Installing Rust."
|
|
|
|
curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh
|
|
|
|
source $HOME/.cargo/env
|
|
|
|
rustup toolchain install stable
|
|
|
|
rustup default stable
|
2022-07-18 18:31:13 +00:00
|
|
|
else
|
2023-03-16 01:41:14 +00:00
|
|
|
printMessage "Skipping Rust installation."
|
2022-07-18 18:31:13 +00:00
|
|
|
fi
|
|
|
|
|
2022-07-19 17:07:25 +00:00
|
|
|
printMessage "Setting up Flutter"
|
2023-03-16 01:41:14 +00:00
|
|
|
# Get the current Flutter version
|
|
|
|
FLUTTER_VERSION=$(flutter --version | grep -oP 'Flutter \K\S+')
|
2023-05-28 04:09:39 +00:00
|
|
|
# Check if the current version is 3.10.1
|
|
|
|
if [ "$FLUTTER_VERSION" = "3.10.1" ]; then
|
|
|
|
echo "Flutter version is already 3.10.1"
|
2023-03-16 01:41:14 +00:00
|
|
|
else
|
|
|
|
# Get the path to the Flutter SDK
|
|
|
|
FLUTTER_PATH=$(which flutter)
|
|
|
|
FLUTTER_PATH=${FLUTTER_PATH%/bin/flutter}
|
|
|
|
|
|
|
|
current_dir=$(pwd)
|
|
|
|
|
|
|
|
cd $FLUTTER_PATH
|
2023-05-28 04:09:39 +00:00
|
|
|
# Use git to checkout version 3.10.1 of Flutter
|
|
|
|
git checkout 3.10.1
|
2023-03-16 01:41:14 +00:00
|
|
|
# Get back to current working directory
|
|
|
|
cd "$current_dir"
|
|
|
|
|
2023-05-28 04:09:39 +00:00
|
|
|
echo "Switched to Flutter version 3.10.1"
|
2023-03-16 01:41:14 +00:00
|
|
|
fi
|
2022-07-18 18:31:13 +00:00
|
|
|
|
|
|
|
# Enable linux desktop
|
|
|
|
flutter config --enable-linux-desktop
|
|
|
|
|
|
|
|
# Fix any problems reported by flutter doctor
|
|
|
|
flutter doctor
|
|
|
|
|
2022-12-15 04:00:26 +00:00
|
|
|
printMessage "Installing keybinder-3.0"
|
2023-03-16 01:41:14 +00:00
|
|
|
if command apt-get &>/dev/null; then
|
2022-12-15 04:00:26 +00:00
|
|
|
sudo apt-get install keybinder-3.0-dev
|
2023-03-16 01:41:14 +00:00
|
|
|
elif command dnf &>/dev/null; then
|
2022-12-15 04:00:26 +00:00
|
|
|
sudo dnf install keybinder3-devel
|
|
|
|
else
|
|
|
|
echo 'Your system is not supported, please install keybinder3 manually.'
|
|
|
|
fi
|
2022-08-08 09:12:27 +00:00
|
|
|
|
2022-07-18 18:31:13 +00:00
|
|
|
# Add the githooks directory to your git configuration
|
2022-07-19 17:07:25 +00:00
|
|
|
printMessage "Setting up githooks."
|
2022-07-18 18:31:13 +00:00
|
|
|
git config core.hooksPath .githooks
|
|
|
|
|
2023-03-16 01:41:14 +00:00
|
|
|
# Install go-gitlint
|
2022-07-25 16:02:33 +00:00
|
|
|
printMessage "Installing go-gitlint."
|
|
|
|
GOLINT_FILENAME="go-gitlint_1.1.0_linux_x86_64.tar.gz"
|
|
|
|
wget https://github.com/llorllale/go-gitlint/releases/download/1.1.0/${GOLINT_FILENAME}
|
2023-03-16 01:41:14 +00:00
|
|
|
tar -zxv --directory .githooks/. -f ${GOLINT_FILENAME} gitlint
|
2022-07-25 16:02:33 +00:00
|
|
|
rm ${GOLINT_FILENAME}
|
|
|
|
|
2022-07-18 18:31:13 +00:00
|
|
|
# Change to the frontend directory
|
|
|
|
cd frontend
|
|
|
|
|
|
|
|
# Install cargo make
|
2022-07-19 17:07:25 +00:00
|
|
|
printMessage "Installing cargo-make."
|
2022-07-18 18:31:13 +00:00
|
|
|
cargo install --force cargo-make
|
|
|
|
|
|
|
|
# Install duckscript
|
2022-07-19 17:07:25 +00:00
|
|
|
printMessage "Installing duckscript."
|
2022-07-18 18:31:13 +00:00
|
|
|
cargo install --force duckscript_cli
|
|
|
|
|
2022-07-18 19:24:25 +00:00
|
|
|
# Check prerequisites
|
2022-07-19 17:07:25 +00:00
|
|
|
printMessage "Checking prerequisites."
|
2023-01-17 08:27:17 +00:00
|
|
|
cargo make appflowy-flutter-deps-tools
|