Skip to content

Commit 2985a9c

Browse files
committed
layer: Add Raspberry Pi Connect
Two new layers added to enable installation of Raspberry Pi Connect (with or without screen-sharing), plus Auth key support. An accompanying companion document provides additional information. Whether or not the client starts at boot is controlled via a config variable which defaults to on (since embedded/industrial deployments will typically want Connect to start automatically at boot).
1 parent 573dbc0 commit 2985a9c

File tree

8 files changed

+181
-0
lines changed

8 files changed

+181
-0
lines changed

docs/layer/index.html

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -905,6 +905,20 @@ <h3>Kernel</h3>
905905

906906
</div>
907907

908+
<h3>Service</h3>
909+
<div class="layer-list">
910+
911+
<div class="layer-item">
912+
<a href="rpi-connect.html">rpi-connect</a><span class="layer-desc">- Raspberry Pi Connect client with screen-sharing support and
913+
remote shell access</span>
914+
</div>
915+
916+
<div class="layer-item">
917+
<a href="rpi-connect-lite.html">rpi-connect-lite</a><span class="layer-desc">- Raspberry Pi Connect client with remote shell access</span>
918+
</div>
919+
920+
</div>
921+
908922
<h3>Suite</h3>
909923
<div class="layer-list">
910924

docs/layer/rpi-user-credentials.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -148,6 +148,10 @@ <h2>Relationships</h2>
148148

149149
<a href="openssh-server.html" class="dep-badge">openssh-server</a>
150150

151+
<a href="rpi-connect.html" class="dep-badge">rpi-connect</a>
152+
153+
<a href="rpi-connect-lite.html" class="dep-badge">rpi-connect-lite</a>
154+
151155
<a href="trixie-minbase.html" class="dep-badge">trixie-minbase</a>
152156

153157
</div>

docs/layer/systemd-min.html

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,10 @@ <h2>Relationships</h2>
138138
<p><strong>Required by:</strong></p>
139139
<div class="deps">
140140

141+
<a href="rpi-connect.html" class="dep-badge">rpi-connect</a>
142+
143+
<a href="rpi-connect-lite.html" class="dep-badge">rpi-connect-lite</a>
144+
141145
<a href="systemd-net-min.html" class="dep-badge">systemd-net-min</a>
142146

143147
</div>
Lines changed: 34 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,34 @@
1+
= Raspberry Pi Connect
2+
3+
== Installation
4+
5+
Configuration variable `IGconf_connect_on` provided by this layer dictates whether Raspberry Pi Connect is enabled at system start up. This is equivalent to running `rpi-connect on` from the device command line.
6+
7+
== Authentication Key
8+
9+
To link your device to your Raspberry Pi Connect account automatically, generate an Auth key in your account Settings and set `IGconf_connect_authkey` to either:
10+
11+
* An absolute path to a file containing the key, or
12+
* The key value itself
13+
14+
Like other variables, `IGconf_connect_authkey` can be set on the command line or via the config system. For example:
15+
16+
[source,bash]
17+
----
18+
$ rpi-image-gen build <args> -- IGconf_connect_authkey=$KEY
19+
----
20+
21+
[source,yaml]
22+
----
23+
connect:
24+
authkey: /path/to/file
25+
----
26+
27+
[source,yaml]
28+
----
29+
connect:
30+
authkey: $KEY
31+
----
32+
33+
Please refer to the https://www.raspberrypi.com/documentation/services/connect.html[Raspberry Pi Connect documentation,window=_blank] for further details.
34+
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rpi-connect-common.adoc
Lines changed: 60 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,60 @@
1+
# METABEGIN
2+
# X-Env-Layer-Name: rpi-connect-lite
3+
# X-Env-Layer-Category: service
4+
# X-Env-Layer-Desc: Raspberry Pi Connect client with remote shell access
5+
# X-Env-Layer-Version: 1.0.0
6+
# X-Env-Layer-Requires: systemd-min,rpi-user-credentials
7+
# X-Env-Layer-Provides: rpi-connect-client
8+
#
9+
# X-Env-VarRequires: IGconf_device_user1
10+
# X-Env-VarRequires-Valid: string
11+
#
12+
# X-Env-VarPrefix: connect
13+
#
14+
# X-Env-Var-authkey:
15+
# X-Env-Var-authkey-Desc: Auth key generated via Raspberry Pi Connect account
16+
# Settings. This can hold a path to the key file or the key itself.
17+
# X-Env-Var-authkey-Required: n
18+
# X-Env-Var-authkey-Valid: string
19+
# X-Env-Var-authkey-Set: n
20+
#
21+
# X-Env-Var-on: y
22+
# X-Env-Var-on-Desc: Enable Raspberry Pi Connect on system startup
23+
# X-Env-Var-on-Required: n
24+
# X-Env-Var-on-Valid: bool
25+
# X-Env-Var-on-Set: y
26+
# METAEND
27+
---
28+
mmdebstrap:
29+
packages:
30+
- rpi-connect-lite
31+
customize-hooks:
32+
- |-
33+
set -eu
34+
uchroot "$1" 'mkdir -m 0700 -p ${HOME}/.config/com.raspberrypi.connect'
35+
36+
# Write the authkey from file or as string
37+
if [ -n "${IGconf_connect_authkey-}" ] ; then
38+
if [ -f "$IGconf_connect_authkey" ]; then
39+
uchroot "$1" 'umask 077; cat > "$HOME/.config/com.raspberrypi.connect/auth.key"' \
40+
< "$IGconf_connect_authkey"
41+
else
42+
printf '%s' "$IGconf_connect_authkey" | \
43+
uchroot "$1" 'umask 077; cat > "$HOME/.config/com.raspberrypi.connect/auth.key"'
44+
fi
45+
echo "Raspberry Pi Connect Auth key installed"
46+
fi
47+
48+
# Enable units
49+
uchroot "$1" 'set -e
50+
base="$HOME/.config/systemd/user"
51+
mkdir -p "$base/default.target.wants" "$base/rpi-connect.service.wants"
52+
ln -sf /usr/lib/systemd/user/rpi-connect.service "$base/default.target.wants/rpi-connect.service"
53+
ln -sf /usr/lib/systemd/user/rpi-connect-signin.path "$base/rpi-connect.service.wants/rpi-connect-signin.path"'
54+
55+
# Write linger marker to trigger auto start via logind
56+
install -d -m 0755 "$1/var/lib/systemd/linger"
57+
if [ "$IGconf_connect_on" = "y" ]; then
58+
install -m 0644 /dev/null "$1/var/lib/systemd/linger/$IGconf_device_user1"
59+
echo "Raspberry Pi Connect (lite) enabled for system startup"
60+
fi
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
rpi-connect-common.adoc
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
# METABEGIN
2+
# X-Env-Layer-Name: rpi-connect
3+
# X-Env-Layer-Category: service
4+
# X-Env-Layer-Desc: Raspberry Pi Connect client with screen-sharing support and
5+
# remote shell access
6+
# X-Env-Layer-Version: 1.0.0
7+
# X-Env-Layer-Requires: systemd-min,rpi-user-credentials
8+
# X-Env-Layer-Provides: rpi-connect-client
9+
#
10+
# X-Env-VarRequires: IGconf_device_user1
11+
# X-Env-VarRequires-Valid: string
12+
#
13+
# X-Env-VarPrefix: connect
14+
#
15+
# X-Env-Var-authkey:
16+
# X-Env-Var-authkey-Desc: Auth key generated via Raspberry Pi Connect account
17+
# Settings. This can hold a path to the key file or the key itself.
18+
# X-Env-Var-authkey-Required: n
19+
# X-Env-Var-authkey-Valid: string
20+
# X-Env-Var-authkey-Set: n
21+
#
22+
# X-Env-Var-on: y
23+
# X-Env-Var-on-Desc: Enable Raspberry Pi Connect on system startup
24+
# X-Env-Var-on-Required: n
25+
# X-Env-Var-on-Valid: bool
26+
# X-Env-Var-on-Set: y
27+
# METAEND
28+
---
29+
mmdebstrap:
30+
packages:
31+
- rpi-connect
32+
- wayvnc
33+
customize-hooks:
34+
- |-
35+
set -eu
36+
uchroot "$1" 'mkdir -m 0700 -p ${HOME}/.config/com.raspberrypi.connect'
37+
38+
# Write the authkey from file or as string
39+
if [ -n "${IGconf_connect_authkey-}" ] ; then
40+
if [ -f "$IGconf_connect_authkey" ]; then
41+
uchroot "$1" 'umask 077; cat > "$HOME/.config/com.raspberrypi.connect/auth.key"' \
42+
< "$IGconf_connect_authkey"
43+
else
44+
printf '%s' "$IGconf_connect_authkey" | \
45+
uchroot "$1" 'umask 077; cat > "$HOME/.config/com.raspberrypi.connect/auth.key"'
46+
fi
47+
echo "Raspberry Pi Connect Auth key installed"
48+
fi
49+
50+
# Enable units
51+
uchroot "$1" 'set -e
52+
base="$HOME/.config/systemd/user"
53+
mkdir -p "$base/default.target.wants" "$base/rpi-connect.service.wants"
54+
ln -sf /usr/lib/systemd/user/rpi-connect.service "$base/default.target.wants/rpi-connect.service"
55+
ln -sf /usr/lib/systemd/user/rpi-connect-signin.path "$base/rpi-connect.service.wants/rpi-connect-signin.path"
56+
ln -sf /usr/lib/systemd/user/rpi-connect-wayvnc.service "$base/rpi-connect.service.wants/rpi-connect-wayvnc.service"'
57+
58+
# Write linger marker to trigger auto start via logind
59+
install -d -m 0755 "$1/var/lib/systemd/linger"
60+
if [ "$IGconf_connect_on" = "y" ]; then
61+
install -m 0644 /dev/null "$1/var/lib/systemd/linger/$IGconf_device_user1"
62+
echo "Raspberry Pi Connect enabled for system startup"
63+
fi

0 commit comments

Comments
 (0)