From f35b4ffc1c0b52a1b650a752352b2d58a979beb6 Mon Sep 17 00:00:00 2001 From: Dave Acklam Date: Sat, 18 Jun 2022 19:29:34 -0700 Subject: [PATCH] Support for Debian Bullseye and aarch64 (Raspberry Pi OS/Bullseye 64 Bit) in setup routines (#1429) * Remove redundant pip install for bullseye support pIp is also installed by openaps-packages.sh * Change python default to python2, install pip, pip install numpy for bullseye support * Bullseye support on arm64 (Raspberry Pi OS 64bit) Handle aarch64 architecture properly when downloading golang binaries. Without this setup will fail on Rpi 3/4/Zero2 devices where the user has installed the recently-released 64bit OS. Co-authored-by: Dave Acklam --- bin/openaps-install.sh | 2 +- bin/openaps-packages.sh | 11 ++++++++++- bin/oref0-setup.sh | 2 ++ 3 files changed, 13 insertions(+), 2 deletions(-) diff --git a/bin/openaps-install.sh b/bin/openaps-install.sh index 9395ab992..3e0265215 100755 --- a/bin/openaps-install.sh +++ b/bin/openaps-install.sh @@ -55,7 +55,7 @@ fi #dpkg -P nodejs nodejs-dev # TODO: remove the `-o Acquire::ForceIPv4=true` once Debian's mirrors work reliably over IPv6 apt-get -o Acquire::ForceIPv4=true update && apt-get -o Acquire::ForceIPv4=true -y dist-upgrade && apt-get -o Acquire::ForceIPv4=true -y autoremove -apt-get -o Acquire::ForceIPv4=true update && apt-get -o Acquire::ForceIPv4=true install -y sudo strace tcpdump screen acpid vim python-pip locate ntpdate ntp +apt-get -o Acquire::ForceIPv4=true update && apt-get -o Acquire::ForceIPv4=true install -y sudo strace tcpdump screen acpid vim locate ntpdate ntp #check if edison user exists before trying to add it to groups grep "PermitRootLogin yes" /etc/ssh/sshd_config || echo "PermitRootLogin yes" >>/etc/ssh/sshd_config diff --git a/bin/openaps-packages.sh b/bin/openaps-packages.sh index 401b783e7..996c3c194 100755 --- a/bin/openaps-packages.sh +++ b/bin/openaps-packages.sh @@ -10,7 +10,16 @@ echo 'Acquire::ForceIPv4 "true";' | sudo tee /etc/apt/apt.conf.d/99force-ipv4 apt-get install -y sudo sudo apt-get update && sudo apt-get -y upgrade -sudo apt-get install -y git python python-dev software-properties-common python-numpy python-pip watchdog strace tcpdump screen acpid vim locate lm-sensors || die "Couldn't install packages" +## Debian Bullseye (Raspberry Pi OS 64bit, etc) is python3 by default and does not support python2-pip. +if ! cat /etc/os-release | grep bullseye >& /dev/null; then + sudo apt-get install -y git python python-dev software-properties-common python-numpy python-pip watchdog strace tcpdump screen acpid vim locate lm-sensors || die "Couldn't install packages" +else + # Bullseye based OS. Get PIP2 from pypa and pip-install python packages rather than using the py3 ones from apt + # Also, install python-is-python2, to override the distro default of linking python to python3 + sudo apt-get install -y git python-is-python2 python-dev-is-python2 software-properties-common watchdog strace tcpdump screen acpid vim locate lm-sensors || die "Couldn't install packages" + curl https://bootstrap.pypa.io/pip/2.7/get-pip.py | python2 || die "Couldn't install pip" + python2 -m pip install numpy || die "Couldn't pip install numpy" +fi # We require jq >= 1.5 for --slurpfile for merging preferences. Debian Jessie ships with 1.4. if cat /etc/os-release | grep 'PRETTY_NAME="Debian GNU/Linux 8 (jessie)"' &> /dev/null; then diff --git a/bin/oref0-setup.sh b/bin/oref0-setup.sh index 47eea3f38..b545bef69 100755 --- a/bin/oref0-setup.sh +++ b/bin/oref0-setup.sh @@ -1200,6 +1200,8 @@ if prompt_yn "" N; then echo "Installing Golang..." if uname -m | grep armv; then cd /tmp && wget -c https://storage.googleapis.com/golang/go${golangversion}.linux-armv6l.tar.gz && tar -C /usr/local -xzvf /tmp/go${golangversion}.linux-armv6l.tar.gz + elif uname -m | grep aarch64; then + cd /tmp && wget -c https://storage.googleapis.com/golang/go${golangversion}.linux-arm64.tar.gz && tar -C /usr/local -xzvf /tmp/go${golangversion}.linux-arm64.tar.gz elif uname -m | grep i686; then cd /tmp && wget -c https://dl.google.com/go/go${golangversion}.linux-386.tar.gz && tar -C /usr/local -xzvf /tmp/go${golangversion}.linux-386.tar.gz fi