@dotpi/tools 1.3.3 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (130) hide show
  1. package/.editorbackup/NOTES.md~ +974 -0
  2. package/.editorbackup/PIPEWIRE.md~ +42 -0
  3. package/.editorbackup/README.md~ +335 -0
  4. package/BACKUP-SANDO.command +61 -0
  5. package/BACKUP-SISIDO.command +61 -0
  6. package/PIPEWIRE.md +280 -0
  7. package/dotpi_root/bin/.editorbackup/dotpi_firstrun.bash~ +149 -0
  8. package/dotpi_root/bin/.editorbackup/dotpi_firstrun~ +177 -0
  9. package/dotpi_root/bin/.editorbackup/dotpi_prepare_sd_card.bash~ +425 -0
  10. package/dotpi_root/bin/.editorbackup/dotpi_prepare_sd_card~ +620 -0
  11. package/dotpi_root/bin/.editorbackup/dotpi_prepare_system.bash~ +82 -0
  12. package/dotpi_root/bin/.editorbackup/dotpi_prepare_system~ +100 -0
  13. package/dotpi_root/bin/.editorbackup/dotpi~ +61 -0
  14. package/dotpi_root/bin/.editorbackup/prepare_sd_card.bash~ +252 -0
  15. package/dotpi_root/bin/dotpi_prepare_system +5 -0
  16. package/dotpi_root/etc/.editorbackup/dotpi_environment_default.bash~ +49 -0
  17. package/dotpi_root/etc/.editorbackup/dotpi_environment_instance.bash~ +1 -0
  18. package/dotpi_root/etc/.editorbackup/dotpi_environment_project.bash~ +33 -0
  19. package/dotpi_root/etc/.editorbackup/dotpi_tarignore~ +4 -0
  20. package/dotpi_root/share/.editorbackup/coucou~ +1 -0
  21. package/dotpi_root/share/.editorbackup/dotpi_environment.bash~ +9 -0
  22. package/dotpi_root/share/.editorbackup/dotpi_functions.bash~ +11 -0
  23. package/dotpi_root/share/.editorbackup/dotpi_functions_configuration.bash~ +420 -0
  24. package/dotpi_root/share/.editorbackup/dotpi_functions_connection.bash~ +358 -0
  25. package/dotpi_root/share/.editorbackup/dotpi_init.bash~ +18 -0
  26. package/dotpi_root/share/dotpi_audio_alsa/dotpi_audio_alsa.service +15 -0
  27. package/dotpi_root/share/dotpi_audio_bluetooth/.editorbackup/dotpi_audio_bluetooth.service~ +24 -0
  28. package/dotpi_root/share/dotpi_audio_bluetooth/.editorbackup/dotpi_audio_bluetooth_command~ +80 -0
  29. package/dotpi_root/share/dotpi_audio_bluetooth/.editorbackup/dotpi_audio_bluetooth_start_command~ +26 -0
  30. package/dotpi_root/share/dotpi_audio_bluetooth/.editorbackup/dotpi_audio_bluetooth_stop_command~ +30 -0
  31. package/dotpi_root/share/dotpi_audio_bluetooth/.editorbackup/dotpi_bluetooth_audio.service~ +21 -0
  32. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_audio_bluetooth.bash~ +256 -0
  33. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_audio_device.bash~ +287 -0
  34. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_bluetooth_audio.bash~ +7 -0
  35. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_configuration.bash~ +428 -0
  36. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_connection.bash~ +194 -0
  37. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_daemon.bash~ +26 -0
  38. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_soundcard.bash~ +287 -0
  39. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_soundcards.bash~ +12 -0
  40. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_system.bash~ +158 -0
  41. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_utils.bash~ +152 -0
  42. package/dotpi_root/share/dotpi_init.bash +3 -0
  43. package/dotpi_root/share/dotpi_pipewire/bin/dotpi_pipewire_relink +85 -0
  44. package/dotpi_root/share/dotpi_pipewire/dotpi_install +24 -0
  45. package/dotpi_root/share/dotpi_pipewire/systemd/dotpi_pipewire.service +22 -0
  46. package/dotpi_root/share/dotpi_pipewire/systemd/dotpi_pipewire_command +29 -0
  47. package/dotpi_root/share/jackd/.editorbackup/dotpi_jackd_bluetooth.bash~ +20 -0
  48. package/dotpi_root/share/jackd/.editorbackup/dotpi_jackd_command~ +17 -0
  49. package/dotpi_root/share/jackd/.editorbackup/dotpi_jackd_headphones.bash~ +20 -0
  50. package/dotpi_root/share/jackd/.editorbackup/dotpi_jackd_hifiberry.bash~ +16 -0
  51. package/dotpi_root/share/jackd/.editorbackup/jackd.conf~ +5 -0
  52. package/dotpi_root/share/jackd/.editorbackup/jackd.service~ +15 -0
  53. package/dotpi_root/share/jackd/.editorbackup/jackd_headphones.conf~ +5 -0
  54. package/dotpi_root/share/jackd/dotpi_jack_simple_client.service +23 -0
  55. package/dotpi_root/share/wireplumber/.editorbackup/8zzz-dotpi-wireplumber-config.lua~ +1 -0
  56. package/package.json +1 -1
  57. package/projects/asterismes.tgz +0 -0
  58. package/projects/example-bluetooth/configuration/.editorbackup/dotpi_instance_001.bash~ +4 -0
  59. package/projects/example-bluetooth/configuration/.editorbackup/dotpi_instance_002.bash~ +3 -0
  60. package/projects/example-bluetooth/configuration/.editorbackup/dotpi_project.bash~ +46 -0
  61. package/projects/example-bluetooth/configuration/dotpi_instance_001.bash +3 -0
  62. package/projects/example-bluetooth/configuration/dotpi_instance_002.bash +3 -0
  63. package/projects/example-bluetooth/configuration/dotpi_project.bash +48 -0
  64. package/projects/example-development/configuration/.editorbackup/dotpi_project.bash~ +59 -0
  65. package/projects/example-development/configuration/dotpi_instance_114.bash +4 -0
  66. package/projects/example-headphones/configuration/.editorbackup/dotpi_project.bash~ +18 -0
  67. package/projects/example-hifiberry/configuration/.editorbackup/dotpi_instance_012.bash~ +4 -0
  68. package/projects/example-hifiberry/configuration/.editorbackup/dotpi_project.bash~ +18 -0
  69. package/projects/example-network/configuration/.editorbackup/dotpi_project.bash~ +21 -0
  70. package/projects/old/bad/.editorbackup/dotpi_environment_instance.bash~ +1 -0
  71. package/projects/old/bad/.editorbackup/dotpi_environment_project.bash~ +26 -0
  72. package/projects/old/bad/.editorbackup/dotpi_project.bash~ +33 -0
  73. package/projects/old/bad/.editorbackup/dotpi_tmp.bash~ +3 -0
  74. package/projects/old/bad/.editorbackup/wpa_supplicant.conf~ +37 -0
  75. package/projects/old/bad/dotpi_project.bash +20 -0
  76. package/projects/old/bluetooth/.editorbackup/dotpi_environment_instance.bash~ +1 -0
  77. package/projects/old/bluetooth/.editorbackup/dotpi_environment_project.bash~ +26 -0
  78. package/projects/old/bluetooth/.editorbackup/dotpi_project.bash~ +21 -0
  79. package/projects/old/bluetooth/.editorbackup/dotpi_tmp.bash~ +3 -0
  80. package/projects/old/bluetooth/.editorbackup/wpa_supplicant.conf~ +37 -0
  81. package/projects/old/bluetooth/dotpi_project.bash +29 -0
  82. package/projects/old/dev.bak/.editorbackup/dotpi_environment_instance.bash~ +1 -0
  83. package/projects/old/dev.bak/.editorbackup/dotpi_environment_project.bash~ +33 -0
  84. package/projects/old/dev.bak/.editorbackup/wpa_supplicant.conf~ +37 -0
  85. package/projects/old/dev.bak/dotpi_environment_instance.bash +1 -0
  86. package/projects/old/dev.bak/dotpi_environment_project.bash +46 -0
  87. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/.editorbackup/DOTPI-A114.nmconnection~ +24 -0
  88. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/.editorbackup/DOTPI.nmconnection~ +24 -0
  89. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/.editorbackup/Livebox-97C6_wifi_invite.nmconnection~ +24 -0
  90. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/.editorbackup/onze.nmconnection~ +22 -0
  91. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/.editorbackup/welcome.nmconnection~ +23 -0
  92. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/DOTPI-A114.nmconnection +23 -0
  93. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/DOTPI.nmconnection +23 -0
  94. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/Livebox-97C6_wifi_invite.nmconnection +24 -0
  95. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/onze.nmconnection +24 -0
  96. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/welcome.nmconnection +23 -0
  97. package/projects/old/dev.bak/network/.editorbackup/DOTPI-A114.nmconnection~ +24 -0
  98. package/projects/old/dev.bak/network/.editorbackup/DOTPI.nmconnection~ +24 -0
  99. package/projects/old/dev.bak/network/.editorbackup/Livebox-97C6_wifi_invite.nmconnection~ +24 -0
  100. package/projects/old/dev.bak/network/.editorbackup/onze.nmconnection~ +22 -0
  101. package/projects/old/dev.bak/network/.editorbackup/welcome.nmconnection~ +23 -0
  102. package/projects/old/dev.bak/network/AccueilCie.nmconnection +24 -0
  103. package/projects/old/dev.bak/network/DOTPI-A114.nmconnection +23 -0
  104. package/projects/old/dev.bak/network/DOTPI.nmconnection +23 -0
  105. package/projects/old/dev.bak/network/Livebox-97C6_wifi_invite.nmconnection +25 -0
  106. package/projects/old/dev.bak/network/onze.nmconnection +24 -0
  107. package/projects/old/dev.bak/network/welcome.nmconnection +23 -0
  108. package/projects/old/dev.bak/network/wifi-access-point.nmconnection +23 -0
  109. package/projects/old/dev.bak/network/wifi-internet.nmconnection +24 -0
  110. package/projects/old/dev.bak/network/wifi-ircam-public.nmconnection +24 -0
  111. package/projects/old/dev.bak/network/wifi-local.nmconnection +22 -0
  112. package/projects/old/dev.bak/network/wifi-welcome.nmconnection +24 -0
  113. package/projects/old/dev.bak/wpa_supplicant.conf +43 -0
  114. package/projects/old/dev.zip +0 -0
  115. package/projects/old/example/.editorbackup/dotpi_environment_instance.bash~ +1 -0
  116. package/projects/old/example/.editorbackup/dotpi_environment_project.bash~ +26 -0
  117. package/projects/old/example/.editorbackup/dotpi_project.bash~ +21 -0
  118. package/projects/old/example/.editorbackup/dotpi_tmp.bash~ +3 -0
  119. package/projects/old/example/.editorbackup/wpa_supplicant.conf~ +37 -0
  120. package/projects/old/example/configuration/.editorbackup/dotpi_project.bash~ +21 -0
  121. package/projects/old/example/configuration/dotpi_project.bash +21 -0
  122. package/projects/old/example-complete.bak/.editorbackup/dotpi_environment_instance.bash~ +1 -0
  123. package/projects/old/example-complete.bak/.editorbackup/dotpi_environment_project.bash~ +26 -0
  124. package/projects/old/example-complete.bak/.editorbackup/dotpi_project.bash~ +21 -0
  125. package/projects/old/example-complete.bak/.editorbackup/dotpi_tmp.bash~ +3 -0
  126. package/projects/old/example-complete.bak/.editorbackup/wpa_supplicant.conf~ +37 -0
  127. package/projects/old/example-complete.bak/configuration/.editorbackup/dotpi_project.bash~ +21 -0
  128. package/projects/old/example-complete.bak/configuration/dotpi_project.bash +21 -0
  129. package/projects/old/example-complete.bak/configuration/jackd/.editorbackup/dotpi_jackd.bash~ +14 -0
  130. package/projects/old/example-complete.bak/configuration/jackd/dotpi_jackd.bash +14 -0
package/PIPEWIRE.md ADDED
@@ -0,0 +1,280 @@
1
+ # Pipewire
2
+
3
+ - `systemctl --machine=pi@ --user`
4
+ - `tmux` session
5
+ - `bluez` / `bluetooth` service
6
+
7
+
8
+
9
+
10
+ ## Installation
11
+
12
+ See <https://wiki.debian.org/PipeWire#JACK>
13
+
14
+ ```log
15
+ 1 systemctl --user disable dotpi-manager.service
16
+ 2 sudo dotpi apt-get install pipewire pipewire-audio pipewire-jack
17
+ 6 systemctl --user enable --now wireplumber.service
18
+ 7 wpctl status
19
+ 8 sudo dotpi audio_bluetooth_destination_connect
20
+ 9 wpctl status
21
+ 10 sudo cp /usr/share/doc/pipewire/examples/ld.so.conf.d/pipewire-jack-*.conf /etc/ld.so.conf.d/
22
+ 11 sudo mv /etc/ld.so.conf.d/pipewire-jack-aarch64-linux-gnu.conf /etc/ld.so.conf.d/0-pipewire-jack-aarch64-linux-gnu.conf
23
+ 12 sudo ldconfig
24
+ 14 sudo dotpi apt-get install jackd
25
+ 15 jack_simple_client
26
+ ```
27
+
28
+
29
+ Version 0.3.65 in Raspberry Pi OS (Debian Bookworm).
30
+
31
+ Search for `spa` or `libspa` for plugins, in particular:
32
+
33
+ - [ ] jack
34
+ - [ ] alsa
35
+
36
+ `pipewire-media-session` is deprecated. Better use `wireplumber`.
37
+
38
+ ```sh
39
+ systemctl --user --now enable wireplumber.service
40
+ ```
41
+
42
+ <https://wiki.debian.org/PipeWire#Debian_12>
43
+
44
+ > When using WirePlumber, the amount of required configuration to use PipeWire as your sound server is very minimal. In fact, the WirePlumber package recommends pipewire-pulse, so that will likely happen automatically. You'll only have to enable the ALSA and JACK layers manually, which no longer require creating an empty file in your media session's configuration directory (as that directory won't even exist when using WirePlumber), but will still require copying files from your /usr/share/doc/pipewire/examples/ directory, as described in the Debian 11 instructions.
45
+
46
+ ### Realtime audio
47
+
48
+ Default priority (-89) seems fine.
49
+
50
+ Uses `RTKit`? Errors?
51
+
52
+ At the moment rtkit is not installed
53
+
54
+ ### Alsa
55
+
56
+ ```sh
57
+ sudo cp /usr/share/doc/pipewire/examples/alsa.conf.d/99-pipewire-default.conf /etc/alsa/conf.d/
58
+ ```
59
+
60
+ Be sure to set `Master` control to `100%`.
61
+
62
+ Note that pipewire does not over-ride `sysdefault`, only `default``.
63
+
64
+ ```sh
65
+ $ aplay -L
66
+ null
67
+ Discard all samples (playback) or generate zero samples (capture)
68
+ bluealsa
69
+ Bluetooth Audio Hub
70
+ pipewire
71
+ PipeWire Sound Server
72
+ default
73
+ Default ALSA Output (currently PipeWire Media Server)
74
+ hw:CARD=sndrpihifiberry,DEV=0
75
+ snd_rpi_hifiberry_dacplusadcpro, HiFiBerry DAC+ADC Pro HiFi multicodec-0
76
+ Direct hardware device without any conversions
77
+ plughw:CARD=sndrpihifiberry,DEV=0
78
+ snd_rpi_hifiberry_dacplusadcpro, HiFiBerry DAC+ADC Pro HiFi multicodec-0
79
+ Hardware device with all software conversions
80
+ sysdefault:CARD=sndrpihifiberry
81
+ snd_rpi_hifiberry_dacplusadcpro, HiFiBerry DAC+ADC Pro HiFi multicodec-0
82
+ Default Audio Device
83
+ dmix:CARD=sndrpihifiberry,DEV=0
84
+ snd_rpi_hifiberry_dacplusadcpro, HiFiBerry DAC+ADC Pro HiFi multicodec-0
85
+ Direct sample mixing device
86
+ ```
87
+
88
+ ### Jackd
89
+
90
+ Try to over-ride dynamic loading of jackd libray, to avoid prefixing client commands with `pw-jack`.
91
+
92
+ > Install the pipewire-audio-client-libraries and libspa-0.2-jack packages, if not already installed.
93
+
94
+ ```sh
95
+ # Either run JACK clients using the pw-jack wrapper, or copy:
96
+ sudo cp /usr/share/doc/pipewire/examples/ld.so.conf.d/pipewire-jack-*.conf /etc/ld.so.conf.d/
97
+ # and run
98
+ ldconfig
99
+ ```
100
+
101
+ ```sh
102
+ pw-jack bash -c 'echo $LD_LIBRARY_PATH'
103
+ # /usr/${LIB}/pipewire-0.3/jack
104
+ ```
105
+
106
+ Compare pipewire `/etc/pipewire/jack.conf`
107
+
108
+ ```conf
109
+ # global properties for all jack clients
110
+ jack.properties = {
111
+ node.latency = 256/48000
112
+ node.rate = 1/48000
113
+ node.quantum = 128/48000
114
+ node.lock-quantum = true
115
+ node.force-quantum = 128/48000
116
+ #jack.show-monitor = true
117
+ #jack.merge-monitor = true
118
+ #jack.short-name = false
119
+ #jack.filter-name = false
120
+ #jack.filter-char = " "
121
+ #
122
+ # allow: Don't restrict self connect requests
123
+ # fail-external: Fail self connect requests to external ports only
124
+ # ignore-external: Ignore self connect requests to external ports only
125
+ # fail-all: Fail all self connect requests
126
+ # ignore-all: Ignore all self connect requests
127
+ #jack.self-connect-mode = allow
128
+ #jack.locked-process = true
129
+ #jack.default-as-system = false
130
+ #jack.fix-midi-events = true
131
+ #jack.global-buffer-size = false
132
+ session.suspend-timeout-seconds = 0 # default is 5
133
+ }
134
+
135
+ ```
136
+
137
+ than with jackd. Cf. `/opt/dotpi/share/jackd/dotpi_jackd_hifiberry.bash`:
138
+
139
+ ```bash
140
+ DOTPI_JACKD_ARGUMENTS=(
141
+ --realtime
142
+ --realtime-priority 95
143
+ -d alsa
144
+ --device hw:0,0
145
+ --duplex
146
+ --period 128
147
+ --nperiods 2
148
+ --rate 48000
149
+ )
150
+ ```
151
+
152
+ #### Latency
153
+
154
+ Pipewire
155
+
156
+ ```conf
157
+ node.latency = 256/48000
158
+ node.rate = 1/48000
159
+ node.quantum = 256/48000
160
+ node.lock-quantum = true
161
+ node.force-quantum = 256/48000
162
+ ```
163
+
164
+ ```
165
+ 670.440 frames 13.968 ms total roundtrip latency
166
+ extra loopback latency: 158 frames
167
+ use 79 for the backend arguments -I and -O
168
+ ```
169
+
170
+
171
+ ```conf
172
+ node.latency = 256/48000
173
+ node.rate = 1/48000
174
+ node.quantum = 128/48000
175
+ node.lock-quantum = true
176
+ node.force-quantum = 128/48000
177
+ ```
178
+
179
+ ```
180
+ 671.155 frames 13.982 ms total roundtrip latency
181
+ extra loopback latency: 159 frames
182
+ use 79 for the backend arguments -I and -O
183
+ ```
184
+
185
+ ```conf
186
+ node.latency = 128/48000
187
+ node.rate = 1/48000
188
+ node.quantum = 128/48000
189
+ node.lock-quantum = true
190
+ node.force-quantum = 128/48000
191
+ ```
192
+
193
+ ```
194
+ 392.311 frames 8.173 ms total roundtrip latency
195
+ extra loopback latency: 136 frames
196
+ use 68 for the backend arguments -I and -O
197
+ ```
198
+
199
+
200
+
201
+ Jackd:
202
+ ```
203
+ 434.351 frames 9.049 ms total roundtrip latency
204
+ extra loopback latency: 50 frames
205
+ use 25 for the backend arguments -I and -O
206
+ ```
207
+
208
+ ### Bluetooth
209
+
210
+ > At minimum, you will need to install the libspa-0.2-bluetooth package, remove the pulseaudio-module-bluetooth package, and then either reboot your computer or restart the PipeWire services, otherwise device connections will fail with "Protocol not available".
211
+
212
+ > PipeWire will attempt to choose the best possible codec by default. You can override this, and tweak many other related settings, in the /etc/pipewire/media-session.d/bluez-monitor.conf file. You can edit this directly, or store local per-user changes by copying the file to ~/.config/pipewire/media-session.d/bluez-monitor.conf and editing that instead.
213
+
214
+ ### Run with session
215
+
216
+ Need a user session? No, use lingering
217
+
218
+ ```sh
219
+ sudo loginctl enable-linger pi
220
+ ```
221
+
222
+ ```sh
223
+ systemctl --user status pipewire
224
+ ```
225
+
226
+ Install `wireplumber` instead of `pipewire-media-session`
227
+
228
+ ## Start with `pw-jack`
229
+
230
+ Is it possible to bypass that with the `ld` over-ride?
231
+
232
+ ```sh
233
+ sudo cp /usr/share/doc/pipewire/examples/ld.so.conf.d/pipewire-jack-*.conf /etc/ld.so.conf.d/
234
+ ```
235
+
236
+ ## Rust WebAudio
237
+
238
+ - [ ] dotpi-manager: 2 clients (2x jack connections) on startup.
239
+ - [ ] bad Alsa device selection (should be default, not hw:0)
240
+
241
+ ```log
242
+ Jan 30 17:52:22 dotpi-dev-076 systemd[1]: Starting dotpi-manager.service - dotpi manager...
243
+ Jan 30 17:52:22 dotpi-dev-076 systemd[1]: Started dotpi-manager.service - dotpi manager.
244
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: Failed to open client because of error: ClientError(FAILURE | SERVER_FAILED)
245
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: Failed to open client because of error: ClientError(FAILURE | SERVER_FAILED)
246
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: thread '<unnamed>' panicked at /home/pi/.cargo/registry/src/index.crates.io-6f17d22bba15001f/web-audio-api-0.38.0/src/io/cpal.rs:150:14:
247
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: error while querying config: BackendSpecific { err: BackendSpecificError { description: "ALSA function 'snd_pcm_open' failed with error 'EHOSTDOWN: Host is down'" } }
248
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: stack backtrace:
249
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 0: 0x7f8ec99c80 - <unknown>
250
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 1: 0x7f8eb68b2c - <unknown>
251
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 2: 0x7f8ec75d1c - <unknown>
252
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 3: 0x7f8ec9afc8 - <unknown>
253
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 4: 0x7f8ec9abec - <unknown>
254
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 5: 0x7f8ec9bae4 - <unknown>
255
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 6: 0x7f8ec9b630 - <unknown>
256
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 7: 0x7f8ec9b59c - <unknown>
257
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 8: 0x7f8ec9b590 - <unknown>
258
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 9: 0x7f8eb4a508 - <unknown>
259
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 10: 0x7f8eb4a870 - <unknown>
260
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 11: 0x7f8ed438fc - <unknown>
261
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 12: 0x7f8eb61e80 - <unknown>
262
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 13: 0x7f8ebd5d0c - <unknown>
263
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 14: 0xc2a6e4 - _ZN6v8impl12_GLOBAL__N_123FunctionCallbackWrapper6InvokeERKN2v820FunctionCallbackInfoINS2_5ValueEEE
264
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 15: 0xeefaf8 - _ZN2v88internal25FunctionCallbackArguments4CallENS0_15CallHandlerInfoE
265
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 16: 0xef006c - _ZN2v88internal12_GLOBAL__N_119HandleApiCallHelperILb1EEENS0_11MaybeHandleINS0_6ObjectEEEPNS0_7IsolateENS0_6HandleINS0_10HeapObjectEEENS8_INS0_20FunctionTemplateInfoEEENS8_IS4_EEPmi
266
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 17: 0xef065c - _ZN2v88internal21Builtin_HandleApiCallEiPmPNS0_7IsolateE
267
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: 18: 0x186d964 - Builtins_CEntry_Return1_ArgvOnStack_BuiltinExit
268
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: /opt/dotpi/share/dotpi-manager/runtime/node_modules/node-web-audio-api/monkey-patch.js:44
269
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: super(options);
270
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: ^
271
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: Error: error while querying config: BackendSpecific { err: BackendSpecificError { description: "ALSA function 'snd_pcm_open' failed with error 'EHOSTDOWN: Host is down'" } }
272
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: at new AudioContext (/opt/dotpi/share/dotpi-manager/runtime/node_modules/node-web-audio-api/monkey-patch.js:44:7)
273
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: at file:///opt/dotpi/share/dotpi-manager/runtime/src/clients/thing/controllers/test-audio.js:3:22
274
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: at ModuleJob.run (node:internal/modules/esm/module_job:218:25)
275
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: at ModuleLoader.import (node:internal/modules/esm/loader:329:24)
276
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: at loadESM (node:internal/process/esm_loader:28:7)
277
+ Jan 30 17:52:22 dotpi-dev-076 pw-jack[2765]: at handleMainPromise (node:internal/modules/run_main:113:12)
278
+ Jan 30 17:52:22 dotpi-dev-076 systemd[1]: dotpi-manager.service: Main process exited, code=exited, status=1/FAILURE
279
+ Jan 30 17:52:22 dotpi-dev-076 systemd[1]: dotpi-manager.service: Failed with result 'exit-code'.
280
+ ```
@@ -0,0 +1,149 @@
1
+ #!/bin/bash
2
+
3
+ set +e
4
+
5
+ local_file="$(readlink -f "$0")"
6
+ local_path="$(dirname "$local_file")"
7
+
8
+ DOTPI_ROOT="${DOTPI_ROOT:-/opt/dotpi}"
9
+
10
+ # run imager firstrun before, to allow for over-rides
11
+ file_name="${local_path}/imager_firstrun.sh"
12
+ if [ -x "$file_name" ] ; then
13
+ # do not source to avoid exit
14
+ "$file_name"
15
+ fi
16
+
17
+ source "${DOTPI_ROOT}/share/dotpi_init.bash"
18
+
19
+ FIRSTUSER="$(getent passwd 1000 | cut -d: -f1)"
20
+ FIRSTUSERHOME="$(getent passwd 1000 | cut -d: -f6)"
21
+
22
+ mkdir -p "$FIRSTUSERHOME"
23
+
24
+ cat >> "${FIRSTUSERHOME}/.bashrc" << EOF
25
+
26
+ ### dotpi
27
+
28
+ source "${DOTPI_ROOT}/share/dotpi_init.bash"
29
+
30
+ EOF
31
+
32
+ # make sure .bashrc can be sourced when not in interactive mode
33
+ substitution="# dotpi: source even if non-interactive"
34
+ dotpi_configuration_replace_region 'case $- in' 'esac' "$substitution" "${FIRSTUSERHOME}/.bashrc"
35
+
36
+ ####### hostname
37
+
38
+ CURRENT_HOSTNAME="$(cat /etc/hostname | tr -d " \t\n\r")"
39
+ if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ]; then
40
+ /usr/lib/raspberrypi-sys-mods/imager_custom set_hostname "${dotpi_instance_hostname}"
41
+ else
42
+ echo "${dotpi_instance_hostname}" >/etc/hostname
43
+ sed -i "s/127.0.1.1.*${CURRENT_HOSTNAME}/127.0.1.1\t${dotpi_instance_hostname}/g" /etc/hosts
44
+ fi
45
+
46
+ ####### ssh
47
+
48
+ keys=()
49
+ for file in "${DOTPI_ROOT}/etc/ssh/"*.pub ; do
50
+ if [ -r "$file" ] ; then
51
+ keys+=( "$(cat "$file" )" )
52
+ fi
53
+ done
54
+
55
+ # install first key
56
+ key="${keys[0]}"
57
+ if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ] ; then
58
+ /usr/lib/raspberrypi-sys-mods/imager_custom enable_ssh -k "$key"
59
+ else
60
+ install -o "$FIRSTUSER" -m 700 -d "$FIRSTUSERHOME/.ssh"
61
+ install -o "$FIRSTUSER" -m 600 <(printf "$key") "$FIRSTUSERHOME/.ssh/authorized_keys"
62
+ systemctl enable ssh
63
+ fi
64
+
65
+ mkdir -p "${FIRSTUSERHOME}/.ssh"
66
+ # start from second element
67
+ for key in "${keys[@]: 1}" ; do
68
+ echo "key" >> "$FIRSTUSERHOME/.ssh/authorized_keys"
69
+ done
70
+
71
+ # delete if already set
72
+ sed -i -e '/^PasswordAuthentication/d' /etc/ssh/sshd_config
73
+
74
+ # allow for password authentication
75
+ # (after exclusive imager_custom enable_ssh -k)
76
+ echo "PasswordAuthentication ${dotpi_ssh_allow_password_authentication}" >>/etc/ssh/sshd_config
77
+
78
+ ####### user
79
+
80
+ if [ -f /usr/lib/userconf-pi/userconf ] ; then
81
+ if [ -n "$dotpi_password_hash6" ] ; then
82
+ /usr/lib/userconf-pi/userconf "$dotpi_user" "$dotpi_password_hash6"
83
+ fi
84
+ else
85
+ if [ -n "$dotpi_password_hash6" ] ; then
86
+ echo "${FIRSTUSER}:${dotpi_password_hash6}" | chpasswd -e
87
+ fi
88
+ if [ "$FIRSTUSER" != "$dotpi_user" ]; then
89
+ usermod -l "$dotpi_user" "$FIRSTUSER"
90
+ usermod -m -d "/home/${dotpi_user}" "$dotpi_user"
91
+ groupmod -n "$dotpi_user" "$FIRSTUSER"
92
+ if grep -q "^autologin-user=" /etc/lightdm/lightdm.conf ; then
93
+ sed /etc/lightdm/lightdm.conf -i -e "s/^autologin-user=.*/autologin-user=PI-USER/"
94
+ fi
95
+ if [ -f /etc/systemd/system/getty@tty1.service.d/autologin.conf ]; then
96
+ sed /etc/systemd/system/getty@tty1.service.d/autologin.conf -i -e "s/${FIRSTUSER}/${dotpi_user}/"
97
+ fi
98
+ if [ -f /etc/sudoers.d/010_pi-nopasswd ]; then
99
+ sed -i "s/^${FIRSTUSER} /${dotpi_user} /" /etc/sudoers.d/010_pi-nopasswd
100
+ fi
101
+ fi
102
+ fi
103
+
104
+ ####### wifi
105
+
106
+ # Do *not* install wpa_supplicant
107
+ # - Bullseye: it should be sufficient in /boot
108
+ # - Bookworm: it breaks NetworkManager
109
+
110
+ source_path="${DOTPI_ROOT}/etc/network"
111
+ destination_path='/etc/NetworkManager/system-connections'
112
+ if [ -d "${source_path}" ] ; then
113
+ tar c -C "$source_path" '.' | tar xv -C "$destination_path"
114
+ fi
115
+ chmod 'u=rw,go=' "${destination_path}/*"
116
+
117
+ # unblock wifi in any case
118
+ rfkill unblock wifi
119
+ for file in /var/lib/systemd/rfkill/*:wlan ; do
120
+ echo 0 > $file
121
+ done
122
+
123
+ ####### limits (real-time audio)
124
+
125
+ source_path="${DOTPI_ROOT}/share/limits"
126
+ destination_path='/etc/security/limits.d'
127
+ if [ -r "$source_path" ] ; then
128
+ mkdir -p "$destination_path"
129
+ tar c -C "$source_path" '.' | tar x -C "$destination_path"
130
+ fi
131
+
132
+ ###### keymap and timezone
133
+
134
+ if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ]; then
135
+ /usr/lib/raspberrypi-sys-mods/imager_custom set_keymap "$dotpi_keymap"
136
+ /usr/lib/raspberrypi-sys-mods/imager_custom set_timezone "$dotpi_timezone"
137
+ else
138
+ rm -f /etc/localtime
139
+ echo "$dotpi_timezone" >/etc/timezone
140
+ dpkg-reconfigure -f noninteractive tzdata
141
+ cat >/etc/default/keyboard <<'KBEOF'
142
+ XKBMODEL="pc105"
143
+ XKBLAYOUT="$dotpi_keymap"
144
+ XKBVARIANT=""
145
+ XKBOPTIONS=""
146
+
147
+ KBEOF
148
+ dpkg-reconfigure -f noninteractive keyboard-configuration
149
+ fi
@@ -0,0 +1,177 @@
1
+ #!/bin/bash
2
+
3
+ set +e
4
+
5
+ local_file="$(readlink -f -- "$0")"
6
+ local_path="$(dirname -- "$local_file")"
7
+
8
+ log_file="${1:-${local_file}-$(date +"%Y%m%d-%H%M%S").log}"
9
+
10
+ DOTPI_ROOT="${DOTPI_ROOT:-/opt/dotpi}"
11
+
12
+ # run imager firstrun before, to allow for over-rides
13
+ file_name="${local_path}/imager_firstrun.sh"
14
+ if [ -x "$file_name" ] ; then
15
+ # do not source to avoid exit
16
+ "$file_name"
17
+ fi
18
+
19
+ # install dotpi wrapper
20
+ ln -s "${DOTPI_ROOT}/bin/dotpi" /usr/bin
21
+
22
+ source "${DOTPI_ROOT}/share/dotpi_init.bash"
23
+
24
+ # Self log
25
+ exec &> >(dotpi log "$log_file")
26
+
27
+ dotpi echo_info "Configure first user .bashrc"
28
+
29
+ FIRSTUSER="$(getent passwd 1000 | cut -d: -f1)"
30
+ FIRSTUSERHOME="$(getent passwd 1000 | cut -d: -f6)"
31
+
32
+ mkdir -p "$FIRSTUSERHOME"
33
+
34
+ IFS= read -r -d '' bashrc_append << EOF
35
+
36
+ ### dotpi
37
+
38
+ source "${DOTPI_ROOT}/share/dotpi_init.bash"
39
+
40
+ EOF
41
+
42
+ echo "$bashrc_append" >> "${FIRSTUSERHOME}/.bashrc"
43
+
44
+ # make sure .bashrc can be sourced when not in interactive mode
45
+ substitution="# dotpi: source even if non-interactive"
46
+ dotpi configuration_replace_region 'case $- in' 'esac' "$substitution" "${FIRSTUSERHOME}/.bashrc"
47
+
48
+ ####### hostname
49
+
50
+ dotpi echo_info "Set hostname to ${dotpi_instance_hostname}"
51
+
52
+ dotpi system_set_hostname "$dotpi_instance_hostname"
53
+
54
+ ####### ssh
55
+
56
+ dotpi echo_info "Configure SSH"
57
+
58
+ keys=()
59
+ for file in "${DOTPI_ROOT}/etc/ssh/"*.pub ; do
60
+ if [ -r "$file" ] ; then
61
+ keys+=( "$(cat "$file" )" )
62
+ fi
63
+ done
64
+
65
+ # install first key
66
+ key="${keys[0]}"
67
+ if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ] ; then
68
+ /usr/lib/raspberrypi-sys-mods/imager_custom enable_ssh -k "$key"
69
+ else
70
+ install -o "$FIRSTUSER" -m 700 -d "$FIRSTUSERHOME/.ssh"
71
+ install -o "$FIRSTUSER" -m 600 <(printf "$key") "$FIRSTUSERHOME/.ssh/authorized_keys"
72
+ systemctl enable ssh
73
+ fi
74
+
75
+ mkdir -p "${FIRSTUSERHOME}/.ssh"
76
+ # start from second element
77
+ for key in "${keys[@]: 1}" ; do
78
+ echo "key" >> "$FIRSTUSERHOME/.ssh/authorized_keys"
79
+ done
80
+
81
+ # delete if already set
82
+ sed -i -e '/^PasswordAuthentication/d' /etc/ssh/sshd_config
83
+
84
+ # allow for password authentication
85
+ # (after exclusive imager_custom enable_ssh -k)
86
+ echo "PasswordAuthentication ${dotpi_ssh_allow_password_authentication}" >>/etc/ssh/sshd_config
87
+
88
+ ####### user
89
+
90
+ dotpi echo_info "Configure first user login"
91
+
92
+ if [ -f /usr/lib/userconf-pi/userconf ] ; then
93
+ if [ -n "$dotpi_password_hash6" ] ; then
94
+ /usr/lib/userconf-pi/userconf "$dotpi_user" "$dotpi_password_hash6"
95
+ fi
96
+ else
97
+ if [ -n "$dotpi_password_hash6" ] ; then
98
+ echo "${FIRSTUSER}:${dotpi_password_hash6}" | chpasswd -e
99
+ fi
100
+ if [ "$FIRSTUSER" != "$dotpi_user" ]; then
101
+ usermod -l "$dotpi_user" "$FIRSTUSER"
102
+ usermod -m -d "/home/${dotpi_user}" "$dotpi_user"
103
+ groupmod -n "$dotpi_user" "$FIRSTUSER"
104
+ if grep -q "^autologin-user=" /etc/lightdm/lightdm.conf ; then
105
+ sed /etc/lightdm/lightdm.conf -i -e "s/^autologin-user=.*/autologin-user=PI-USER/"
106
+ fi
107
+ if [ -f /etc/systemd/system/getty@tty1.service.d/autologin.conf ]; then
108
+ sed /etc/systemd/system/getty@tty1.service.d/autologin.conf -i -e "s/${FIRSTUSER}/${dotpi_user}/"
109
+ fi
110
+ if [ -f /etc/sudoers.d/010_pi-nopasswd ]; then
111
+ sed -i "s/^${FIRSTUSER} /${dotpi_user} /" /etc/sudoers.d/010_pi-nopasswd
112
+ fi
113
+ fi
114
+ fi
115
+
116
+ ####### wifi
117
+
118
+ dotpi echo_info "Configure wifi"
119
+
120
+ # Do *not* install wpa_supplicant
121
+ # - Bullseye: it should be sufficient in /boot
122
+ # - Bookworm: it breaks NetworkManager
123
+
124
+ source_path="${DOTPI_ROOT}/etc/network"
125
+ destination_path='/etc/NetworkManager/system-connections'
126
+ if [ -d "${source_path}" ] ; then
127
+ tar c -C "$source_path" '.' | tar xv -C "$destination_path"
128
+ fi
129
+ chmod 'u=rw,go=' "${destination_path}"/*
130
+
131
+ # unblock wifi in any case
132
+ rfkill unblock wifi
133
+ for file in /var/lib/systemd/rfkill/*:wlan ; do
134
+ echo 0 > $file
135
+ done
136
+
137
+ ####### limits (real-time audio)
138
+
139
+ dotpi echo_info "Configure limits"
140
+
141
+ source_path="${DOTPI_ROOT}/share/limits"
142
+ destination_path='/etc/security/limits.d'
143
+ if [ -r "$source_path" ] ; then
144
+ mkdir -p "$destination_path"
145
+ tar c -C "$source_path" '.' | tar x -C "$destination_path"
146
+ fi
147
+
148
+ ###### keymap and timezone
149
+
150
+ dotpi echo_info "Configure keymap and timezone"
151
+
152
+ if [ -f /usr/lib/raspberrypi-sys-mods/imager_custom ]; then
153
+ /usr/lib/raspberrypi-sys-mods/imager_custom set_keymap "$dotpi_keymap"
154
+ /usr/lib/raspberrypi-sys-mods/imager_custom set_timezone "$dotpi_timezone"
155
+ else
156
+ rm -f /etc/localtime
157
+ echo "$dotpi_timezone" >/etc/timezone
158
+ dpkg-reconfigure -f noninteractive tzdata
159
+ cat >/etc/default/keyboard <<'KBEOF'
160
+ XKBMODEL="pc105"
161
+ XKBLAYOUT="$dotpi_keymap"
162
+ XKBVARIANT=""
163
+ XKBOPTIONS=""
164
+
165
+ KBEOF
166
+ dpkg-reconfigure -f noninteractive keyboard-configuration
167
+ fi
168
+
169
+ # read again as it may have changed
170
+ FIRSTUSER="$(getent passwd 1000 | cut -d: -f1)"
171
+
172
+ if [[ "$dotpi_prepare_system_automatic" == 'yes' ]] ; then
173
+ dotpi echo_info "Automatic: Run prepare system"
174
+
175
+ sudo dotpi system_execute_on_reboot "$FIRSTUSER" "${DOTPI_ROOT}/bin/dotpi_prepare_system"
176
+ fi
177
+