alpha
Login
or
Join now
dunkirk.sh
/
inky
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
This repository has no description
Star
0
Fork
0
Atom
Configure Feed
Issues
Pull Requests
Commits
Tags
Feed URL
Select the types of activity you want to include in your feed.
Overview
Issues
Pulls
Pipelines
chore: move to rpi image modifier
author
Kieran Klukas
date
1 year ago
(Apr 12, 2025, 12:40 AM -0400)
commit
b1cf10d7
b1cf10d7df96549c660b2027b50478ddf10dfeab
parent
9d0a8ebe
9d0a8ebef69c101f458ef8947ac359b2f233e0dd
+52
-48
1 changed file
Expand all
Collapse all
Unified
Split
.github
workflows
image-generator.yaml
+52
-48
.github/workflows/image-generator.yaml
Reviewed
···
13
13
- name: Checkout repository
14
14
uses: actions/checkout@v3
15
15
16
16
-
- name: Create custom stage
17
17
-
run: |
18
18
-
# Create custom stage directory
19
19
-
mkdir -p camera-stage
20
20
-
21
21
-
# Create packages list
22
22
-
cat << EOF > camera-stage/00-packages
23
23
-
python3-picamera2
24
24
-
python3-websockets
25
25
-
EOF
16
16
+
- name: Modify Raspberry Pi OS Image
17
17
+
uses: dtcooper/rpi-image-modifier@v1
18
18
+
id: create-image
19
19
+
with:
20
20
+
base-image-url: https://downloads.raspberrypi.org/raspios_lite_armhf_latest
21
21
+
image-path: raspios-camera-ssh-usb.img
22
22
+
compress-with-xz: true
23
23
+
shrink: true
24
24
+
mount-repository: true
25
25
+
run: |
26
26
+
# Set locale and timezone
27
27
+
echo "en_US.UTF-8 UTF-8" > /etc/locale.gen
28
28
+
locale-gen
29
29
+
update-locale LANG=en_US.UTF-8
30
30
+
ln -sf /usr/share/zoneinfo/America/New_York /etc/localtime
26
31
27
27
-
# Create setup script
28
28
-
cat << 'EOF' > camera-stage/01-run-chroot.sh
29
29
-
#!/bin/bash -e
32
32
+
# Create inky user first
33
33
+
useradd -m -s /bin/bash -G sudo,adm,dialout,cdrom,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi inky
34
34
+
echo "inky:inkycamera" | chpasswd
30
35
31
31
-
# Create inky user
32
32
-
useradd -m -s /bin/bash -G sudo,adm,dialout,cdrom,audio,video,plugdev,games,users,input,netdev,gpio,i2c,spi inky
33
33
-
echo "inky:inkycamera" | chpasswd
36
36
+
# Set hostname
37
37
+
echo "inky" > /etc/hostname
38
38
+
sed -i 's/raspberrypi/inky/' /etc/hosts
34
39
35
35
-
# Copy camera files
36
36
-
cp /tmp/camera_server.py /home/inky/
37
37
-
cp /tmp/camera.service /etc/systemd/system/
40
40
+
# Now copy camera files since /home/inky exists
41
41
+
cp -v /mounted-github-repo/src/camera_server.py /home/inky/camera_server.py
42
42
+
cp -v /mounted-github-repo/src/camera.service /etc/systemd/system/camera.service
38
43
39
39
-
# Set permissions
40
40
-
chown -R inky:inky /home/inky
44
44
+
# Set permissions
45
45
+
chown -R inky:inky /home/inky
41
46
42
42
-
# Enable service
43
43
-
systemctl enable camera.service
44
44
-
EOF
45
45
-
chmod +x camera-stage/01-run-chroot.sh
47
47
+
# Configure SSH over USB
48
48
+
echo "dtoverlay=dwc2" >> /boot/config.txt
49
49
+
sed -i 's/rootwait/rootwait modules-load=dwc2,g_ether/' /boot/cmdline.txt
50
50
+
touch /boot/ssh
46
51
47
47
-
# Create copy files script
48
48
-
mkdir -p camera-stage/files
49
49
-
cp ./src/camera_server.py camera-stage/files/
50
50
-
cp ./src/camera.service camera-stage/files/
52
52
+
# Create setup script
53
53
+
cat << 'EEOF' > /home/inky/setup.sh
54
54
+
#!/bin/bash
55
55
+
sudo systemctl daemon-reload
56
56
+
sudo systemctl enable camera.service
57
57
+
sudo systemctl start camera.service
58
58
+
EEOF
59
59
+
chmod +x /home/inky/setup.sh
51
60
52
52
-
cat << 'EOF' > camera-stage/02-run.sh
53
53
-
#!/bin/bash -e
54
54
-
cp files/camera_server.py "${ROOTFS_DIR}/tmp/"
55
55
-
cp files/camera.service "${ROOTFS_DIR}/tmp/"
56
56
-
EOF
57
57
-
chmod +x camera-stage/02-run.sh
61
61
+
# Create and configure rc.local
62
62
+
cat << 'EOF' > /etc/rc.local
63
63
+
#!/bin/sh -e
64
64
+
/home/inky/setup.sh
65
65
+
exit 0
66
66
+
EOF
67
67
+
chmod +x /etc/rc.local
58
68
59
59
-
- name: Build image
60
60
-
uses: usimd/pi-gen-action@v1
61
61
-
with:
62
62
-
image-name: raspios-camera-ssh-usb
63
63
-
stage-list: stage0 stage1 stage2 ./camera-stage
64
64
-
enable-ssh: 1
65
65
-
hostname: inky
66
66
-
username: inky
67
67
-
password: inkycamera
68
68
-
compression: xz
69
69
+
# Install required packages
70
70
+
apt-get update
71
71
+
apt-get install -y python3-picamera2 python3-websockets
72
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
74
-
path: pi-gen/deploy/*.img.xz
78
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
79
-
files: pi-gen/deploy/*.img.xz
83
83
+
files: ${{ steps.create-image.outputs.image-path }}
80
84
env:
81
81
-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85
85
+
GITHUB_TOKEN: ${{ secrets.PERSONAL_GITHUB_TOKEN }}