remove Python2 (#884)

remove Python2
This commit is contained in:
frennkie 2019-11-27 08:49:11 +01:00 committed by GitHub
parent 4f1b7a6a37
commit 9ca4c435ff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 17 additions and 20 deletions

View File

@ -116,6 +116,14 @@ if [ "${baseImage}" = "raspbian" ] || [ "${baseImage}" = "dietpi" ] ; then
fi
# remove some (big) packages that are not needed
sudo apt-get remove -y --purge libreoffice* oracle-java* chromium-browser nuscratch scratch sonic-pi minecraft-pi plymouth python2
sudo apt-get clean
sudo apt-get -y autoremove
# make sure /usr/bin/python exists (and calls Python3.7 in Debian Buster)
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.7 1
# update debian
echo ""
echo "*** UPDATE DEBIAN ***"
@ -141,10 +149,6 @@ if [ "${baseImage}" = "raspbian" ]; then
sudo raspi-config nonint do_wifi_country US
# see https://github.com/rootzoll/raspiblitz/issues/428#issuecomment-472822840
echo "max_usb_current=1" | sudo tee -a /boot/config.txt
# extra: remove some big packages not needed
sudo apt-get remove -y --purge libreoffice* oracle-java* chromium-browser nuscratch scratch sonic-pi minecraft-pi python-pygame plymouth
sudo apt-get clean
sudo apt-get -y autoremove
fi
# special prepare when Ubuntu or Armbian
@ -284,8 +288,6 @@ sudo apt install -y sysbench
# check for dependencies on DietPi, Ubuntu, Armbian
sudo apt-get install -y build-essential
sudo apt-get install -y python-pip
sudo apt-get install -y python-dev
# rsync is needed to copy from HDD
sudo apt install -y rsync
# install ifconfig
@ -363,7 +365,7 @@ bitcoinVersion="0.19.0.1"
laanwjPGP="01EA5486DE18A882D4C2684590C8019E36C2E964"
# prepare directories
sudo rm -r /home/admin/download
sudo rm -rf /home/admin/download
sudo -u admin mkdir /home/admin/download
cd /home/admin/download
@ -589,20 +591,15 @@ fi
# prepare python for lnd api use
# https://dev.lightning.community/guides/python-grpc/
#
echo ""
echo "*** LND API for Python ***"
sudo update-alternatives --install /usr/bin/python python /usr/bin/python2.7 3
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.5 2
sudo update-alternatives --install /usr/bin/python python /usr/bin/python3.6 1
echo "to switch between python2/3: sudo update-alternatives --config python"
sudo apt-get -f -y install virtualenv
sudo chown -R admin /home/admin
sudo -u admin bash -c "cd; virtualenv python-env-lnd; source /home/admin/python-env-lnd/bin/activate; pip install grpcio grpcio-tools googleapis-common-protos pathlib2"
# This Python3 virtualenv includes the site-packages because access to the PyQt5
# libs - which are installed system-wide (via apt-get) - is needed for TouchUI.
sudo -u admin bash -c "cd; virtualenv -p python3 --system-site-packages python3-env-lnd"
sudo -u admin bash -c "cd; python3 -m venv --system-site-packages python3-env-lnd"
sudo -u admin bash -c "/home/admin/python3-env-lnd/bin/python3 -m pip install grpcio grpcio-tools googleapis-common-protos pathlib2"
echo ""
echo ""
@ -700,7 +697,7 @@ echo "*** HARDENING ***"
# based on https://github.com/Stadicus/guides/blob/master/raspibolt/raspibolt_20_pi.md#hardening-your-pi
# fail2ban (no config required)
sudo apt-get install -y fail2ban
sudo apt-get install -y --no-install-recommends python3-systemd fail2ban
# *** BOOTSTRAP ***
# see background README for details

View File

@ -191,7 +191,7 @@ if [ ${walletExists} -eq 0 ]; then
# generate wallet with seed and set passwordC
clear
echo "Generating new Wallet ...."
source /home/admin/python-env-lnd/bin/activate
source /home/admin/python3-env-lnd/bin/activate
python /home/admin/config.scripts/lnd.initwallet.py new ${passwordC} > /home/admin/.seed.tmp
source /home/admin/.seed.tmp
sudo shred /home/admin/.pass.tmp 2>/dev/null
@ -353,7 +353,7 @@ to protect the seed words. Most users did not set this.
if [ "${CHOICE}" == "SEED+SCB" ] || [ "${CHOICE}" == "ONLYSEED" ]; then
# trigger wallet recovery
source /home/admin/python-env-lnd/bin/activate
source /home/admin/python3-env-lnd/bin/activate
source <(python /home/admin/config.scripts/lnd.initwallet.py seed ${passwordC} "${wordstring}" ${passwordD})
# check if wallet was created for real
@ -497,4 +497,4 @@ System will restart now.
sudo shutdown -r now
fi
fi

View File

@ -43,7 +43,7 @@ pip install BlitzTUI
**or** consider using a virtual environment
```
virtualenv -p python3 --system-site-packages venv
python3 -m venv --system-site-packages venv
source venv/bin/activate
pip install BlitzTUI
```