Skip to content

Commit

Permalink
Merge pull request #186 from sinamics/install_patch
Browse files Browse the repository at this point in the history
Changes added by @tinola
  • Loading branch information
sinamics committed Oct 27, 2023
2 parents 5e452fb + f81d7ef commit 84144bf
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 5 deletions.
12 changes: 10 additions & 2 deletions install.ztnet/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,19 @@ This is the code and installation scripts running at install.ztnet.network.
### Installation Steps for Debian and Ubuntu

1. Open a terminal window.
2. Run the following command to download and execute the installation script:
2. Install curl if it is not already installed:
```bash
sudo apt update && sudo apt install curl
```
3. Run the following command to download and execute the installation script:

**!NOTE:** if you system does not have sudo installed, you will need to run the script as root and remove the sudo from the command below.

```bash
curl -s http://install.ztnet.network | sudo bash
```
3. Follow any on-screen instructions to complete the installation.

4. Follow any on-screen instructions to complete the installation.

After completing these steps, ztnet should be successfully installed on your system.

Expand Down
13 changes: 10 additions & 3 deletions install.ztnet/bash/ztnet.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
#!/bin/bash

# Check if the script is run as root (sudo)
if [[ $EUID -ne 0 ]]; then
echo "This script must be run as root (sudo). Exiting."
exit 1
fi

# exit if any command fails
set -e

Expand Down Expand Up @@ -46,7 +52,7 @@ fi
printf "\n\n${YELLOW}Welcome to the installation script.${NC}\n"
printf "${YELLOW}This script will perform the following actions:${NC}\n"
printf " 1. Check if PostgreSQL is installed. If not, it will be installed.\n"
printf " 2. Check if Node.js version 18 is installed. If not, it will be installed.\n"
printf " 2. Check if Node.js version "$NODE_MAJOR" is installed. If not, it will be installed.\n"
printf " 3. Clone ztnet repo into /tmp folder and build artifacts .\n"
printf " 4. Copy artifacts to /opt/ztnet folder.\n"
printf "${YELLOW}Please note:${NC}\n"
Expand All @@ -72,6 +78,7 @@ if ! command_exists openssl; then
sudo apt install openssl -y
fi


# Remove directories and then recreate the target directory
rm -rf "$INSTALL_DIR" "$TARGET_DIR/.next" "$TARGET_DIR/prisma" "$TARGET_DIR/src"
mkdir -p "$TARGET_DIR"
Expand All @@ -95,12 +102,12 @@ if ! command_exists psql; then
fi
fi

# Install Node.js if it's not installed or if installed version is not 18
# Install Node.js if it's not installed or if installed version is not the number defined in 'NODE_MAJOR' variable
if ! command_exists node; then
INSTALL_NODE=true
else
NODE_VERSION=$(node -v | cut -d 'v' -f 2 | cut -d '.' -f 1)
if [ "$NODE_VERSION" -lt 18 ]; then
if [ $NODE_VERSION -lt $NODE_MAJOR ]; then
INSTALL_NODE=true
fi
fi
Expand Down

0 comments on commit 84144bf

Please sign in to comment.