This repository has no description
0

Configure Feed

Select the types of activity you want to include in your feed.

1name: Raspberry Pi Camera Setup 2 3on: 4 release: 5 types: [published] 6 branches: [main] 7 8jobs: 9 build: 10 runs-on: ubuntu-latest 11 12 steps: 13 - name: Checkout repository 14 uses: actions/checkout@v3 15 16 - name: Modify Raspberry Pi OS Image 17 uses: dtcooper/rpi-image-modifier@v1 18 id: create-image 19 with: 20 base-image-url: https://downloads.raspberrypi.org/raspios_lite_armhf_latest 21 image-path: raspios-camera-ssh-usb.img 22 compress-with-xz: true 23 shrink: true 24 mount-repository: true 25 run: | 26 # Set locale and timezone 27 echo "en_US.UTF-8 UTF-8" > /etc/locale.gen 28 locale-gen 29 update-locale LANG=en_US.UTF-8 30 ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime 31 32 # Create inky user first 33 useradd -m -s /bin/bash -G sudo,adm,dialout,cdrom,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi inky 34 echo "inky:inkycamera" | chpasswd 35 36 # Set hostname 37 echo "inky" > /etc/hostname 38 sed -i 's/raspberrypi/inky/' /etc/hosts 39 40 # Now copy camera files since /home/inky exists 41 cp -v /mounted-github-repo/src/camera_server.py /home/inky/camera_server.py 42 cp -v /mounted-github-repo/src/camera.service /etc/systemd/system/camera.service 43 44 # Set permissions 45 chown -R inky:inky /home/inky 46 47 # Configure SSH over USB 48 echo "dtoverlay=dwc2" >> /boot/config.txt 49 sed -i 's/rootwait/rootwait modules-load=dwc2,g_ether/' /boot/cmdline.txt 50 touch /boot/ssh 51 52 # Create setup script 53 cat << 'EEOF' > /home/inky/setup.sh 54 #!/bin/bash 55 sudo systemctl daemon-reload 56 sudo systemctl enable camera.service 57 sudo systemctl start camera.service 58 EEOF 59 chmod +x /home/inky/setup.sh 60 61 # Create and configure rc.local 62 cat << 'EOF' > /etc/rc.local 63 #!/bin/sh -e 64 /home/inky/setup.sh 65 exit 0 66 EOF 67 chmod +x /etc/rc.local 68 69 # Install required packages 70 apt-get update 71 apt-get install -y python3-picamera2 python3-websockets 72 apt-get clean 73 74 - name: Upload image as artifact 75 uses: actions/upload-artifact@v4 76 with: 77 name: raspberry-pi-camera-image 78 path: ${{ steps.create-image.outputs.image-path }} 79 80 - name: Upload Release Asset 81 uses: softprops/action-gh-release@v1 82 with: 83 files: ${{ steps.create-image.outputs.image-path }} 84 env: 85 GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}