Skip to content

Commit

Permalink
Merge pull request #99 from interactionresearchstudio/hotfix/bullseye
Browse files Browse the repository at this point in the history
Update OS to Bullseye
  • Loading branch information
mikevanis authored Feb 15, 2022
2 parents f00de28 + 3bab545 commit aaf4382
Show file tree
Hide file tree
Showing 3 changed files with 39 additions and 20 deletions.
38 changes: 29 additions & 9 deletions .github/workflows/build-image.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
name: Build Image
on: [push, pull_request]
on: [push, pull_request, workflow_dispatch]

jobs:
build:
runs-on: ubuntu-18.04
runs-on: ubuntu-latest
steps:

- name: Install Dependencies
run: sudo apt-get update && sudo apt install coreutils p7zip-full qemu-user-static
run: |
sudo apt-get update
sudo apt-get install coreutils p7zip-full qemu-user-static
- name: Checkout CustomPiOS
uses: actions/checkout@v2
Expand All @@ -28,22 +30,40 @@ jobs:
node-version: 12.x

- name: Build React frontend
run: pushd repository/naturewatch_camera_server/static/client && npm i -y && npm run build && popd
run: |
pushd repository/naturewatch_camera_server/static/client
npm i -y
npm run build
popd
- name: Download Raspbian Image
run: cd repository/os/image && wget -q -c --trust-server-names 'https://downloads.raspberrypi.org/raspbian_lite_latest'
run: |
cd repository/os/image
wget -q -c --trust-server-names 'https://downloads.raspberrypi.org/raspios_lite_armhf_latest'
- name: Update CustomPiOS Paths
run: cd repository/os && ../../CustomPiOS/src/update-custompios-paths
run: |
cd repository/os
../../CustomPiOS/src/update-custompios-paths
- name: Copy NaturewatchCameraServer to CustomPiOS directory
run: cp -r repository /tmp/NaturewatchCameraServer && rm -rf /tmp/NaturewatchCameraServer/os && rm -rf /tmp/NaturewatchCameraServer/naturewatch_camera_server/static/client/node_modules && mv /tmp/NaturewatchCameraServer repository/os/modules/naturewatchcamera/filesystem/home/pi/NaturewatchCameraServer && ls repository/os/modules/naturewatchcamera/filesystem/home/pi/NaturewatchCameraServer
run: |
cp -r repository /tmp/NaturewatchCameraServer
rm -rf /tmp/NaturewatchCameraServer/os
rm -rf /tmp/NaturewatchCameraServer/naturewatch_camera_server/static/client/node_modules
mv /tmp/NaturewatchCameraServer repository/os/modules/naturewatchcamera/filesystem/home/pi/NaturewatchCameraServer
ls repository/os/modules/naturewatchcamera/filesystem/home/pi/NaturewatchCameraServer
- name: Build Image
run: export BASE_IMAGE_ENLARGEROOT=2000 && export AUTO_HOTSPOT_NAME=MyNaturewatch && export AUTO_HOTSPOT_PASSWORD=badgersandfoxes && sudo modprobe loop && cd repository/os && sudo bash -x ./build_dist
run: |
export BASE_IMAGE_ENLARGEROOT=2000
export AUTO_HOTSPOT_NAME=MyNaturewatch
export AUTO_HOTSPOT_PASSWORD=badgersandfoxes
sudo modprobe loop && cd repository/os
sudo bash -x ./build_dist
- name: Copy Output
run: cp ${{ github.workspace }}/repository/os/workspace/*-raspbian-buster-lite.img mynaturewatch-camera.img
run: cp ${{ github.workspace }}/repository/os/workspace/*lite.img mynaturewatch-camera.img

- name: Zip Output
run: gzip mynaturewatch-camera.img
Expand Down
2 changes: 1 addition & 1 deletion naturewatch_camera_server/__main__.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class CameraNotFoundException(Exception):

def is_camera_enabled():
# inspired by https://stackoverflow.com/questions/58250817/raspberry-pi-camera-module-check-if-connected#comment102874971_58250817
vcgencmd_result = subprocess.run(['/opt/vc/bin/vcgencmd', 'get_camera'], stdout=subprocess.PIPE)
vcgencmd_result = subprocess.run(['vcgencmd', 'get_camera'], stdout=subprocess.PIPE)
result_text = vcgencmd_result.stdout.decode('utf-8').strip()
properties = dict(pair.split('=') for pair in result_text.split(' '))
return properties['supported'] == '1'
Expand Down
19 changes: 9 additions & 10 deletions os/modules/naturewatchcamera/start_chroot_script
Original file line number Diff line number Diff line change
Expand Up @@ -35,17 +35,16 @@ echo "$NATUREWATCHCAMERA_VAR"
libxvidcore-dev libx264-dev libgtk2.0-dev libgtk-3-dev \
libatlas-base-dev libblas-dev libeigen{2,3}-dev liblapack-dev \
gfortran \
python2.7-dev python3-dev python-pip python3-pip python python3
apt-get install -y libilmbase23
apt-get install -y libopenexr-dev
apt-get install -y libgstreamer1.0-dev
apt install -y gpac
pip2 install -U pip
pip3 install -U pip
pip2 install numpy
pip3 install numpy
python3-dev python3-pip python python3
apt-get install -y libilmbase25 libopenexr-dev libgstreamer1.0-dev
apt-get install -y gpac

echo "Enabling legacy camera support for Pi Zero W 2"
raspi-config nonint do_camera 1
echo "start_x=1" >> /boot/config.txt

echo "Installing OpenCV"
pip3 install opencv-python-headless
pip3 install -U pip numpy opencv-python-headless

pushd /home/pi
pushd NaturewatchCameraServer
Expand Down

0 comments on commit aaf4382

Please sign in to comment.