From 0f7ddd2f14acff13e9529ee37bbe17c2c2bdbae4 Mon Sep 17 00:00:00 2001 From: Varrooo <131566087+Varrooo@users.noreply.github.com> Date: Tue, 19 Dec 2023 15:20:13 +0100 Subject: [PATCH] Fixs/reviews setups (#3067) * update syntax to POSIX The function keyword is not recognize by every POSIX-compliant shell. The function keyword is a bashism, a bash extension. POSIX syntax does not use function and mandates the use of parenthesis. This commit fixes the two issues : ./linux/provision-postgres-linux.sh: 9: function: not found ./linux/provision-postgres-linux.sh: 15: Syntax error: "}" unexpected * update path init.sql * update steps numbers yarn setup There were two number 3's, everything should be correct now. * delete useless -e --- .../docs/contributor/local-setup/yarn-setup.mdx | 6 +++--- .../linux/provision-postgres-linux.sh | 14 +++++++------- 2 files changed, 10 insertions(+), 10 deletions(-) diff --git a/packages/twenty-docs/docs/contributor/local-setup/yarn-setup.mdx b/packages/twenty-docs/docs/contributor/local-setup/yarn-setup.mdx index 736ce06a58d..df1986565e1 100644 --- a/packages/twenty-docs/docs/contributor/local-setup/yarn-setup.mdx +++ b/packages/twenty-docs/docs/contributor/local-setup/yarn-setup.mdx @@ -154,7 +154,7 @@ You can access this using `twenty` postgres user (password: `twenty`) -## Step 3: Setup environment variables +## Step 4: Setup environment variables Twenty requires you to set some environment variables. Locally, you should set them through a `.env` file. @@ -164,7 +164,7 @@ cp ./packages/twenty-front/.env.example ./packages/twenty-front/.env cp ./packages/twenty-server/.env.example ./packages/twenty-server/.env ``` -## Step 4: Installing dependencies +## Step 5: Installing dependencies :::info @@ -180,7 +180,7 @@ nvm use #recommended yarn ``` -## Step 5: Running the project +## Step 6: Running the project Setup your database with the following command: ```bash diff --git a/packages/twenty-postgres/linux/provision-postgres-linux.sh b/packages/twenty-postgres/linux/provision-postgres-linux.sh index 14249c27406..39b77f57d40 100755 --- a/packages/twenty-postgres/linux/provision-postgres-linux.sh +++ b/packages/twenty-postgres/linux/provision-postgres-linux.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/bin/sh # Colors RED=31 @@ -6,16 +6,16 @@ GREEN=32 BLUE=34 # Function to display colored output -function echo_header { +echo_header () { COLOR=$1 MESSAGE=$2 - echo -e "\e[${COLOR}m\n=======================================================\e[0m" - echo -e "\e[${COLOR}m${MESSAGE}\e[0m" - echo -e "\e[${COLOR}m=======================================================\e[0m" + echo "\e[${COLOR}m\n=======================================================\e[0m" + echo "\e[${COLOR}m${MESSAGE}\e[0m" + echo "\e[${COLOR}m=======================================================\e[0m" } # Function to handle errors -function handle_error { +handle_error () { echo_header $RED "Error: $1" exit 1 } @@ -75,5 +75,5 @@ fi # Run the init.sql to setup database echo_header $GREEN "Step [4/4]: Setting up database..." -cp ./postgres/init.sql /tmp/init.sql +cp ./init.sql /tmp/init.sql sudo -u postgres psql -f /tmp/init.sql || handle_error "Failed to execute init.sql script."