Skip to content

Commit

Permalink
* Force installation of pyhton packages, even when older versions are…
Browse files Browse the repository at this point in the history
… already installed

* Harmonized python package installation
  • Loading branch information
s-martin committed Jun 6, 2020
1 parent 6d52f27 commit 8a08d5d
Show file tree
Hide file tree
Showing 13 changed files with 39 additions and 28 deletions.
7 changes: 7 additions & 0 deletions components/audio/PirateAudioHAT/requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
# PirateAudioHAT related requirements
# You need to install these with `sudo python3 -m pip install --upgrade --force-reinstall -q -r requirements.txt`

Mopidy-PiDi
pidi-display-pil
pidi-display-st7789
mopidy-raspberry-gpio
5 changes: 4 additions & 1 deletion components/audio/PirateAudioHAT/setup_pirateAudioHAT.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
#!/usr/bin/env bash

HOME_DIR="/home/pi"
JUKEBOX_HOME_DIR="${HOME_DIR}/RPi-Jukebox-RFID"

question() {
local question=$1
read -p "${question} (y/n)? " choice
Expand Down Expand Up @@ -90,7 +93,7 @@ printf "Installing Python dependencies...\n"
sudo apt-get -y -qq install python3-pil python3-numpy

printf "Installing mopidy plugins...\n"
sudo pip3 --quiet install Mopidy-PiDi pidi-display-pil pidi-display-st7789 mopidy-raspberry-gpio
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${JUKEBOX_HOME_DIR}"/components/audio/PirateAudioHAT/requirements.txt

# Only add, if it does not exist already
printf "Editing mopidy configuration...\n"
Expand Down
4 changes: 2 additions & 2 deletions components/gpio_control/install.sh
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
#!/bin/bash
if [[ $(id -u) = 0 ]]; then
echo "This script should be run as root/sudo, please run as normal 'pi' user"
echo "This script should be run as root/sudo, please run as normal 'pi' user"
exit 1
fi

echo 'Install all required python modules'
pip install -r requirements.txt
sudo python3 -m pip install --upgrade --force-reinstall -r requirements.txt

echo 'Installing GPIO_Control service'
echo
Expand Down
2 changes: 2 additions & 0 deletions components/gpio_control/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
# gipo_control related requirements
# You need to install these with `sudo python3 -m pip install --upgrade --force-reinstall -q -r requirements.txt`

python-mpd2
mock
4 changes: 2 additions & 2 deletions components/rfid-reader/PN532/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# PN532 related requirements
# You need to install these with `sudo python3 -m pip install -q -r requirements.txt`
py532lib
# You need to install these with `sudo python3 -m pip install --upgrade --force-reinstall -q -r requirements.txt`
py532lib
2 changes: 1 addition & 1 deletion components/rfid-reader/PN532/setup_pn532.sh
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ else
fi

printf "Installing Python requirements for PN532...\n"
sudo python3 -m pip install -q -r "${JUKEBOX_HOME_DIR}"/components/rfid-reader/PN532/requirements.txt
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${JUKEBOX_HOME_DIR}"/components/rfid-reader/PN532/requirements.txt

printf "Configure RFID reader in Phoniebox...\n"
cp "${JUKEBOX_HOME_DIR}"/scripts/Reader.py.experimental "${JUKEBOX_HOME_DIR}"/scripts/Reader.py
Expand Down
4 changes: 2 additions & 2 deletions components/rfid-reader/RC522/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# RC522 related requirements
# You need to install these with `sudo python3 -m pip install -q -r requirements.txt`
# You need to install these with `sudo python3 -m pip install --upgrade --force-reinstall -q -r requirements.txt`

# pi-rc522 use latest version from Github
git+git://github.com/ondryaso/pi-rc522.git#egg=pi-rc522
git+git://github.com/ondryaso/pi-rc522.git#egg=pi-rc522
2 changes: 1 addition & 1 deletion components/rfid-reader/RC522/setup_rc522.sh
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ printf "Please make sure that the RC522 reader is wired up correctly to the GPIO
question "Continue"

printf "Installing Python requirements for RC522...\n"
sudo python3 -m pip install -q -r "${JUKEBOX_HOME_DIR}"/components/rfid-reader/RC522/requirements.txt
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${JUKEBOX_HOME_DIR}"/components/rfid-reader/RC522/requirements.txt

printf "Configure RFID reader in Phoniebox...\n"
cp "${JUKEBOX_HOME_DIR}"/scripts/Reader.py.experimental "${JUKEBOX_HOME_DIR}"/scripts/Reader.py
Expand Down
2 changes: 1 addition & 1 deletion requirements-gmusic.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Google Music related requirements (in addition to requirements-spotify.txt)
# You need to install these with `sudo pip install -r requirements-gmusic.txt`
# You need to install these with `sudo pip install --upgrade --force-reinstall -r requirements-gmusic.txt`
Mopidy-Gmusic
2 changes: 1 addition & 1 deletion requirements-spotify.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
# Spotify related requirements
# You need to install these with `sudo pip install -r requirements-spotify.txt`
# You need to install these with `sudo pip install --upgrade --force-reinstall -r requirements-spotify.txt`
Mopidy-Iris==3.45.0
3 changes: 1 addition & 2 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# Library dependencies for the python code. You need to install these with
# `sudo pip install -r requirements.txt` before you can run this.
# `sudo python3 -m pip install --upgrade --force-reinstall -r requirements.txt` before you can run this.

#### ESSENTIAL LIBRARIES FOR MAIN FUNCTIONALITY ####

Expand All @@ -8,7 +8,6 @@ evdev==0.7.0
git+git://github.com/lthiery/SPI-Py.git#egg=spi-py
youtube_dl
pyserial
# spidev - currently installed via apt-get
RPi.GPIO

# Type checking for python
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -344,7 +344,7 @@ config_audio_interface() {
# CONFIGURE AUDIO INTERFACE (iFace)
#
# The default RPi audio interface is 'Headphone'.
# But this does not work for every setup. Here a list of
# But this does not work for every setup. Here a list of
# available iFace names:
"
amixer scontrols
Expand Down Expand Up @@ -722,7 +722,7 @@ install_main() {
${apt_get} ${allow_downgrades} install libspotify12 python3-cffi python3-ply python3-pycparser python3-spotify

# Install necessary Python packages
sudo python3 -m pip install -q -r "${jukebox_dir}"/requirements-spotify.txt
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${jukebox_dir}"/requirements-spotify.txt
fi

local raw_github="https://raw.githubusercontent.com/MiczFlor/RPi-Jukebox-RFID"
Expand All @@ -735,7 +735,7 @@ install_main() {

# Install more required packages
echo "Installing additional Python packages..."
sudo python3 -m pip install -q -r "${jukebox_dir}"/requirements.txt
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${jukebox_dir}"/requirements.txt

samba_config

Expand All @@ -753,11 +753,11 @@ install_main() {
echo "RESTART" > "${jukebox_dir}"/settings/Second_Swipe
echo "${jukebox_dir}/playlists" > "${jukebox_dir}"/settings/Playlists_Folders_Path
echo "ON" > "${jukebox_dir}"/settings/ShowCover

# sample file for debugging with all options set to FALSE
sudo cp "${jukebox_dir}"/settings/debugLogging.conf.sample "${jukebox_dir}"/settings/debugLogging.conf
sudo chmod 777 "${jukebox_dir}"/settings/debugLogging.conf

# The new way of making the bash daemon is using the helperscripts
# creating the shortcuts and script from a CSV file.
# see scripts/helperscripts/AssignIDs4Shortcuts.php
Expand Down
20 changes: 10 additions & 10 deletions scripts/installscripts/buster-install-default.sh
Original file line number Diff line number Diff line change
Expand Up @@ -244,9 +244,9 @@ check_existing() {
# the variables regarding the found content to the also found configuration file.
# That way, reading the configuration file for the (potentially) non-interactive
# install procedure will:
# a) overwrite whatever variables regarding re-cycling existing content which might
# a) overwrite whatever variables regarding re-cycling existing content which might
# be stored in the config file
# b) if there are no variables for dealing with re-cycled context, we will append
# b) if there are no variables for dealing with re-cycled context, we will append
# them - to have them for this install
if [ -f "${jukebox_dir}"/settings/PhonieboxInstall.conf ]; then
# ask for re-using the found configuration file
Expand Down Expand Up @@ -367,7 +367,7 @@ check_existing() {
fi
# append variables to config file
echo "EXISTINGuse=$EXISTINGuse" >> "${HOME_DIR}/PhonieboxInstall.conf"

# Check if we found a Phoniebox install configuration earlier and ask if to run this now
if [ "${EXISTINGusePhonieboxInstall}" == "YES" ]; then
clear
Expand Down Expand Up @@ -399,7 +399,7 @@ config_audio_interface() {
# CONFIGURE AUDIO INTERFACE (iFace)
#
# The default RPi audio interface is 'Headphone'.
# But this does not work for every setup. Here a list of
# But this does not work for every setup. Here a list of
# available iFace names:
"
amixer scontrols
Expand Down Expand Up @@ -777,12 +777,12 @@ install_main() {
${apt_get} ${allow_downgrades} install libspotify12 python3-cffi python3-ply python3-pycparser python3-spotify

# Install necessary Python packages
sudo python3 -m pip install -q -r "${jukebox_dir}"/requirements-spotify.txt
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${jukebox_dir}"/requirements-spotify.txt
fi

# Install more required packages
echo "Installing additional Python packages..."
sudo python3 -m pip install -q -r "${jukebox_dir}"/requirements.txt
sudo python3 -m pip install --upgrade --force-reinstall -q -r "${jukebox_dir}"/requirements.txt

samba_config

Expand Down Expand Up @@ -892,7 +892,7 @@ install_main() {
if [ "${MPDconfig}" == "YES" ]; then
local mpd_conf="/etc/mpd.conf"
local mpd_log="/var/log/mpd/mpd.log"

echo "Configuring MPD..."
# MPD configuration
# -rw-r----- 1 mpd audio 14043 Jul 17 20:16 /etc/mpd.conf
Expand All @@ -903,7 +903,7 @@ install_main() {
sudo sed -i 's|%DIRaudioFolders%|'"$DIRaudioFolders"'|' "${mpd_conf}"
sudo chown mpd:audio "${mpd_conf}"
sudo chmod 640 "${mpd_conf}"

sudo chown mpd:audio "${mpd_log}"
fi

Expand Down Expand Up @@ -1155,12 +1155,12 @@ main() {
wifi_settings "${JUKEBOX_HOME_DIR}/misc/sampleconfigs" "/etc/dhcpcd.conf" "/etc/wpa_supplicant/wpa_supplicant.conf"
existing_assets "${JUKEBOX_HOME_DIR}" "${JUKEBOX_BACKUP_DIR}"
folder_access "${JUKEBOX_HOME_DIR}" "pi:www-data" 775

# Copy PhonieboxInstall.conf configuration file to settings folder
sudo cp "${HOME_DIR}/PhonieboxInstall.conf" "${JUKEBOX_HOME_DIR}/settings/"
sudo chown pi:www-data "${JUKEBOX_HOME_DIR}/settings/PhonieboxInstall.conf"
sudo chmod 775 "${JUKEBOX_HOME_DIR}/settings/PhonieboxInstall.conf"

if [[ ${INTERACTIVE} == "true" ]]; then
finish_installation "${JUKEBOX_HOME_DIR}"
else
Expand Down

0 comments on commit 8a08d5d

Please sign in to comment.