Skip to content

Instantly share code, notes, and snippets.

@duskvirkus
Created January 25, 2023 16:32
Show Gist options
  • Select an option

  • Save duskvirkus/e7d924607ff76050d124a2ead70f9ef9 to your computer and use it in GitHub Desktop.

Select an option

Save duskvirkus/e7d924607ff76050d124a2ead70f9ef9 to your computer and use it in GitHub Desktop.

Revisions

  1. duskvirkus created this gist Jan 25, 2023.
    36 changes: 36 additions & 0 deletions install_s5cmd.sh
    Original file line number Diff line number Diff line change
    @@ -0,0 +1,36 @@
    #!/bin/bash
    # Installs s5cmd

    if command -v s5cmd &> /dev/null
    then
    echo "s5cmd is already installed"
    exit 0
    fi

    START_DIR=$(pwd)

    if [ $(id -u) != 0 ]; then
    echo "this script must be run using sudo"
    echo ""
    echo "usage:"
    echo "sudo "$0
    exit $exit_code
    exit 1
    fi

    # wget installed ?
    if ! command -v wget &> /dev/null
    then
    echo "curl could not be found, installing"
    apt install -y wget
    fi

    TMP_DIR=$(mktemp -d -t ci-XXXXXXXXXX)
    cd $TMP_DIR

    wget "https://github.com/peak/s5cmd/releases/download/v2.0.0/s5cmd_2.0.0_Linux-64bit.tar.gz"
    tar -xf s5cmd_2.0.0_Linux-64bit.tar.gz
    mv s5cmd /usr/local/bin

    cd $START_DIR
    rm -rf $TMP_DIR