Skip to content

Commit

Permalink
Update packages.bash eddited miflora installation (#1869)
Browse files Browse the repository at this point in the history
Debain 12 (Bookworm) forces the use of python virtual enviroments for some packages.
Installation script for miflora-mqtt-daemon is edited according to the proposed change in the README of miflora-mqtt-daemon.
See PR: ThomDietrich/miflora-mqtt-daemon#176.

PR ThomDietrich/miflora-mqtt-daemon#175 is made to update the systemd service file.
which will be used also when installing the package via openhabian-config.

Signed-off-by: thicknesss <[email protected]>
  • Loading branch information
thicknesss authored and openhabian committed Aug 11, 2024
1 parent 9885bb5 commit 767d590
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions functions/packages.bash
Original file line number Diff line number Diff line change
Expand Up @@ -440,10 +440,16 @@ miflora_setup() {
cond_echo "Filesystem permissions corrections... "
if ! cond_redirect chown -R "openhab:${username:-openhabian}" "$mifloraDir"; then echo "FAILED (permissions)"; return 1; fi
if ! cond_redirect chmod -R ug+wX "$mifloraDir"; then echo "FAILED (permissons)"; return 1; fi

## For Debian 12 (Bookworm) compatibility we need to make a Python Virtual Enviroment (venv)
cond_echo "Preparing python virtual enviroment"
cond_redirect python -m venv --system-site-packages "$mifloraDir"/env
cond_redirect source "$mifloraDir"/env/bin/activate
## original code from here
cond_echo "Installing required python packages"
cond_redirect pip3 install -r "$mifloraDir"/requirements.txt

cond_redirect "$mifloraDir"/env/bin/pip3 install -r "$mifloraDir"/requirements.txt
## deactivate venv to avoid conflicts with other functions
cond_redirect "$mifloraDir"/env/bin/deactivate
## original code from here
echo -n "$(timestamp) [openHABian] Setting up miflora-mqtt-daemon service... "
if ! cond_redirect install -m 644 "$mifloraDir"/template.service /etc/systemd/system/miflora.service; then echo "FAILED (copy service)"; return 1; fi
if ! cond_redirect systemctl -q daemon-reload; then echo "FAILED (daemon-reload)"; return 1; fi
Expand Down

0 comments on commit 767d590

Please sign in to comment.