@dotpi/tools 1.4.0 → 2.3.3

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 (150) hide show
  1. package/NOTES.md +41 -1
  2. package/README.md +3 -13
  3. package/dotpi_root/bin/dotpi +1 -0
  4. package/dotpi_root/bin/dotpi_prepare_sd_card +34 -22
  5. package/dotpi_root/bin/dotpi_prepare_system +108 -68
  6. package/dotpi_root/bin/package.json +6 -0
  7. package/dotpi_root/{share/dotpi_avahi_monitor → dist/@dotpi/avahi_monitor}/dotpi_avahi_monitor.service +1 -5
  8. package/dotpi_root/dist/@dotpi/avahi_monitor/dotpi_install +21 -0
  9. package/dotpi_root/dist/@dotpi/avahi_monitor/dotpi_uninstall +17 -0
  10. package/dotpi_root/dist/@dotpi/avahi_monitor/package.json +10 -0
  11. package/dotpi_root/dist/@dotpi/javascript/bash.js +103 -0
  12. package/dotpi_root/dist/@dotpi/javascript/echo.js +13 -0
  13. package/dotpi_root/dist/@dotpi/javascript/filesystem.js +25 -0
  14. package/dotpi_root/dist/@dotpi/javascript/package.json +12 -0
  15. package/dotpi_root/dist/@dotpi/javascript/service.js +49 -0
  16. package/dotpi_root/dist/@dotpi/javascript/system.js +36 -0
  17. package/dotpi_root/dist/@dotpi/javascript/template.js +13 -0
  18. package/dotpi_root/dist/@dotpi/javascript/user.js +32 -0
  19. package/dotpi_root/dist/@dotpi/module/bin/dotpi_module +13 -0
  20. package/dotpi_root/dist/@dotpi/module/dotpi_install +52 -0
  21. package/dotpi_root/dist/@dotpi/module/dotpi_uninstall +50 -0
  22. package/dotpi_root/dist/@dotpi/module/package.json +21 -0
  23. package/dotpi_root/dist/@dotpi/module/src/configuration.js +43 -0
  24. package/dotpi_root/dist/@dotpi/module/src/createConfig.js +108 -0
  25. package/dotpi_root/dist/@dotpi/module/src/definition.js +7 -0
  26. package/dotpi_root/dist/@dotpi/module/src/index.js +0 -0
  27. package/dotpi_root/dist/@dotpi/module/src/install.js +145 -0
  28. package/dotpi_root/dist/@dotpi/module/src/uninstall.js +180 -0
  29. package/dotpi_root/etc/dotpi_environment_default.bash +16 -0
  30. package/dotpi_root/etc/dotpi_init.d/.gitkeep +0 -0
  31. package/dotpi_root/etc/dotpi_modules.json +8 -0
  32. package/dotpi_root/lib/package.json +6 -0
  33. package/dotpi_root/share/dotpi_audio_bluetooth/dotpi_audio_pipewire_relink +7 -6
  34. package/dotpi_root/share/dotpi_audio_bluetooth/package.json +6 -0
  35. package/dotpi_root/share/dotpi_functions/dotpi_functions_audio_device.bash +12 -26
  36. package/dotpi_root/share/dotpi_functions/dotpi_functions_configuration.bash +2 -2
  37. package/dotpi_root/share/dotpi_functions/dotpi_functions_service.bash +6 -2
  38. package/dotpi_root/share/dotpi_functions/dotpi_functions_system.bash +11 -0
  39. package/dotpi_root/share/dotpi_functions/dotpi_functions_user.bash +28 -0
  40. package/dotpi_root/share/dotpi_functions.bash +4 -4
  41. package/dotpi_root/share/dotpi_init.bash +7 -1
  42. package/dotpi_root/share/dotpi_pipewire/bin/dotpi_pipewire_relink +7 -6
  43. package/dotpi_root/share/dotpi_pipewire/dotpi_install +1 -1
  44. package/dotpi_root/share/dotpi_pipewire/package.json +9 -0
  45. package/dotpi_root/share/limits/zzz_dotpi_audio.conf +2 -6
  46. package/dotpi_root/share/wireplumber/wireplumber.conf.d/dotpi-wireplumber-config.conf +8 -0
  47. package/lerna.json +4 -0
  48. package/package.json +12 -2
  49. package/projects/led-test/.dotpi +3 -0
  50. package/projects/led-test/README.md +16 -0
  51. package/projects/led-test/dotpi_project.bash +29 -0
  52. package/projects/qsddsqsd/.dotpi +3 -0
  53. package/projects/qsddsqsd/README.md +16 -0
  54. package/projects/qsddsqsd/dotpi_project.bash +29 -0
  55. package/src/constants.js +4 -4
  56. package/src/create-project.js +124 -56
  57. package/src/templates/dotpi_project.bash +5 -7
  58. package/src/utils.js +2 -2
  59. package/test/create-project.test.js +0 -1
  60. package/PIPEWIRE.md +0 -280
  61. package/dotpi_root/bin/.editorbackup/dotpi_firstrun.bash~ +0 -149
  62. package/dotpi_root/bin/.editorbackup/dotpi_firstrun~ +0 -177
  63. package/dotpi_root/bin/.editorbackup/dotpi_prepare_sd_card.bash~ +0 -425
  64. package/dotpi_root/bin/.editorbackup/dotpi_prepare_sd_card~ +0 -620
  65. package/dotpi_root/bin/.editorbackup/dotpi_prepare_system.bash~ +0 -82
  66. package/dotpi_root/bin/.editorbackup/dotpi_prepare_system~ +0 -100
  67. package/dotpi_root/bin/.editorbackup/dotpi~ +0 -61
  68. package/dotpi_root/bin/.editorbackup/prepare_sd_card.bash~ +0 -252
  69. package/dotpi_root/etc/.editorbackup/dotpi_environment_default.bash~ +0 -49
  70. package/dotpi_root/etc/.editorbackup/dotpi_environment_instance.bash~ +0 -1
  71. package/dotpi_root/etc/.editorbackup/dotpi_environment_project.bash~ +0 -33
  72. package/dotpi_root/etc/.editorbackup/dotpi_tarignore~ +0 -4
  73. package/dotpi_root/share/.editorbackup/coucou~ +0 -1
  74. package/dotpi_root/share/.editorbackup/dotpi_environment.bash~ +0 -9
  75. package/dotpi_root/share/.editorbackup/dotpi_functions.bash~ +0 -11
  76. package/dotpi_root/share/.editorbackup/dotpi_functions_configuration.bash~ +0 -420
  77. package/dotpi_root/share/.editorbackup/dotpi_functions_connection.bash~ +0 -358
  78. package/dotpi_root/share/.editorbackup/dotpi_init.bash~ +0 -18
  79. package/dotpi_root/share/dotpi_audio_alsa/dotpi_audio_alsa.service +0 -15
  80. package/dotpi_root/share/dotpi_audio_bluetooth/.editorbackup/dotpi_audio_bluetooth.service~ +0 -24
  81. package/dotpi_root/share/dotpi_audio_bluetooth/.editorbackup/dotpi_audio_bluetooth_command~ +0 -80
  82. package/dotpi_root/share/dotpi_audio_bluetooth/.editorbackup/dotpi_audio_bluetooth_start_command~ +0 -26
  83. package/dotpi_root/share/dotpi_audio_bluetooth/.editorbackup/dotpi_audio_bluetooth_stop_command~ +0 -30
  84. package/dotpi_root/share/dotpi_audio_bluetooth/.editorbackup/dotpi_bluetooth_audio.service~ +0 -21
  85. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_audio_bluetooth.bash~ +0 -256
  86. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_audio_device.bash~ +0 -287
  87. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_bluetooth_audio.bash~ +0 -7
  88. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_configuration.bash~ +0 -428
  89. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_connection.bash~ +0 -194
  90. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_daemon.bash~ +0 -26
  91. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_soundcard.bash~ +0 -287
  92. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_soundcards.bash~ +0 -12
  93. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_system.bash~ +0 -158
  94. package/dotpi_root/share/dotpi_functions/.editorbackup/dotpi_functions_utils.bash~ +0 -152
  95. package/dotpi_root/share/jackd/.editorbackup/dotpi_jackd_bluetooth.bash~ +0 -20
  96. package/dotpi_root/share/jackd/.editorbackup/dotpi_jackd_command~ +0 -17
  97. package/dotpi_root/share/jackd/.editorbackup/dotpi_jackd_headphones.bash~ +0 -20
  98. package/dotpi_root/share/jackd/.editorbackup/dotpi_jackd_hifiberry.bash~ +0 -16
  99. package/dotpi_root/share/jackd/.editorbackup/jackd.conf~ +0 -5
  100. package/dotpi_root/share/jackd/.editorbackup/jackd.service~ +0 -15
  101. package/dotpi_root/share/jackd/.editorbackup/jackd_headphones.conf~ +0 -5
  102. package/dotpi_root/share/jackd/dotpi_jack_simple_client.service +0 -23
  103. package/dotpi_root/share/jackd/dotpi_jackd_bluetooth.bash +0 -18
  104. package/dotpi_root/share/jackd/dotpi_jackd_command +0 -26
  105. package/dotpi_root/share/jackd/dotpi_jackd_headphones.bash +0 -21
  106. package/dotpi_root/share/jackd/dotpi_jackd_hifiberry.bash +0 -17
  107. package/dotpi_root/share/jackd/jackd.service +0 -22
  108. package/dotpi_root/share/wireplumber/.editorbackup/8zzz-dotpi-wireplumber-config.lua~ +0 -1
  109. package/projects/old/dev.bak/.editorbackup/dotpi_environment_instance.bash~ +0 -1
  110. package/projects/old/dev.bak/.editorbackup/dotpi_environment_project.bash~ +0 -33
  111. package/projects/old/dev.bak/.editorbackup/wpa_supplicant.conf~ +0 -37
  112. package/projects/old/dev.bak/dotpi_environment_instance.bash +0 -1
  113. package/projects/old/dev.bak/dotpi_environment_project.bash +0 -46
  114. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/.editorbackup/DOTPI-A114.nmconnection~ +0 -24
  115. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/.editorbackup/DOTPI.nmconnection~ +0 -24
  116. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/.editorbackup/Livebox-97C6_wifi_invite.nmconnection~ +0 -24
  117. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/.editorbackup/onze.nmconnection~ +0 -22
  118. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/.editorbackup/welcome.nmconnection~ +0 -23
  119. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/DOTPI-A114.nmconnection +0 -23
  120. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/DOTPI.nmconnection +0 -23
  121. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/Livebox-97C6_wifi_invite.nmconnection +0 -24
  122. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/onze.nmconnection +0 -24
  123. package/projects/old/dev.bak/file-system/etc/NetworkManager/system-connections/welcome.nmconnection +0 -23
  124. package/projects/old/dev.bak/network/.editorbackup/DOTPI-A114.nmconnection~ +0 -24
  125. package/projects/old/dev.bak/network/.editorbackup/DOTPI.nmconnection~ +0 -24
  126. package/projects/old/dev.bak/network/.editorbackup/Livebox-97C6_wifi_invite.nmconnection~ +0 -24
  127. package/projects/old/dev.bak/network/.editorbackup/onze.nmconnection~ +0 -22
  128. package/projects/old/dev.bak/network/.editorbackup/welcome.nmconnection~ +0 -23
  129. package/projects/old/dev.bak/network/AccueilCie.nmconnection +0 -24
  130. package/projects/old/dev.bak/network/DOTPI-A114.nmconnection +0 -23
  131. package/projects/old/dev.bak/network/DOTPI.nmconnection +0 -23
  132. package/projects/old/dev.bak/network/Livebox-97C6_wifi_invite.nmconnection +0 -25
  133. package/projects/old/dev.bak/network/onze.nmconnection +0 -24
  134. package/projects/old/dev.bak/network/welcome.nmconnection +0 -23
  135. package/projects/old/dev.bak/network/wifi-access-point.nmconnection +0 -23
  136. package/projects/old/dev.bak/network/wifi-internet.nmconnection +0 -24
  137. package/projects/old/dev.bak/network/wifi-ircam-public.nmconnection +0 -24
  138. package/projects/old/dev.bak/network/wifi-local.nmconnection +0 -22
  139. package/projects/old/dev.bak/network/wifi-welcome.nmconnection +0 -24
  140. package/projects/old/dev.bak/wpa_supplicant.conf +0 -43
  141. package/projects/old/example-complete.bak/.editorbackup/dotpi_environment_instance.bash~ +0 -1
  142. package/projects/old/example-complete.bak/.editorbackup/dotpi_environment_project.bash~ +0 -26
  143. package/projects/old/example-complete.bak/.editorbackup/dotpi_project.bash~ +0 -21
  144. package/projects/old/example-complete.bak/.editorbackup/dotpi_tmp.bash~ +0 -3
  145. package/projects/old/example-complete.bak/.editorbackup/wpa_supplicant.conf~ +0 -37
  146. package/projects/old/example-complete.bak/configuration/.editorbackup/dotpi_project.bash~ +0 -21
  147. package/projects/old/example-complete.bak/configuration/dotpi_project.bash +0 -21
  148. package/projects/old/example-complete.bak/configuration/jackd/.editorbackup/dotpi_jackd.bash~ +0 -14
  149. package/projects/old/example-complete.bak/configuration/jackd/dotpi_jackd.bash +0 -14
  150. /package/dotpi_root/{share/dotpi_avahi_monitor → dist/@dotpi/avahi_monitor}/dotpi_avahi_monitor_command +0 -0
@@ -1,358 +0,0 @@
1
- _dotpi_configuration_get_options() {
2
-
3
- _echo_empty_option_error() {
4
- dotpi_echo_error "ERROR: $1 requires a non-empty option argument."
5
- }
6
-
7
- # From http://mywiki.wooledge.org/BashFAQ/035
8
-
9
- while true ; do
10
- case $1 in
11
-
12
- -h|-\?|--help)
13
- _dotpi_usage # Display a usage synopsis.
14
- return 0
15
- ;;
16
-
17
- -f|--file) # Takes an option argument; ensure it has been specified.
18
- if [ -z "$2" ] ; then
19
- _dotpi_usage
20
- _echo_empty_option_error "$1"
21
- return 1
22
- else
23
- file="$2"
24
- shift
25
- fi
26
- ;;
27
-
28
- -k|--key)
29
- if [ -z "$2" ] ; then
30
- _dotpi_usage
31
- _echo_empty_option_error "$1"
32
- return 1
33
- else
34
- key="$2"
35
- shift
36
- fi
37
- ;;
38
-
39
- -N|--prepend-line-if-new)
40
- if [ -z "$2" ] ; then
41
- _dotpi_usage
42
- _echo_empty_option_error "$1"
43
- return 1
44
- else
45
- prepend_line_if_new="$2"
46
- shift
47
- fi
48
- ;;
49
-
50
- -v|--value)
51
- if [ -z "2" ] ; then
52
- _dotpi_usage
53
- _echo_empty_option_error "$1"
54
- return 1
55
- else
56
- value="$2"
57
- shift
58
- fi
59
- ;;
60
-
61
- --) # End of all options.
62
- shift
63
- break
64
- ;;
65
-
66
- -?*) # Unknown
67
- _dotpi_usage
68
- dotpi_echo_error "ERROR: Unknown option: $1"
69
- return 1
70
- ;;
71
-
72
- *) # Default case: No more options, so break out of the loop.
73
- break
74
-
75
- esac
76
-
77
- shift
78
- done
79
-
80
- }
81
-
82
-
83
- dotpi_configuration_get_pattern() (
84
- # sub-shell to keep everything local (functions and variables)
85
-
86
-
87
-
88
- _dotpi_command="$(basename "${FUNCNAME[0]:-"$0"}")"
89
- _dotpi_usage() {
90
- echo "Usage: ${_dotpi_command} --key <key>"
91
- }
92
-
93
- # Initialize all the option variables.
94
- # This ensures we are not contaminated by variables from the environment.
95
- key=
96
- if ! _dotpi_configuration_get_options "${@}" ; then
97
- return $?
98
- fi
99
-
100
- if [ -z "$key" ] ; then
101
- _dotpi_usage
102
- dotpi_echo_error "ERROR: missing key option"
103
- return 1
104
- fi
105
-
106
- # [<leading>] <key> <assignment> <value> [ <values>] [<trailing>]
107
-
108
- # start of line, and spaces
109
- # invert for no comment, no non-spaces
110
- _dotpi_configuration_pattern_leading='(^[^#\S]*)'
111
-
112
- # group
113
- _dotpi_configuration_pattern_key="(${key})"
114
-
115
- # = with surrounding spaces
116
- _dotpi_configuration_pattern_assignment='(\s*=\s*)'
117
-
118
- # value is a repetition of non-space characters
119
- # invert for no comment, no space
120
- _dotpi_configuration_pattern_value='([^#\s]+)'
121
-
122
- # optional value containing spaces (terminated with a non-space)
123
- _dotpi_configuration_pattern_value_with_spaces='((\s+[^#\s]+)*)'
124
-
125
- # trailing spaces and trailing comments until the end of line
126
- _dotpi_configuration_pattern_trailing='(\s*#?.*$)'
127
-
128
- echo "\
129
- $_dotpi_configuration_pattern_leading\
130
- $_dotpi_configuration_pattern_key\
131
- $_dotpi_configuration_pattern_assignment\
132
- $_dotpi_configuration_pattern_value\
133
- $_dotpi_configuration_pattern_value_with_spaces\
134
- $_dotpi_configuration_pattern_trailing\
135
- "
136
- return 0
137
- )
138
-
139
- dotpi_configuration_comment() (
140
- # sub-shell to keep everything local (functions and variables)
141
-
142
- _dotpi_command="$(basename "${FUNCNAME[0]:-"$0"}")"
143
- _dotpi_usage() {
144
- echo "Usage: ${_dotpi_command} [--file <file>] --key <key>"
145
- }
146
-
147
- # Initialize all the option variables.
148
- # This ensures we are not contaminated by variables from the environment.
149
- file=
150
- key=
151
- if ! _dotpi_configuration_get_options "${@}" ; then
152
- return $?
153
- fi
154
-
155
- if [ -z "$key" ] ; then
156
- _dotpi_usage
157
- dotpi_echo_error "ERROR: missing key option"
158
- return 1
159
- fi
160
-
161
- perl_options=()
162
- if [ -n "$file" ] ; then
163
- perl_options+=( '-i' "$file" )
164
- fi
165
-
166
- pattern="$(dotpi_configuration_get_pattern --key "$key")"
167
- # keep leading spaces
168
- perl -pe "s/${pattern}/"'${1}# ${2}${3}${4}${5}${6}\n/' "${perl_options[@]}"
169
- return $?
170
- )
171
-
172
- dotpi_configuration_write() (
173
- # sub-shell to keep everything local (functions and variables)
174
-
175
- _dotpi_command="$(basename "${FUNCNAME[0]:-"$0"}")"
176
- _dotpi_usage() {
177
- echo "Usage: ${_dotpi_command} [--file <file>] --key <key> --value <value>"
178
- }
179
-
180
- # Initialize all the option variables.
181
- # This ensures we are not contaminated by variables from the environment.
182
- file=
183
- key=
184
- value=
185
- prepend_line_if_new=
186
- if ! _dotpi_configuration_get_options "${@}" ; then
187
- return $?
188
- fi
189
-
190
- if [ -z "$key" ] ; then
191
- _dotpi_usage
192
- dotpi_echo_error "ERROR: missing key option"
193
- return 1
194
- fi
195
-
196
- if [ -z "$value" ] ; then
197
- _dotpi_usage
198
- dotpi_echo_error "ERROR: missing value option"
199
- return 1
200
- fi
201
-
202
- if [ -n "$file" ] ; then
203
- if ! [ -r "$file" ] ; then
204
- touch "$file"
205
- fi
206
- else
207
- input_file='/dev/stdin'
208
- output_file='/dev/stdout'
209
- fi
210
-
211
- pattern="$(dotpi_configuration_get_pattern --key "$key")"
212
- perl_command=('perl' '-pe' "s/${pattern}/"'${1}${2}${3}'"${value}"'${6}\n/')
213
-
214
- find_command=('dotpi_configuration_find' '--key' "$key")
215
-
216
- if [ -n "$file" ] ; then
217
- "${perl_command[@]}" -i "$file"
218
- found=$( "${find_command[@]}" --file "$file" )
219
- output_file="$file"
220
- else
221
- # duplicate stdout
222
- "${perl_command[@]}" 3>&1 ; found=$( "${find_command[@]}" <3 )
223
- fi
224
-
225
- if (( found == 0 )) ; then
226
- if [ -n "$prepend_line_if_new" ] ; then
227
- echo "$prepend_line_if_new" >> "$output_file"
228
- fi
229
- echo "${key}=${value}" >> "$output_file"
230
- fi
231
-
232
-
233
- return $?
234
- )
235
-
236
- dotpi_configuration_read() (
237
- # sub-shell to keep everything local (functions and variables)
238
-
239
- _dotpi_command="$(basename "${FUNCNAME[0]:-"$0"}")"
240
- _dotpi_usage() {
241
- echo "Usage: ${_dotpi_command} [--file <file>] --key <key>"
242
- }
243
-
244
- # Initialize all the option variables.
245
- # This ensures we are not contaminated by variables from the environment.
246
- file=
247
- key=
248
- if ! _dotpi_configuration_get_options "${@}" ; then
249
- return $?
250
- fi
251
-
252
- if [ -z "$key" ] ; then
253
- _dotpi_usage
254
- dotpi_echo_error "ERROR: missing key option"
255
- return 1
256
- fi
257
-
258
- perl_options=()
259
- if [ -n "$file" ] ; then
260
- if ! [ -r "$file" ] ; then
261
- dotpi_echo_error "ERROR: ${file} is not readable"
262
- return 1 # false
263
- fi
264
-
265
- perl_options+=( "$file" )
266
- fi
267
-
268
- pattern="$(dotpi_configuration_get_pattern --key "$key")"
269
-
270
- values=()
271
- # split values with new line, keep spaces
272
- while IFS= read -r line ; do
273
- values+="$line"
274
- done < <(perl -ne 'if (m/'"${pattern}"'/) { print "${4}${5}\n" }' "${perl_options[@]}" )
275
-
276
- if (( ${#values} == 0 )) ; then
277
- return 1 # false
278
- else
279
- # last instance
280
- echo "${values[-1]}"
281
- return 0 # true
282
- fi
283
- )
284
-
285
- dotpi_configuration_find() (
286
- # sub-shell to keep everything local (functions and variables)
287
-
288
- _dotpi_command="$(basename "${FUNCNAME[0]:-"$0"}")"
289
- _dotpi_usage() {
290
- echo "Usage: ${_dotpi_command} [--file <file>] --key <key>"
291
- }
292
-
293
- # Initialize all the option variables.
294
- # This ensures we are not contaminated by variables from the environment.
295
- file=
296
- key=
297
- if ! _dotpi_configuration_get_options "${@}" ; then
298
- return $?
299
- fi
300
-
301
- if [ -z "$key" ] ; then
302
- _dotpi_usage
303
- dotpi_echo_error "ERROR: missing key option"
304
- return 1
305
- fi
306
-
307
- read_options=()
308
- if [ -n "$file" ] ; then
309
- read_options+=( '--file' "$file" )
310
- fi
311
-
312
- dotpi_configuration_read --key "$key" "${read_options[@]}" > /dev/null
313
- return_value=$?
314
- # 0 is true
315
- echo $(( !return_value ))
316
- return $return_value
317
- )
318
-
319
- dotpi_configuration_delete() (
320
- # sub-shell to keep everything local (functions and variables)
321
-
322
- _dotpi_command="$(basename "${FUNCNAME[0]:-"$0"}")"
323
- _dotpi_usage() {
324
- echo "Usage: ${_dotpi_command} [--file <file>] --key <key>"
325
- }
326
-
327
- # Initialize all the option variables.
328
- # This ensures we are not contaminated by variables from the environment.
329
- file=
330
- key=
331
- if ! _dotpi_configuration_get_options "${@}" ; then
332
- return $?
333
- fi
334
-
335
- if [ -z "$key" ] ; then
336
- _dotpi_usage
337
- dotpi_echo_error "ERROR: missing key option"
338
- return 1
339
- fi
340
-
341
- perl_options=()
342
-
343
- if [ -n "$file" ] ; then
344
- if ! [ -r "$file" ] ; then
345
- dotpi_echo_error "ERROR: ${file} is not readable"
346
- return 1 # false
347
- fi
348
-
349
- perl_options+=( '-i' "$file" )
350
- fi
351
-
352
- pattern="$(dotpi_configuration_get_pattern --key "$key")"
353
-
354
- perl -ne 'if (! m/'"${pattern}"'/) { print "$_" }' "${perl_options[@]}"
355
-
356
- return $?
357
- )
358
-
@@ -1,18 +0,0 @@
1
- #!/bin/bash
2
-
3
- # when sourced, the shell might not be bash
4
- if [ -n "$ZSH_VERSION" ] ; then
5
- _local_file="${0:a}"
6
- elif [ -n "$BASH_VERSION" ] ; then
7
- _local_file="${BASH_SOURCE[0]}"
8
- else
9
- _local_file="$0"
10
- fi
11
- _local_path="$(cd "$(dirname "${_local_file}")" && pwd)"
12
-
13
- DOTPI_ROOT="$(cd "${_local_path}/.." && pwd)"
14
- export DOTPI_ROOT
15
-
16
- source "${DOTPI_ROOT}/share/dotpi_functions.bash"
17
-
18
- source "${DOTPI_ROOT}/share/dotpi_environment.bash"
@@ -1,15 +0,0 @@
1
- [Unit]
2
- Description=dotpi alsa audio daemon
3
- Requires=wireplumber.service
4
- After=wireplumber.service
5
-
6
- [Service]
7
- Type=oneshot
8
- RemainAfterExit=yes
9
-
10
- # alsa-restore service fails to restore some sound cards (Headphones)
11
- ExecStart=/usr/bin/sudo alsactl --no-ucm restore
12
-
13
-
14
- [Install]
15
- WantedBy=default.target
@@ -1,24 +0,0 @@
1
- [Unit]
2
- Description=dotpi bluetooth audio daemon
3
- Requires=bluetooth.service bluealsa.service
4
-
5
- [Service]
6
- LimitRTPRIO=infinity
7
- LimitMEMLOCK=infinity
8
- User=pi
9
- Group=audio
10
- ExecStart=/opt/dotpi/share/dotpi_bluetooth_audio/dotpi_bluetooth_audio_start_command
11
- ExecStop=/opt/dotpi/share/dotpi_bluetooth_audio/dotpi_bluetooth_audio_stop_command
12
-
13
-
14
- Restart=always
15
-
16
- # wait before restarting
17
- RestartSec=1s
18
-
19
- # Do not stop to try restarting service
20
- StartLimitBurst=0
21
-
22
- [Install]
23
- WantedBy=multi-user.target
24
-
@@ -1,80 +0,0 @@
1
- #!/bin/bash
2
-
3
- local_file="$(dotpi readlink_follow "$0")"
4
- local_path="$(dirname -- "$local_file")"
5
-
6
- source /opt/dotpi/share/dotpi_init.bash
7
-
8
- dotpi echo_info "############ Start command"
9
- clean_up() {
10
- if [[ -n ${btctl_process_PID} ]] ; then
11
- dotpi echo_info "########### clean_up"
12
- dotpi echo_info "Ending bluetoothctl process ${btctl_process_PID}"
13
- kill "${btctl_process_PID}"
14
- dotpi echo_info "Stopping audio bluetooth destination"
15
- sudo dotpi audio_bluetooth_destination_stop
16
- fi
17
- }
18
- trap clean_up HUP TERM INT
19
-
20
- destination_mac="${dotpi_audio_bluetooth_mac}"
21
- destination_descriptor="${dotpi_audio_bluetooth_mac//:/_}"
22
-
23
- # dotpi echo_info "Stopping audio bluetooth destination"
24
- # sudo dotpi audio_bluetooth_destination_stop
25
-
26
- dotpi echo_info "Starting audio bluetooth destination"
27
- while ! sudo dotpi audio_bluetooth_destination_start ; do
28
- sleep 10
29
- dotpi_echo_warning "Starting audio bluetooth destination again."
30
- done
31
-
32
- dotpi echo_info "Starting bluetoothctl monitor process"
33
- coproc btctl_process { bluetoothctl; }
34
-
35
- status='init'
36
- dotpi echo_warning "status: $status"
37
- while IFS= read -r output ; do
38
- echo "$output" >&2
39
-
40
- # destination disconnected
41
-
42
- if [[ "$output" =~ [DEL].*Endpoint.*/org/bluez/.*dev_"${destination_descriptor}" ]] ; then
43
- # connect again
44
- dotpi echo_error "Audio bluetooth destination (${destination_mac}) disconnected."
45
- dotpi echo_info "Connecting again"
46
-
47
- sleep 2
48
-
49
- while ! sudo dotpi audio_bluetooth_destination_start ; do
50
- sleep 10
51
- dotpi_echo_warning "Starting audio bluetooth destination again."
52
- done
53
-
54
- fi
55
-
56
- # if [[ "$status" == "init" ]] \
57
- # && [[ "$output" =~ [DEL].*Endpoint.*/org/bluez/.*dev_"${destination_descriptor}" ]] ; then
58
- # status='deleted'
59
- # dotpi echo_warning "status: $status"
60
- # fi
61
-
62
- # if [[ "$status" == "deleted" ]] \
63
- # && [[ "$output" =~ [CHG].*Device.*"${destination_mac}".*Connected:.*no ]] ; then
64
-
65
- # # connect again
66
- # dotpi echo_error "Audio bluetooth destination (${destination_mac}) disconnected."
67
- # dotpi echo_info "Connecting again"
68
-
69
- # status='init'
70
- # dotpi echo_warning "status: $status"
71
-
72
- # sudo dotpi audio_bluetooth_destination_start
73
- # fi
74
-
75
- done <&${btctl_process[0]}
76
-
77
- dotpi echo_info "############ Start ending"
78
-
79
- dotpi echo_info "Stopping audio bluetooth destination"
80
- sudo dotpi audio_bluetooth_destination_stop
@@ -1,26 +0,0 @@
1
- #!/bin/bash
2
-
3
- local_file="$(dotpi readlink_follow "$0")"
4
- local_path="$(dirname -- "$local_file")"
5
-
6
- source "${local_path}/dotpi_jackd.bash"
7
-
8
- echo "dotpi_jackd_command"
9
-
10
- echo "ENV: ${DOTPI_JACKD_ENVIRONMENT[@]}"
11
- echo "ARGS: ${DOTPI_JACKD_ARGUMENTS[@]}"
12
-
13
- for e in "${DOTPI_JACKD_ENVIRONMENT[@]}" ; do
14
- export "$e"
15
- done
16
-
17
- while IFS= read -r output ; do
18
- jackd_pid="$!"
19
- # forward output
20
- echo "$output"
21
- if [[ "$output" =~ JackAudioDriver.*stopping ]] ; then
22
- dotpi echo_error "jackd stopped, it will be killed."
23
- kill "$jackd_pid"
24
- fi
25
- done < <( jackd "${DOTPI_JACKD_ARGUMENTS[@]}" 2>&1)
26
-
@@ -1,30 +0,0 @@
1
- #!/bin/bash
2
-
3
- local_file="$(dotpi readlink_follow "$0")"
4
- local_path="$(dirname -- "$local_file")"
5
-
6
- source /opt/dotpi/share/dotpi_init.bash
7
-
8
- dotpi_echo_info "$0"
9
-
10
- clean_up() {
11
- dotpi_echo_info "$0 clean_up"
12
-
13
- # if [[ -n ${btctl_process} ]] ; then
14
- # dotpi_echo_info "Ending bluetoothctl process"
15
- # kill "${btctl_process_PID}"
16
- # fi
17
- }
18
- trap clean_up EXIT ERR SIGHUP SIGTERM SIGINT
19
-
20
- destination_mac="$dotpi_audio_bluetooth_mac"
21
-
22
-
23
- dotpi_echo_info "Starting bluetoothctl process"
24
- status='init'
25
- coproc btctl_process { bluetoothctl; }
26
-
27
- while true; do
28
- dotpi_echo_info "$0 $(date)"
29
- sleep 1
30
- done
@@ -1,21 +0,0 @@
1
- [Unit]
2
- Description=Jack daemon
3
- After=sound.target
4
-
5
- [Service]
6
- LimitRTPRIO=infinity
7
- LimitMEMLOCK=infinity
8
- User=pi
9
- Group=audio
10
- ExecStart=/opt/dotpi/share/jackd/dotpi_jackd_command
11
- Restart=always
12
-
13
- # wait before restarting
14
- RestartSec=1s
15
-
16
- # Do not stop to try restarting service
17
- StartLimitBurst=0
18
-
19
- [Install]
20
- WantedBy=multi-user.target
21
-