this repo has no description
1
fork

Configure Feed

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

chore: move to rpi image modifier

+52 -48
+52 -48
.github/workflows/image-generator.yaml
··· 13 13 - name: Checkout repository 14 14 uses: actions/checkout@v3 15 15 16 - - name: Create custom stage 17 - run: | 18 - # Create custom stage directory 19 - mkdir -p camera-stage 20 - 21 - # Create packages list 22 - cat << EOF > camera-stage/00-packages 23 - python3-picamera2 24 - python3-websockets 25 - EOF 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 26 31 27 - # Create setup script 28 - cat << 'EOF' > camera-stage/01-run-chroot.sh 29 - #!/bin/bash -e 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 30 35 31 - # Create inky user 32 - useradd -m -s /bin/bash -G sudo,adm,dialout,cdrom,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi inky 33 - echo "inky:inkycamera" | chpasswd 36 + # Set hostname 37 + echo "inky" > /etc/hostname 38 + sed -i 's/raspberrypi/inky/' /etc/hosts 34 39 35 - # Copy camera files 36 - cp /tmp/camera_server.py /home/inky/ 37 - cp /tmp/camera.service /etc/systemd/system/ 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 38 43 39 - # Set permissions 40 - chown -R inky:inky /home/inky 44 + # Set permissions 45 + chown -R inky:inky /home/inky 41 46 42 - # Enable service 43 - systemctl enable camera.service 44 - EOF 45 - chmod +x camera-stage/01-run-chroot.sh 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 46 51 47 - # Create copy files script 48 - mkdir -p camera-stage/files 49 - cp ./src/camera_server.py camera-stage/files/ 50 - cp ./src/camera.service camera-stage/files/ 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 51 60 52 - cat << 'EOF' > camera-stage/02-run.sh 53 - #!/bin/bash -e 54 - cp files/camera_server.py "${ROOTFS_DIR}/tmp/" 55 - cp files/camera.service "${ROOTFS_DIR}/tmp/" 56 - EOF 57 - chmod +x camera-stage/02-run.sh 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 58 68 59 - - name: Build image 60 - uses: usimd/pi-gen-action@v1 61 - with: 62 - image-name: raspios-camera-ssh-usb 63 - stage-list: stage0 stage1 stage2 ./camera-stage 64 - enable-ssh: 1 65 - hostname: inky 66 - username: inky 67 - password: inkycamera 68 - compression: xz 69 + # Install required packages 70 + apt-get update 71 + apt-get install -y python3-picamera2 python3-websockets 72 + apt-get clean 69 73 70 74 - name: Upload image as artifact 71 75 uses: actions/upload-artifact@v4 72 76 with: 73 77 name: raspberry-pi-camera-image 74 - path: pi-gen/deploy/*.img.xz 78 + path: ${{ steps.create-image.outputs.image-path }} 75 79 76 80 - name: Upload Release Asset 77 81 uses: softprops/action-gh-release@v1 78 82 with: 79 - files: pi-gen/deploy/*.img.xz 83 + files: ${{ steps.create-image.outputs.image-path }} 80 84 env: 81 - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} 85 + GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}