Skip to content

How to install Toshy with a single command

RedBearAK edited this page Aug 20, 2024 · 5 revisions

Quick install command (no options)

Copy and paste this into a terminal for a one-command install:

URL="https://github.com/RedBearAK/toshy/archive/refs/heads/main.zip" && FN="toshy_$(date +%Y%m%d_%H%M)" && cd ~/Downloads && (curl -L "$URL" -o "$FN.zip" || wget "$URL" -O "$FN.zip" || { echo "Download failed."; exit 1; }) && mkdir -p "$FN" && unzip -o "$FN.zip" -d "$FN" || { echo "Extract failed. No unzip command?"; exit 1; } && cd "$FN/toshy-main" && (./setup_toshy.py install || echo "Setup script execution failed.")

Or, here is the same command using backslashes to separate it into different lines:

URL="https://github.com/RedBearAK/toshy/archive/refs/heads/main.zip" && \
FN="toshy_$(date +%Y%m%d_%H%M)" && \
cd ~/Downloads && \
(curl -L "$URL" -o "$FN.zip" || \
 wget "$URL" -O "$FN.zip" || \
 { echo "Download failed."; exit 1; }) && \
mkdir -p "$FN" && \
unzip -o "$FN.zip" -d "$FN" || \
{ echo "Extract failed. No unzip command?"; exit 1; } && \
cd "$FN/toshy-main" && \
(./setup_toshy.py install || echo "Setup script execution failed.")

This single command doesn't give you a chance to use any of the installer options, but if it doesn't work you can still re-run the downloaded installer again with appropriate options. See below for details about what each part of the command does.

Explanation of the command sections

  1. Set URL and Filename: The URL variable is set to the location of the GitHub zip file, and FN is set to a timestamped filename to ensure uniqueness for each run of the quick install command.
URL="https://github.com/RedBearAK/toshy/archive/refs/heads/main.zip" && FN="toshy_$(date +%Y%m%d_%H%M)"
  1. Change Directory: Changes to the ~/Downloads directory to manage file downloads.
cd ~/Downloads
  1. Download File: Attempts to download the latest zip file using curl. If curl is not available, it uses wget. An error message is displayed if both methods fail.
curl -L "$URL" -o "$FN.zip" || wget "$URL" -O "$FN.zip" || { echo "Download failed."; exit 1; }
  1. Create Directory and Extract: Creates a directory with the same name as the timestamped file and uses unzip to extract the zip file contents into this directory. If there's no unzip command on the system, this will fail and show the error message.
mkdir -p "$FN" && unzip -o "$FN.zip" -d "$FN" || { echo "Extract failed. No unzip command?"; exit 1; } 
  1. Navigate and Install: Changes into the directory containing the extracted project files (toshy-main within the timestamped folder) and runs the installation script.
cd "$FN/toshy-main" && (./setup_toshy.py install || echo "Setup script execution failed.")