From bbc7649436772963621164ae6ddbb8475cb83791 Mon Sep 17 00:00:00 2001 From: Arpit Pathak <119810812+Thepathakarpit@users.noreply.github.com> Date: Fri, 16 Aug 2024 21:37:22 +0530 Subject: [PATCH 1/4] Create setup.sh Automated setup for verso in unix based operating systems. Signed-off-by: Arpit Pathak <119810812+Thepathakarpit@users.noreply.github.com> --- setup.sh | 38 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 38 insertions(+) create mode 100644 setup.sh diff --git a/setup.sh b/setup.sh new file mode 100644 index 00000000..887a2612 --- /dev/null +++ b/setup.sh @@ -0,0 +1,38 @@ +#!/bin/bash +# Display a message to the user +echo "Setting up Verso on Unix-based systems..." + +# Function to install packages on Linux and macOS +install_packages() { + if [[ "$OSTYPE" == "linux-gnu"* ]]; then + echo "Detected Linux. Installing dependencies..." + if [ -x "$(command -v apt-get)" ]; then + sudo apt-get update + sudo apt-get install -y git python3-pip llvm cmake curl + elif [ -x "$(command -v yum)" ]; then + sudo yum install -y git python3-pip llvm cmake curl + fi + elif [[ "$OSTYPE" == "darwin"* ]]; then + echo "Detected macOS. Installing dependencies via Homebrew..." + if ! command -v brew &> /dev/null; then + echo "Homebrew not found. Installing Homebrew..." + /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" + fi + brew install cmake pkg-config harfbuzz + else + echo "Unsupported OS: $OSTYPE" + exit 1 + fi +} + +# Install necessary packages +install_packages + +# Install Python dependencies +pip3 install mako + +# Build and run the project using Cargo +cargo run + +# Display completion message +echo "Setup complete." From de45e0c75dad5c50c48720c4648b9c1d83634a55 Mon Sep 17 00:00:00 2001 From: Arpit Pathak <119810812+Thepathakarpit@users.noreply.github.com> Date: Fri, 16 Aug 2024 21:38:15 +0530 Subject: [PATCH 2/4] Create setup.bat Automated setup for verso on Windows. Signed-off-by: Arpit Pathak <119810812+Thepathakarpit@users.noreply.github.com> --- setup.bat | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 setup.bat diff --git a/setup.bat b/setup.bat new file mode 100644 index 00000000..309818dd --- /dev/null +++ b/setup.bat @@ -0,0 +1,24 @@ +@echo off +REM Display a message to the user +echo Setting up Verso on Windows... + +REM Install Scoop (if not installed) +where scoop >nul 2>&1 +if %errorlevel% neq 0 ( + echo Scoop not found. Installing Scoop... + powershell -Command "Set-ExecutionPolicy RemoteSigned -scope CurrentUser" + powershell -Command "iwr -useb get.scoop.sh | iex" +) + +REM Install required tools via Scoop +scoop install git python llvm cmake curl + +REM Install Python dependencies +pip install mako + +REM Build and run the project using Cargo +cargo run + +REM Display completion message +echo Setup complete. Press any key to exit. +pause From 381534c1c8d6536279fcfaee0b2090a3d8dcc627 Mon Sep 17 00:00:00 2001 From: Arpit Pathak <119810812+Thepathakarpit@users.noreply.github.com> Date: Sat, 17 Aug 2024 08:40:38 +0530 Subject: [PATCH 3/4] Update setup.bat Added comments for letting users know what they are installing. Signed-off-by: Arpit Pathak <119810812+Thepathakarpit@users.noreply.github.com> --- setup.bat | 25 ++++++++++++++++--------- 1 file changed, 16 insertions(+), 9 deletions(-) diff --git a/setup.bat b/setup.bat index 309818dd..51bb2638 100644 --- a/setup.bat +++ b/setup.bat @@ -1,24 +1,31 @@ @echo off -REM Display a message to the user -echo Setting up Verso on Windows... +REM Ensure script is run as administrator +net session >nul 2>&1 +if not %errorLevel% == 0 ( + echo This script must be run as administrator. + pause + exit /b 1 +) -REM Install Scoop (if not installed) +REM Install Scoop if not already installed where scoop >nul 2>&1 -if %errorlevel% neq 0 ( - echo Scoop not found. Installing Scoop... - powershell -Command "Set-ExecutionPolicy RemoteSigned -scope CurrentUser" - powershell -Command "iwr -useb get.scoop.sh | iex" +if %errorLevel% neq 0 ( + echo Installing Scoop... + powershell -Command "Set-ExecutionPolicy RemoteSigned -Scope CurrentUser -Force; iex (new-object net.webclient).downloadstring('https://get.scoop.sh')" + set PATH=%PATH%;%USERPROFILE%\scoop\shims ) -REM Install required tools via Scoop +REM Install necessary tools using Scoop +echo Installing dependencies... scoop install git python llvm cmake curl REM Install Python dependencies +echo Installing Python dependencies... pip install mako REM Build and run the project using Cargo +echo Building the project... cargo run -REM Display completion message echo Setup complete. Press any key to exit. pause From eb6167fa60f9550a80cc3562041bf4a91b4c5156 Mon Sep 17 00:00:00 2001 From: Arpit Pathak <119810812+Thepathakarpit@users.noreply.github.com> Date: Sat, 17 Aug 2024 08:41:44 +0530 Subject: [PATCH 4/4] Update setup.sh Added support for pacman and Added comments for letting users know what they are installing. Signed-off-by: Arpit Pathak <119810812+Thepathakarpit@users.noreply.github.com> --- setup.sh | 62 ++++++++++++++++++++++++++++---------------------------- 1 file changed, 31 insertions(+), 31 deletions(-) diff --git a/setup.sh b/setup.sh index 887a2612..4edafcb0 100644 --- a/setup.sh +++ b/setup.sh @@ -1,38 +1,38 @@ #!/bin/bash -# Display a message to the user -echo "Setting up Verso on Unix-based systems..." - -# Function to install packages on Linux and macOS -install_packages() { - if [[ "$OSTYPE" == "linux-gnu"* ]]; then - echo "Detected Linux. Installing dependencies..." - if [ -x "$(command -v apt-get)" ]; then - sudo apt-get update - sudo apt-get install -y git python3-pip llvm cmake curl - elif [ -x "$(command -v yum)" ]; then - sudo yum install -y git python3-pip llvm cmake curl - fi - elif [[ "$OSTYPE" == "darwin"* ]]; then - echo "Detected macOS. Installing dependencies via Homebrew..." - if ! command -v brew &> /dev/null; then - echo "Homebrew not found. Installing Homebrew..." - /bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)" - fi - brew install cmake pkg-config harfbuzz - else - echo "Unsupported OS: $OSTYPE" - exit 1 - fi -} - -# Install necessary packages -install_packages + +# Ensure script is run as root +if [ "$(id -u)" != "0" ]; then + echo "This script must be run as root (use sudo)." + exit 1 +fi + +# Install necessary packages based on the package manager available +if [ -x "$(command -v apt-get)" ]; then + echo "Detected Debian-based system. Installing dependencies using apt-get." + sudo apt-get update + sudo apt-get install -y git python3-pip llvm cmake curl + +elif [ -x "$(command -v yum)" ]; then + echo "Detected Red Hat-based system. Installing dependencies using yum." + sudo yum install -y git python3-pip llvm cmake curl + +elif [ -x "$(command -v pacman)" ]; then + echo "Detected Arch-based system. Installing dependencies using pacman." + sudo pacman -Sy --needed git python-pip llvm cmake curl + +elif [ -x "$(command -v brew)" ]; then + echo "Detected macOS. Installing dependencies using Homebrew." + brew install git python3 llvm cmake curl + +else + echo "Unsupported OS or package manager. Please install dependencies manually." + exit 1 +fi # Install Python dependencies +echo "Installing Python dependencies..." pip3 install mako # Build and run the project using Cargo +echo "Building the project..." cargo run - -# Display completion message -echo "Setup complete."