@dotpi/tools 2.8.0 → 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.
@@ -8,7 +8,7 @@ local_path="$(dirname -- "$local_file")"
8
8
  log_file="${1:-${local_file}-$(date +"%Y%m%d-%H%M%S").log}"
9
9
 
10
10
  # Self log
11
- exec &> >(dotpi log "$log_file")
11
+ exec &> >(tee -a "$log_file")
12
12
 
13
13
  DOTPI_ROOT="${DOTPI_ROOT:-/opt/dotpi}"
14
14
 
@@ -101,7 +101,11 @@ dotpi echo_info "Install Node.js"
101
101
 
102
102
  word_size="$(dotpi file_word_size "$(which file)" )"
103
103
  if [[ $word_size == "32" ]] ; then
104
- node_arch=armv7l
104
+ if [[ "$(uname -m)" == "armv6l" ]] ; then
105
+ node_arch=armv6l
106
+ else
107
+ node_arch=armv7l
108
+ fi
105
109
  else
106
110
  node_arch=arm64
107
111
  fi
@@ -112,8 +116,10 @@ sudo rm -rf -- "$N_PREFIX" || {
112
116
  error_exit $? "rm ${N_PREFIX}" $error_exit_code_node
113
117
  }
114
118
 
115
-
116
- sudo mkdir -p -- "$N_PREFIX" || {
119
+ {
120
+ sudo mkdir -p -- "$N_PREFIX"
121
+ sudo chmod a+rw "$N_PREFIX"
122
+ } || {
117
123
  error_exit $? "mkdir ${N_PREFIX}" $error_exit_code_node
118
124
  }
119
125
 
@@ -123,7 +129,38 @@ while ! curl -L https://bit.ly/n-install -o /tmp/n-install ; do
123
129
  echo "trying again"
124
130
  done
125
131
 
126
- while ! sudo N_PREFIX="${DOTPI_ROOT}/share/n" bash /tmp/n-install -y -a "$node_arch" "$dotpi_node_version" ; do
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
127
164
  dotpi echo_warning "Error with n-install"
128
165
  sleep 1
129
166
  echo "trying again"
@@ -131,21 +168,22 @@ while ! sudo N_PREFIX="${DOTPI_ROOT}/share/n" bash /tmp/n-install -y -a "$node_a
131
168
  sudo mkdir -p -- "$N_PREFIX"
132
169
  done
133
170
 
134
- rm /tmp/n-install
135
- sudo bash -c "cat >> '/root/.bashrc' << EOF
136
171
 
137
- # dotpi: force the usage of -a for correct architecture
138
- # (n relies on uname, which tells about the kernel, not the executables)
172
+ rm -f /tmp/n-install
139
173
 
140
- alias n='n -a ${node_arch}'
141
174
 
142
- EOF
143
- " || {
144
- error_exit $? "n alias in /root/.bashrc" $error_exit_code_node
145
- }
146
175
 
147
- source="${N_PREFIX}/bin"
148
- destination="/usr/bin"
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"
149
187
  executables=(
150
188
  corepack
151
189
  n
@@ -154,8 +192,8 @@ executables=(
154
192
  npx
155
193
  )
156
194
  for executable in "${executables[@]}" ; do
157
- sudo ln -s -f "${source}/${executable}" "${destination}/${executable}" || {
158
- error_exit $? "symlink to ${destination}/${executable}" $error_exit_code_node
195
+ sudo ln -s -f "${source_path}/${executable}" "${destination_path}/${executable}" || {
196
+ error_exit $? "symlink to ${destination_path}/${executable}" $error_exit_code_node
159
197
  }
160
198
  done
161
199
 
@@ -520,8 +520,9 @@ dotpi_audio_device_init() (
520
520
 
521
521
  'raspiaudio mic+ v1' | 'raspiaudio mic+ v2')
522
522
 
523
- amixer -D sysdefault sset -- 'Master' 'on'
524
- amixer -D sysdefault sset -- 'Master' '0%'
523
+ # no controller for device, use default 'Master' control
524
+ amixer sset -- 'Master' 'on'
525
+ amixer sset -- 'Master' '80%'
525
526
 
526
527
  alsactl store
527
528
  ;;
@@ -14,7 +14,7 @@ while true ; do
14
14
  (
15
15
  (( trial_count = 0 ))
16
16
  while (( trial_count < trial_count_max )) ; do
17
- "${local_path}/../bin/dotpi_pipewire_relink" && exit 0
17
+ nice "${local_path}/../bin/dotpi_pipewire_relink" && exit 0
18
18
  sleep 3
19
19
  (( ++trial_count ))
20
20
  done
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotpi/tools",
3
- "version": "2.8.0",
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": [