diff --git a/.github/workflows/test-install-scripts.yml b/.github/workflows/test-install-scripts.yml index 07a0706743e7..c3adc482ea2c 100644 --- a/.github/workflows/test-install-scripts.yml +++ b/.github/workflows/test-install-scripts.yml @@ -131,7 +131,7 @@ jobs: DEBIAN_FRONTEND: noninteractive run: | apt-get --yes update - apt-get install --yes git lsb-release sudo + apt-get install --yes git lsb-release sudo python3-venv - name: Prepare Fedora if: ${{ matrix.distribution.type == 'fedora' }} @@ -141,7 +141,7 @@ jobs: - name: Prepare Rocky if: ${{ matrix.distribution.type == 'rocky' }} run: | - yum install --assumeyes git sudo + yum install --assumeyes git sudo python39 - name: Prepare Ubuntu if: ${{ matrix.distribution.type == 'ubuntu' }} @@ -153,7 +153,7 @@ jobs: apt-get install --yes software-properties-common add-apt-repository --yes ppa:git-core/ppa apt-get --yes update - apt-get install --yes git lsb-release sudo + apt-get install --yes git lsb-release sudo python3-venv - name: Add safe git directory run: git config --global --add safe.directory "$GITHUB_WORKSPACE" diff --git a/install.sh b/install.sh index fb5d0e04b343..93e65a898a47 100755 --- a/install.sh +++ b/install.sh @@ -5,12 +5,12 @@ set -o errexit USAGE_TEXT="\ Usage: $0 [-adilpsh] - -a automated install, no questions + -a ignored for compatibility with earlier versions -d install development dependencies -i install non-editable -l install legacy keyring dependencies (linux only) -p additional plotters installation - -s skip python package installation and just do pip install + -s ignored for compatibility with earlier versions -h display this help and exit " @@ -18,9 +18,7 @@ usage() { echo "${USAGE_TEXT}" } -PACMAN_AUTOMATED= EXTRAS= -SKIP_PACKAGE_INSTALL= PLOTTER_INSTALL= EDITABLE='-e' @@ -28,7 +26,7 @@ while getopts adilpsh flag do case "${flag}" in # automated - a) PACMAN_AUTOMATED=--noconfirm;; + a) :;; # development d) EXTRAS=${EXTRAS}dev,;; # non-editable @@ -37,26 +35,12 @@ do l) EXTRAS=${EXTRAS}legacy_keyring,;; p) PLOTTER_INSTALL=1;; # simple install - s) SKIP_PACKAGE_INSTALL=1;; + s) :;; h) usage; exit 0;; *) echo; usage; exit 1;; esac done -UBUNTU=false -DEBIAN=false -if [ "$(uname)" = "Linux" ]; then - #LINUX=1 - if command -v apt-get >/dev/null; then - OS_ID=$(lsb_release -is) - if [ "$OS_ID" = "Debian" ]; then - DEBIAN=true - else - UBUNTU=true - fi - fi -fi - # Check for non 64 bit ARM64/Raspberry Pi installs if [ "$(uname -m)" = "armv7l" ]; then echo "" @@ -70,65 +54,6 @@ fi # Get submodules git submodule update --init mozilla-ca -UBUNTU_PRE_20=0 -UBUNTU_20=0 - -if $UBUNTU; then - LSB_RELEASE=$(lsb_release -rs) - # In case Ubuntu minimal does not come with bc - if ! command -v bc > /dev/null 2>&1; then - sudo apt install bc -y - fi - # Mint 20.04 responds with 20 here so 20 instead of 20.04 - if [ "$(echo "$LSB_RELEASE<20" | bc)" = "1" ]; then - UBUNTU_PRE_20=1 - else - UBUNTU_20=1 - fi -fi - -install_python3_and_sqlite3_from_source_with_yum() { - CURRENT_WD=$(pwd) - TMP_PATH=/tmp - - # Preparing installing Python - echo 'yum groupinstall -y "Development Tools"' - sudo yum groupinstall -y "Development Tools" - echo "sudo yum install -y openssl-devel openssl libffi-devel bzip2-devel wget" - sudo yum install -y openssl-devel openssl libffi-devel bzip2-devel wget - - echo "cd $TMP_PATH" - cd "$TMP_PATH" - # Install sqlite>=3.37 - # yum install sqlite-devel brings sqlite3.7 which is not compatible with chia - echo "wget https://www.sqlite.org/2022/sqlite-autoconf-3370200.tar.gz" - wget https://www.sqlite.org/2022/sqlite-autoconf-3370200.tar.gz - tar xf sqlite-autoconf-3370200.tar.gz - echo "cd sqlite-autoconf-3370200" - cd sqlite-autoconf-3370200 - echo "./configure --prefix=/usr/local" - # '| stdbuf ...' seems weird but this makes command outputs stay in single line. - ./configure --prefix=/usr/local | stdbuf -o0 cut -b1-"$(tput cols)" | sed -u 'i\\o033[2K' | stdbuf -o0 tr '\n' '\r'; echo - echo "make -j$(nproc)" - make -j"$(nproc)" | stdbuf -o0 cut -b1-"$(tput cols)" | sed -u 'i\\o033[2K' | stdbuf -o0 tr '\n' '\r'; echo - echo "sudo make install" - sudo make install | stdbuf -o0 cut -b1-"$(tput cols)" | sed -u 'i\\o033[2K' | stdbuf -o0 tr '\n' '\r'; echo - # yum install python3 brings Python3.6 which is not supported by chia - cd .. - echo "wget https://www.python.org/ftp/python/3.9.11/Python-3.9.11.tgz" - wget https://www.python.org/ftp/python/3.9.11/Python-3.9.11.tgz - tar xf Python-3.9.11.tgz - echo "cd Python-3.9.11" - cd Python-3.9.11 - echo "LD_RUN_PATH=/usr/local/lib ./configure --prefix=/usr/local" - # '| stdbuf ...' seems weird but this makes command outputs stay in single line. - LD_RUN_PATH=/usr/local/lib ./configure --prefix=/usr/local | stdbuf -o0 cut -b1-"$(tput cols)" | sed -u 'i\\o033[2K' | stdbuf -o0 tr '\n' '\r'; echo - echo "LD_RUN_PATH=/usr/local/lib make -j$(nproc)" - LD_RUN_PATH=/usr/local/lib make -j"$(nproc)" | stdbuf -o0 cut -b1-"$(tput cols)" | sed -u 'i\\o033[2K' | stdbuf -o0 tr '\n' '\r'; echo - echo "LD_RUN_PATH=/usr/local/lib sudo make altinstall" - LD_RUN_PATH=/usr/local/lib sudo make altinstall | stdbuf -o0 cut -b1-"$(tput cols)" | sed -u 'i\\o033[2K' | stdbuf -o0 tr '\n' '\r'; echo - cd "$CURRENT_WD" -} # You can specify preferred python version by exporting `INSTALL_PYTHON_VERSION` # e.g. `export INSTALL_PYTHON_VERSION=3.8` @@ -183,75 +108,6 @@ find_openssl() { set -e } -# Manage npm and other install requirements on an OS specific basis -if [ "$SKIP_PACKAGE_INSTALL" = "1" ]; then - echo "Skipping system package installation" -elif [ "$(uname)" = "Linux" ]; then - #LINUX=1 - if [ "$UBUNTU_PRE_20" = "1" ]; then - # Ubuntu - echo "Installing on Ubuntu pre 20.*." - sudo apt-get update - # distutils must be installed as well to avoid a complaint about ensurepip while - # creating the venv. This may be related to a mis-check while using or - # misconfiguration of the secondary Python version 3.7. The primary is Python 3.6. - sudo apt-get install -y python3.7-venv python3.7-distutils openssl - elif [ "$UBUNTU_20" = "1" ]; then - echo "Installing on Ubuntu 20.* or newer." - sudo apt-get update - sudo apt-get install -y python3-venv openssl - elif [ "$DEBIAN" = "true" ]; then - echo "Installing on Debian." - sudo apt-get update - sudo apt-get install -y python3-venv openssl - elif type pacman >/dev/null 2>&1 && [ -f "/etc/arch-release" ]; then - # Arch Linux - # Arch provides latest python version. User will need to manually install python 3.9 if it is not present - echo "Installing on Arch Linux." - case $(uname -m) in - x86_64|aarch64) - if ! pacman -Qs "^git$" > /dev/null || ! pacman -Qs "^openssl$" > /dev/null ; then - sudo pacman ${PACMAN_AUTOMATED} -S --needed git openssl - fi - ;; - *) - echo "Incompatible CPU architecture. Must be x86_64 or aarch64." - exit 1 - ;; - esac - elif type yum >/dev/null 2>&1 && [ ! -f "/etc/redhat-release" ] && [ ! -f "/etc/centos-release" ] && [ ! -f "/etc/fedora-release" ]; then - # AMZN 2 - echo "Installing on Amazon Linux 2." - if ! command -v python3.9 >/dev/null 2>&1; then - install_python3_and_sqlite3_from_source_with_yum - fi - elif type yum >/dev/null 2>&1 && [ -f "/etc/centos-release" ]; then - # CentOS - echo "Install on CentOS." - if ! command -v python3.9 >/dev/null 2>&1; then - install_python3_and_sqlite3_from_source_with_yum - fi - elif type yum >/dev/null 2>&1 && [ -f "/etc/redhat-release" ] && grep Rocky /etc/redhat-release; then - echo "Installing on Rocky." - # TODO: make this smarter about getting the latest version - sudo yum install --assumeyes python39 openssl - elif type yum >/dev/null 2>&1 && [ -f "/etc/redhat-release" ] || [ -f "/etc/fedora-release" ]; then - # Redhat or Fedora - echo "Installing on Redhat/Fedora." - if ! command -v python3.9 >/dev/null 2>&1; then - sudo yum install -y python39 openssl - fi - fi -elif [ "$(uname)" = "Darwin" ]; then - echo "Installing on macOS." - if ! type brew >/dev/null 2>&1; then - echo "Installation currently requires brew on macOS - https://brew.sh/" - exit 1 - fi - echo "Installing OpenSSL" - brew install openssl -fi - if [ "$(uname)" = "OpenBSD" ]; then export MAKE=${MAKE:-gmake} export BUILD_VDF_CLIENT=${BUILD_VDF_CLIENT:-N} @@ -277,11 +133,13 @@ if ! command -v "$INSTALL_PYTHON_PATH" >/dev/null; then fi if [ "$PYTHON_MAJOR_VER" -ne "3" ] || [ "$PYTHON_MINOR_VER" -lt "7" ] || [ "$PYTHON_MINOR_VER" -ge "12" ]; then - echo "Chia requires Python version >= 3.7 and < 3.12.0" >&2 + echo "Chia requires Python version >= 3.8 and < 3.12.0" >&2 echo "Current Python version = $INSTALL_PYTHON_VERSION" >&2 # If Arch, direct to Arch Wiki if type pacman >/dev/null 2>&1 && [ -f "/etc/arch-release" ]; then echo "Please see https://wiki.archlinux.org/title/python#Old_versions for support." >&2 + else + echo "Please install python per your OS instructions." >&2 fi exit 1 @@ -292,6 +150,7 @@ find_sqlite echo "SQLite version for Python is ${SQLITE_VERSION}" if [ "$SQLITE_MAJOR_VER" -lt "3" ] || [ "$SQLITE_MAJOR_VER" = "3" ] && [ "$SQLITE_MINOR_VER" -lt "8" ]; then echo "Only sqlite>=3.8 is supported" + echo "Please install sqlite3 per your OS instructions." exit 1 fi @@ -302,6 +161,7 @@ echo "OpenSSL version for Python is ${OPENSSL_VERSION_STRING}" if [ "$OPENSSL_VERSION_INT" -lt "269488367" ]; then echo "WARNING: OpenSSL versions before 3.0.2, 1.1.1n, or 1.0.2zd are vulnerable to CVE-2022-0778" echo "Your OS may have patched OpenSSL and not updated the version to 1.1.1n" + echo "We recommend updating to the latest version of OpenSSL available for your OS" fi # If version of `python` and "$INSTALL_PYTHON_VERSION" does not match, clear old version