@dotpi/tools 2.7.3 → 2.8.1
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.
|
@@ -71,7 +71,13 @@ sudo dotpi apt_get update || {
|
|
|
71
71
|
error_exit $? 'apt_get update' $error_exit_code_package
|
|
72
72
|
}
|
|
73
73
|
sudo dotpi apt_get dist-upgrade || {
|
|
74
|
-
|
|
74
|
+
dotpi echo_error "Error while doing apt_get dist-upgrade"
|
|
75
|
+
dotpi echo_warning "Try to fix broken configuration and retry dist-upgrade"
|
|
76
|
+
sudo dpkg --configure -a --force-confdef --force-confnew
|
|
77
|
+
|
|
78
|
+
sudo dotpi apt_get dist-upgrade || {
|
|
79
|
+
error_exit $? 'apt_get dist-upgrade' $error_exit_code_package
|
|
80
|
+
}
|
|
75
81
|
}
|
|
76
82
|
|
|
77
83
|
declare -A apt_install_packages
|
|
@@ -95,7 +101,11 @@ dotpi echo_info "Install Node.js"
|
|
|
95
101
|
|
|
96
102
|
word_size="$(dotpi file_word_size "$(which file)" )"
|
|
97
103
|
if [[ $word_size == "32" ]] ; then
|
|
98
|
-
|
|
104
|
+
if [[ "$(uname -m)" == "armv6l" ]] ; then
|
|
105
|
+
node_arch=armv6l
|
|
106
|
+
else
|
|
107
|
+
node_arch=armv7l
|
|
108
|
+
fi
|
|
99
109
|
else
|
|
100
110
|
node_arch=arm64
|
|
101
111
|
fi
|
|
@@ -106,8 +116,10 @@ sudo rm -rf -- "$N_PREFIX" || {
|
|
|
106
116
|
error_exit $? "rm ${N_PREFIX}" $error_exit_code_node
|
|
107
117
|
}
|
|
108
118
|
|
|
109
|
-
|
|
110
|
-
sudo mkdir -p -- "$N_PREFIX"
|
|
119
|
+
{
|
|
120
|
+
sudo mkdir -p -- "$N_PREFIX"
|
|
121
|
+
sudo chmod a+rw "$N_PREFIX"
|
|
122
|
+
} || {
|
|
111
123
|
error_exit $? "mkdir ${N_PREFIX}" $error_exit_code_node
|
|
112
124
|
}
|
|
113
125
|
|
|
@@ -117,7 +129,38 @@ while ! curl -L https://bit.ly/n-install -o /tmp/n-install ; do
|
|
|
117
129
|
echo "trying again"
|
|
118
130
|
done
|
|
119
131
|
|
|
120
|
-
|
|
132
|
+
environment_definitions=(
|
|
133
|
+
# n-install checks for N_PREFIX to not be set in .bashrc
|
|
134
|
+
# "N_PREFIX='${N_PREFIX}'"
|
|
135
|
+
|
|
136
|
+
"N_ARCH='${node_arch}'"
|
|
137
|
+
)
|
|
138
|
+
|
|
139
|
+
if [[ $node_arch == "armv6l" ]] ; then
|
|
140
|
+
# armv6 is not supported any more in offical node.js builds
|
|
141
|
+
environment_definitions+=(
|
|
142
|
+
"N_NODE_MIRROR='https://unofficial-builds.nodejs.org/download/release'"
|
|
143
|
+
)
|
|
144
|
+
fi
|
|
145
|
+
|
|
146
|
+
echo "
|
|
147
|
+
|
|
148
|
+
# dotpi: environment variables for n (node version manager)
|
|
149
|
+
" >> "${HOME}/.bashrc" || {
|
|
150
|
+
error_exit $? "n environment in ${HOME}/.bashrc" $error_exit_code_node
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
for definition in "${environment_definitions[@]}" ; do
|
|
154
|
+
cmd="export ${definition}"
|
|
155
|
+
eval "$cmd"
|
|
156
|
+
echo "$cmd" >> "${HOME}/.bashrc" || {
|
|
157
|
+
error_exit $? "n environment in ${HOME}/.bashrc" $error_exit_code_node
|
|
158
|
+
}
|
|
159
|
+
done
|
|
160
|
+
|
|
161
|
+
# n-install checks for N_PREFIX to not be set in bashrc
|
|
162
|
+
# however, it must be set for the installation
|
|
163
|
+
while ! N_PREFIX="$N_PREFIX" bash /tmp/n-install -y -a "$node_arch" "$dotpi_node_version" ; do
|
|
121
164
|
dotpi echo_warning "Error with n-install"
|
|
122
165
|
sleep 1
|
|
123
166
|
echo "trying again"
|
|
@@ -125,21 +168,22 @@ while ! sudo N_PREFIX="${DOTPI_ROOT}/share/n" bash /tmp/n-install -y -a "$node_a
|
|
|
125
168
|
sudo mkdir -p -- "$N_PREFIX"
|
|
126
169
|
done
|
|
127
170
|
|
|
128
|
-
rm /tmp/n-install
|
|
129
|
-
sudo bash -c "cat >> '/root/.bashrc' << EOF
|
|
130
171
|
|
|
131
|
-
|
|
132
|
-
# (n relies on uname, which tells about the kernel, not the executables)
|
|
172
|
+
rm -f /tmp/n-install
|
|
133
173
|
|
|
134
|
-
alias n='n -a ${node_arch}'
|
|
135
174
|
|
|
136
|
-
EOF
|
|
137
|
-
" || {
|
|
138
|
-
error_exit $? "n alias in /root/.bashrc" $error_exit_code_node
|
|
139
|
-
}
|
|
140
175
|
|
|
141
|
-
|
|
142
|
-
|
|
176
|
+
# echo "
|
|
177
|
+
# # dotpi: force the usage of -a for correct architecture
|
|
178
|
+
# # (n relies on uname, which tells about the kernel, not the executables)
|
|
179
|
+
|
|
180
|
+
# alias n='${environment_variables[*]} n -a ${node_arch}'
|
|
181
|
+
# " >> "${HOME}/.bashrc" || {
|
|
182
|
+
# error_exit $? "n alias in /root/.bashrc" $error_exit_code_node
|
|
183
|
+
# }
|
|
184
|
+
|
|
185
|
+
source_path="${N_PREFIX}/bin"
|
|
186
|
+
destination_path="/usr/bin"
|
|
143
187
|
executables=(
|
|
144
188
|
corepack
|
|
145
189
|
n
|
|
@@ -148,8 +192,8 @@ executables=(
|
|
|
148
192
|
npx
|
|
149
193
|
)
|
|
150
194
|
for executable in "${executables[@]}" ; do
|
|
151
|
-
sudo ln -s -f "${
|
|
152
|
-
error_exit $? "symlink to ${
|
|
195
|
+
sudo ln -s -f "${source_path}/${executable}" "${destination_path}/${executable}" || {
|
|
196
|
+
error_exit $? "symlink to ${destination_path}/${executable}" $error_exit_code_node
|
|
153
197
|
}
|
|
154
198
|
done
|
|
155
199
|
|
|
@@ -32,6 +32,8 @@ dotpi_audio_device_supported=(
|
|
|
32
32
|
'raspberry pi dac pro'
|
|
33
33
|
'raspberry pi dac+'
|
|
34
34
|
'raspberry pi digiamp+'
|
|
35
|
+
'raspiaudio mic+ v1'
|
|
36
|
+
'raspiaudio mic+ v2'
|
|
35
37
|
'ue boom 2'
|
|
36
38
|
'ue boom 3'
|
|
37
39
|
'ue megaboom 2'
|
|
@@ -258,6 +260,11 @@ dotpi_audio_device_select() (
|
|
|
258
260
|
_dotpi_audio_device_select_hifiberry
|
|
259
261
|
;;
|
|
260
262
|
|
|
263
|
+
'raspiaudio mic+ v1' | 'raspiaudio mic+ v2')
|
|
264
|
+
dtoverlay=googlevoicehat-soundcard
|
|
265
|
+
_dotpi_audio_device_select_raspiaudio
|
|
266
|
+
;;
|
|
267
|
+
|
|
261
268
|
####### Ultimate Ears (UE)
|
|
262
269
|
|
|
263
270
|
'ue boom 2'|'ue boom 3'|'ue megaboom 2'|'ue megaboom 3')
|
|
@@ -328,6 +335,10 @@ _dotpi_audio_device_disable_all() (
|
|
|
328
335
|
_dotpi_audio_device_disable_hifiberry
|
|
329
336
|
fi
|
|
330
337
|
|
|
338
|
+
if [[ ! "$exception_family" = "raspiaudio" ]] ; then
|
|
339
|
+
_dotpi_audio_device_disable_raspiaudio
|
|
340
|
+
fi
|
|
341
|
+
|
|
331
342
|
)
|
|
332
343
|
|
|
333
344
|
_dotpi_audio_device_select_headphones() (
|
|
@@ -374,6 +385,20 @@ dtoverlay=${dtoverlay}
|
|
|
374
385
|
EOF
|
|
375
386
|
)
|
|
376
387
|
|
|
388
|
+
_dotpi_audio_device_select_raspiaudio() (
|
|
389
|
+
dotpi_echo_info "Configuring Raspiaudio device '${model}'"
|
|
390
|
+
|
|
391
|
+
_dotpi_audio_device_disable_all raspiaudio
|
|
392
|
+
|
|
393
|
+
mkdir -p "$(dirname -- "$config_file")"
|
|
394
|
+
cat >> "$config_file" << EOF
|
|
395
|
+
|
|
396
|
+
# dotpi: overlay for audio device '${model}'
|
|
397
|
+
dtoverlay=${dtoverlay}
|
|
398
|
+
|
|
399
|
+
EOF
|
|
400
|
+
)
|
|
401
|
+
|
|
377
402
|
_dotpi_audio_device_disable_headphones() (
|
|
378
403
|
dotpi_echo_info "Disabling headphones"
|
|
379
404
|
# disable internal audio device
|
|
@@ -409,6 +434,14 @@ _dotpi_audio_device_disable_hifiberry() (
|
|
|
409
434
|
perl -pe "s/${pattern}/"'${1}# ${2}${3}/' -i -- "$config_file"
|
|
410
435
|
)
|
|
411
436
|
|
|
437
|
+
_dotpi_audio_device_disable_raspiaudio() (
|
|
438
|
+
dotpi_echo_info "Disabling Raspiaudio"
|
|
439
|
+
|
|
440
|
+
# disable hifiberry
|
|
441
|
+
pattern="$(dotpi_configuration_get_pattern --prefix "dtoverlay=googlevoicehat-soundcard")"
|
|
442
|
+
perl -pe "s/${pattern}/"'${1}# ${2}${3}/' -i -- "$config_file"
|
|
443
|
+
)
|
|
444
|
+
|
|
412
445
|
_dotpi_audio_device_volume_set_alsa() (
|
|
413
446
|
amixer -- sset "$control" "$volume"
|
|
414
447
|
alsactl store
|
|
@@ -485,6 +518,15 @@ dotpi_audio_device_init() (
|
|
|
485
518
|
alsactl store
|
|
486
519
|
;;
|
|
487
520
|
|
|
521
|
+
'raspiaudio mic+ v1' | 'raspiaudio mic+ v2')
|
|
522
|
+
|
|
523
|
+
# no controller for device, use default 'Master' control
|
|
524
|
+
amixer sset -- 'Master' 'on'
|
|
525
|
+
amixer sset -- 'Master' '80%'
|
|
526
|
+
|
|
527
|
+
alsactl store
|
|
528
|
+
;;
|
|
529
|
+
|
|
488
530
|
esac
|
|
489
531
|
|
|
490
532
|
)
|
|
@@ -532,6 +574,12 @@ dotpi_audio_device_volume_set() (
|
|
|
532
574
|
_dotpi_audio_device_volume_set_alsa
|
|
533
575
|
;;
|
|
534
576
|
|
|
577
|
+
'raspiaudio mic+ v1' | 'raspiaudio mic+ v2')
|
|
578
|
+
control='Master'
|
|
579
|
+
_dotpi_audio_device_volume_set_alsa
|
|
580
|
+
;;
|
|
581
|
+
|
|
582
|
+
|
|
535
583
|
####### Ultimate Ears (UE)
|
|
536
584
|
|
|
537
585
|
'ue boom 2'|'ue boom 3'|'ue megaboom 2'|'ue megaboom 3')
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@dotpi/tools",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.8.1",
|
|
4
4
|
"description": "Set of scripts for managing dotpi fleets of Raspberry Pi",
|
|
5
5
|
"author": "Jean-Philippe Lambert",
|
|
6
6
|
"contributors": [
|
|
@@ -45,6 +45,5 @@
|
|
|
45
45
|
},
|
|
46
46
|
"devDependencies": {
|
|
47
47
|
"lerna": "^8.1.9"
|
|
48
|
-
}
|
|
49
|
-
"gitHead": "c877ffc0629657b4a6883d97a89204a06bd0f74e"
|
|
48
|
+
}
|
|
50
49
|
}
|