Skip to content

Commit

Permalink
Merge branch 'fl' into fl-exp.
Browse files Browse the repository at this point in the history
  • Loading branch information
f-laurens committed Mar 4, 2022
2 parents 79f828a + cde6d18 commit 90e5813
Show file tree
Hide file tree
Showing 5 changed files with 56 additions and 48 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/arm-runner.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,11 @@ jobs:
sudo apt-get install --no-install-recommends -y postgresql libpq-dev git python3 python3-venv python3-dev gettext nginx openssl libssl-dev libffi-dev libmpg123-dev libasound2-dev libatlas-base-dev libgfortran5 libopenblas-dev liblapack-dev zram-tools
sudo mkdir -p /run/systemd/timesync/ && sudo touch /run/systemd/timesync/synchronized
sudo apt-get install --no-install-recommends -y alsa-utils xz-utils avahi-daemon
sudo -u pi taskset -c 0 /bin/bash install.sh ci-chroot-test
if [ `uname -m` = 'armv6l' -o `uname -m` = 'armv7l' ]; then
sudo -u pi taskset -c 0 /bin/bash install.sh ci-chroot-test
else
sudo -u pi /bin/bash install.sh ci-chroot-test
fi
create_image:
name: Build image
runs-on: ubuntu-latest
Expand Down Expand Up @@ -158,7 +161,11 @@ jobs:
sudo useradd pi || true
sudo chown -hR pi:pi /home/pi/pynab
fi
sudo GITHUB_BRANCH=${{ steps.image_and_branch_name.outputs.LOCAL_BRANCH }} GITHUB_REPOSITORY=${{ github.repository }} /bin/bash /tmp/setup ci-chroot
if [ `uname -m` = 'armv6l' -o `uname -m` = 'armv7l' ]; then
sudo GITHUB_BRANCH=${{ steps.image_and_branch_name.outputs.LOCAL_BRANCH }} GITHUB_REPOSITORY=${{ github.repository }} taskset -c 0 /bin/bash /tmp/setup ci-chroot
else
sudo GITHUB_BRANCH=${{ steps.image_and_branch_name.outputs.LOCAL_BRANCH }} GITHUB_REPOSITORY=${{ github.repository }} /bin/bash /tmp/setup ci-chroot
fi
sudo rm /tmp/setup
sudo apt-get autoremove --purge -y
sudo apt-get clean
Expand All @@ -171,7 +178,7 @@ jobs:
- name: Upload the image artifact
uses: actions/upload-artifact@v2
with:
name: release_images
name: pynab-${{ steps.image_and_branch_name.outputs.IMAGE_NAME_SUFFIX }}.img.xz
path: pynab-${{ steps.image_and_branch_name.outputs.IMAGE_NAME_SUFFIX }}.img.xz
if-no-files-found: error
retention-days: 1
Expand All @@ -189,14 +196,12 @@ jobs:
echo ::set-output name=RELEASE_NAME::${GITHUB_REF/refs\/tags\//}
elif [ ${GITHUB_REF/refs\/heads\//} = "releng" ]; then
echo ::set-output name=RELEASE_NAME::releng
else
else
echo ::set-output name=RELEASE_NAME::${GITHUB_REF/refs\/heads\//}
fi
- name: Download the image artifact(s)
- name: Download the image artifacts
uses: actions/download-artifact@v2
with:
name: release_images

- name: Create release with releng image
if: github.ref == 'refs/heads/releng'
Expand All @@ -207,7 +212,7 @@ jobs:
prerelease: true
draft: true
title: "Prerelease"
files: pynab-${{ steps.release_name.outputs.RELEASE_NAME }}*.img.xz
files: pynab-${{ steps.release_name.outputs.RELEASE_NAME }}-*.img.xz/pynab-${{ steps.release_name.outputs.RELEASE_NAME }}-*.img.xz

- name: Create release with release image
if: startsWith(github.ref, 'refs/tags/')
Expand All @@ -218,4 +223,4 @@ jobs:
prerelease: false
draft: true
title: ${{ steps.release_name.outputs.RELEASE_NAME }}
files: pynab-${{ steps.release_name.outputs.RELEASE_NAME }}*.img.xz
files: pynab-${{ steps.release_name.outputs.RELEASE_NAME }}-*.img.xz/pynab-${{ steps.release_name.outputs.RELEASE_NAME }}-*.img.xz
2 changes: 1 addition & 1 deletion Docker/nab/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ asynctest==0.13.0
coverage==5.0.3
pre_commit==2.12.1
pyalsaaudio==0.8.4; sys_platform == 'linux'
rpi-ws281x==4.2.2; sys_platform == 'linux' and ('armv6l' in platform_machine or 'armv7l' in platform_machine or 'aarch64' in platform_machine)
rpi-ws281x==4.3.2; sys_platform == 'linux' and ('armv6l' in platform_machine or 'armv7l' in platform_machine or 'aarch64' in platform_machine)
RPi.GPIO==0.7.1a4; sys_platform == 'linux' and ('armv6l' in platform_machine or 'armv7l' in platform_machine or 'aarch64' in platform_machine)
https://github.com/pguyot/py-kaldi-asr/releases/download/v0.5.3/py_kaldi_asr-0.5.3-cp37-cp37m-linux_armv6l.whl; sys_platform == 'linux' and 'armv6l' in platform_machine and python_version == '3.7'
https://github.com/pguyot/py-kaldi-asr/releases/download/v0.5.3/py_kaldi_asr-0.5.3-cp39-cp39-linux_armv6l.whl; sys_platform == 'linux' and 'armv6l' in platform_machine and python_version == '3.9'
Expand Down
28 changes: 14 additions & 14 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,17 +20,17 @@ Pour être prévenu de la prochaine campagne, vous pouvez vous inscrire à la [l

## Images

Les [releases](https://github.com/nabaztag2018/pynab/releases) sont des images de Raspberry Pi OS Lite avec Pynab pré-installé. Elles ont les mêmes réglages que [Raspberry Pi OS](https://www.raspberrypi.org/software/operating-systems/).
Les [releases](https://github.com/nabaztag2018/pynab/releases) sont des images de [Raspberry Pi OS](https://www.raspberrypi.org/software/operating-systems/) Lite ou [DietPi](https://dietpi.com/) avec Pynab pré-installé.

Pynab peut aussi s'installer sur [DietPi](https://dietpi.com/).

Les releases actuelles (>0.7.x) ne fonctionnent que sur les cartes 2019 (cf [#44](https://github.com/nabaztag2018/pynab/issues/44)).
Les releases actuelles (>0.7.x) ne fonctionnent pas sur les cartes 2018 (cf [#44](https://github.com/nabaztag2018/pynab/issues/44)).

## Installation sur Raspberry Pi OS ou DietPi (pour développeurs!)

### 0. S'assurer que le système est bien à jour

Le script d'installation requiert désormais une version basée sur Debian 11 (Bullseye), avec Python 3.9.
Le script d'installation requiert une version basée sur Debian 11 (Bullseye), avec Python 3.9.

Debian 10 (Buster), avec Python 3.7 ([Raspberry Pi OS Legacy](https://www.raspberrypi.com/software/operating-systems/#raspberry-pi-os-legacy)), est aussi supporté.

Il est nécessaire que les 'kernel headers' installés via `apt-get` correspondent à la version installée du noyau.

Expand Down Expand Up @@ -99,16 +99,16 @@ bash upgrade.sh

## Architecture

Cf le [protocole nabd](PROTOCOL.md)
Voir le [protocole nabd](PROTOCOL.md)

- `nabd` : daemon qui gère le lapin (i/o, chorégraphies)
- `nab8balld` : daemon pour le service gourou
- `nabairqualityd` : daemon pour le service de qualité de l'air
- `nabclockd` : daemon pour le service horloge
- `nabsurprised` : daemon pour le service surprises
- `nabtaichid` : daemon pour le service taichi
- `nabmastodond` : daemon pour le service mastodon
- `nabweatherd` : daemon pour le service météo
- `nabd` : démon qui gère le lapin (e/s, chorégraphies)
- `nab8balld` : démon pour le service gourou
- `nabairqualityd` : démon pour le service de qualité de l'air
- `nabclockd` : démon pour le service horloge
- `nabsurprised` : démon pour le service surprises
- `nabtaichid` : démon pour le service taichi
- `nabmastodond` : démon pour le service mastodon
- `nabweatherd` : démon pour le service météo
- `nabweb` : interface web pour la configuration

## Contribution
Expand Down
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ asynctest==0.13.0
coverage==5.0.3
pre_commit==2.12.1
pyalsaaudio==0.8.4; sys_platform == 'linux'
rpi-ws281x==4.2.2; sys_platform == 'linux' and ('armv6l' in platform_machine or 'armv7l' in platform_machine or 'aarch64' in platform_machine)
rpi-ws281x==4.3.2; sys_platform == 'linux' and ('armv6l' in platform_machine or 'armv7l' in platform_machine or 'aarch64' in platform_machine)
RPi.GPIO==0.7.1a4; sys_platform == 'linux' and ('armv6l' in platform_machine or 'armv7l' in platform_machine or 'aarch64' in platform_machine)
https://github.com/pguyot/py-kaldi-asr/releases/download/v0.5.3/py_kaldi_asr-0.5.3-cp37-cp37m-linux_armv6l.whl; sys_platform == 'linux' and 'armv6l' in platform_machine and python_version == '3.7'
https://github.com/pguyot/py-kaldi-asr/releases/download/v0.5.3/py_kaldi_asr-0.5.3-cp39-cp39-linux_armv6l.whl; sys_platform == 'linux' and 'armv6l' in platform_machine and python_version == '3.9'
Expand Down
47 changes: 25 additions & 22 deletions setup
Original file line number Diff line number Diff line change
Expand Up @@ -15,20 +15,24 @@ case ${pynab_branch} in
# vX.Y.Z tag-driven build: assume release branch
pynab_tag=" (tag ${pynab_branch})"
pynab_branch=release
driver_branch=release
;;
fl+([0-9]).+([0-9]).+([0-9])*)
# flX.Y.Z tag-driven build: assume fl branch
pynab_tag=" (tag ${pynab_branch})"
pynab_branch=fl
driver_branch=release
;;
fx+([0-9]).+([0-9]).+([0-9])*)
# fxX.Y.Z tag-driven build: assume fl-exp branch
pynab_tag=" (tag ${pynab_branch})"
pynab_branch=fl-exp
driver_branch=release
;;
*)
# sssume branch-driven build on given branch
# assume branch-driven build on given branch
pynab_tag=""
driver_branch=master
;;
esac

Expand Down Expand Up @@ -76,13 +80,6 @@ echo "Editing /boot/cmdline.txt."
sed -i "s|root=PARTUUID=........-02|root=/dev/mmcblk0p2|" /boot/cmdline.txt
cat "/boot/cmdline.txt"

# Resize partition on first boot.
# https://www.raspberrypi.org/forums/viewtopic.php?p=1503766#p1503766
# (not needed anymore on recent distros)
#wget -O /etc/init.d/resize2fs_once https://raw.githubusercontent.com/RPi-Distro/pi-gen/master/stage2/01-sys-tweaks/files/resize2fs_once
#chmod +x /etc/init.d/resize2fs_once
#systemctl enable resize2fs_once

# Replace /etc/fstab since the non existing PARTUUID has to be changed here as well.
echo "Editing /etc/fstab."
sed -i -e "s|PARTUUID=........-01|/dev/mmcblk0p1|" -e "s|PARTUUID=........-02|/dev/mmcblk0p2|" /etc/fstab
Expand Down Expand Up @@ -183,15 +180,17 @@ then
# patch for DietPi, to allow sudo -u: ALL=(ALL) needed:
echo "${owner} ALL=(ALL) NOPASSWD: ALL" > /etc/sudoers.d/${owner}

# patch for DietPi, to take over existing local Pynab repository, if any:
# patch for DietPi, to cleanup leftover pi "user" used when building image,
# after taking over existing local Pynab repository, if any:
pi_user="pi"
if [ ! -d ${home_dir}/pynab -a -d /home/${pi_user}/pynab ]
then
echo "Moving /home/${pi_user}/pynab to ${home_dir}/pynab."
mv /home/${pi_user}/pynab ${home_dir}/pynab
chown -hR ${owner}:${owner} ${home_dir}/pynab
userdel -r ${pi_user} 2>/dev/null || true
fi
userdel -r ${pi_user} 2>/dev/null || true
rmdir /home/${pi_user} 2>/dev/null || true
fi

echo "Installing required packages."
Expand All @@ -200,29 +199,33 @@ sudo apt-get dist-upgrade -y
sudo apt-get install --no-install-recommends -y postgresql libpq-dev git python3 python3-venv python3-dev gettext nginx openssl libssl-dev libffi-dev libmpg123-dev libasound2-dev libatlas-base-dev libgfortran5 libopenblas-dev liblapack-dev zram-tools
sudo apt-get install --no-install-recommends -y gcc make raspberrypi-kernel-headers

build_and_install_driver() {
for dir in /lib/modules/*/build
do
kernel=$(basename $(dirname ${dir}))
make KERNELRELEASE=${kernel}
sudo make install KERNELRELEASE=${kernel}
make clean KERNELRELEASE=${kernel}
done
}

echo "Installing sound driver for Ulule 2019 cards."
cd ${home_dir}
sudo -u ${owner} git clone --depth 1 -b tagtagtag-sound https://github.com/pguyot/wm8960
cd ${home_dir}/wm8960
make
sudo make install
make clean
build_and_install_driver

echo "Installing ears driver."
cd ${home_dir}
sudo -u ${owner} git clone --depth 1 https://github.com/pguyot/tagtagtag-ears
sudo -u ${owner} git clone --depth 1 -b ${driver_branch} https://github.com/pguyot/tagtagtag-ears
cd ${home_dir}/tagtagtag-ears
make
sudo make install
make clean
build_and_install_driver

echo "Installing RFID reader driver."
cd ${home_dir}
sudo -u ${owner} git clone --depth 1 https://github.com/pguyot/cr14
sudo -u ${owner} git clone --depth 1 -b ${driver_branch} https://github.com/pguyot/cr14
cd ${home_dir}/cr14
make
sudo make install
make clean
build_and_install_driver

cd ${home_dir}
if [ -d "pynab" ]
Expand All @@ -236,7 +239,7 @@ fi
echo "Installing NabBlockly."
sudo apt-get install --no-install-recommends -y erlang-base erlang-dev erlang-inets erlang-tools erlang-xmerl
cd ${home_dir}/pynab
sudo -u ${owner} git clone --depth 1 https://github.com/pguyot/nabblockly
sudo -u ${owner} git clone --depth 1 -b ${driver_branch} https://github.com/pguyot/nabblockly
cd nabblockly
# Until we can get OTP 24 from Raspian or Erlang Solutions, get an older rebar binary
sudo -u ${owner} wget https://github.com/erlang/rebar3/releases/download/3.15.1/rebar3 && chmod +x rebar3
Expand Down

0 comments on commit 90e5813

Please sign in to comment.