Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update install_prereq.sh #1150

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 40 additions & 19 deletions install_prereq.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,35 +2,56 @@
set -euo pipefail

debianInstall() {
sudo apt-get update
sudo apt-get install -y git iw dnsmasq rfkill hostapd screen curl build-essential python3-pip python3-setuptools python3-wheel python3-dev mosquitto haveged net-tools libssl-dev iproute2 iputils-ping
sudo python3 -m pip install --user --upgrade paho-mqtt tornado git+https://github.com/drbild/sslpsk.git pycryptodomex
sudo apt-get update
sudo apt-get install -y git iw dnsmasq rfkill hostapd screen curl build-essential python3-pip python3-setuptools python3-wheel python3-dev mosquitto haveged net-tools libssl-dev iproute2 iputils-ping
sudo python3 -m pip install --user --upgrade paho-mqtt tornado git+https://github.com/drbild/sslpsk.git pycryptodomex
}

archInstall() {
sudo pacman -S --needed git iw dnsmasq hostapd screen curl python-pip python-wheel python-pycryptodomex python-paho-mqtt python-tornado mosquitto haveged net-tools openssl
sudo python -m pip install --user --upgrade git+https://github.com/drbild/sslpsk.git
sudo pacman -S --needed git iw dnsmasq hostapd screen curl python-pip python-wheel python-pycryptodomex python-paho-mqtt python-tornado mosquitto haveged net-tools openssl
sudo python -m pip install --user --upgrade git+https://github.com/drbild/sslpsk.git
}

# If Debian 12 (Bookworm) or newer use this
debian12Install() {
sudo apt-get update
sudo apt-get install -y git iw dnsmasq rfkill hostapd screen curl build-essential python3-pip python3-setuptools python3-wheel python3-dev mosquitto haveged net-tools libssl-dev iproute2 iputils-ping
# Run the following command from the root folder of each project to create a virtual environment configuration folder:
python3 -m venv ./python3env
# Run the following command from the root of the project to start using the virtual environment:
source ./python3env/bin/activate
# Now install Python libraries into a virtual environment (venv):
pip install --upgrade paho-mqtt tornado git+https://github.com/drbild/sslpsk.git pycryptodomex
# To leave the virtual environment, run the following command from any directory:
deactivate
}

if [[ -e /etc/os-release ]]; then
source /etc/os-release
source /etc/os-release
else
echo "/etc/os-release not found! Assuming debian-based system, but this will likely fail!"
ID=debian
echo "/etc/os-release not found! Assuming debian-based system, but this will likely fail!"
ID=debian
fi

if [[ ${ID} == 'debian' ]] || [[ ${ID_LIKE-} == 'debian' ]]; then
debianInstall
elif [[ ${ID} == 'arch' ]] || [[ ${ID_LIKE-} == 'arch' ]]; then
archInstall
# Check if Debian 12 (Bookworm) or newer
if [[ ${ID} == 'debian' ]] && [[ ${VERSION_ID} -ge 12 ]] then
# Yes, Debian 12 (Bookworm) or newer
debian12Install
else
if [[ -n ${ID_LIKE-} ]]; then
printID="${ID}/${ID_LIKE}"
else
printID="${ID}"
fi
echo "/etc/os-release found but distribution ${printID} is not explicitly supported. Assuming debian-based system, but this will likely fail!"
debianInstall
# No, Debian 11 or older or other operating system
if [[ ${ID} == 'debian' ]] || [[ ${ID_LIKE-} == 'debian' ]]; then
debianInstall
elif [[ ${ID} == 'arch' ]] || [[ ${ID_LIKE-} == 'arch' ]]; then
archInstall
else
if [[ -n ${ID_LIKE-} ]]; then
printID="${ID}/${ID_LIKE}"
else
printID="${ID}"
fi
echo "/etc/os-release found but distribution ${printID} is not explicitly supported. Assuming debian-based system, but this will likely fail!"
debianInstall
fi
fi

echo "Ready to start upgrade"