@dotpi/tools 2.9.6 → 2.10.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.
@@ -48,10 +48,18 @@ echo "$bashrc_append" >> "${FIRSTUSERHOME}/.bashrc"
48
48
  substitution="# dotpi: source even if non-interactive"
49
49
  dotpi configuration_replace_region 'case $- in' 'esac' "$substitution" "${FIRSTUSERHOME}/.bashrc"
50
50
 
51
+ ####### disable Raspberry Pi imager configuration
52
+ # otherwise it will apply again at next boot
53
+
54
+ user_data_file="/boot/firmware/user-data"
55
+ if [ -f "$user_data_file" ] ; then
56
+ dotpi echo_info "Disable Raspberry Pi imager configuration"
57
+ mv "$user_data_file" "${user_data_file}.disabled"
58
+ fi
59
+
51
60
  ####### hostname
52
61
 
53
62
  dotpi echo_info "Set hostname to ${dotpi_instance_hostname}"
54
-
55
63
  dotpi system_set_hostname "$dotpi_instance_hostname"
56
64
 
57
65
  ####### ssh
@@ -178,6 +186,31 @@ KBEOF
178
186
  dpkg-reconfigure -f noninteractive keyboard-configuration
179
187
  fi
180
188
 
189
+ # Adapt swap to low-memory devices (eg. Raspberry Pi Zero 2 W)
190
+ memory_kb=$(cat /proc/meminfo | grep MemTotal | awk '{ print $2 }')
191
+
192
+ # test for 3GB, to cope with some unavailable memory (MemTotal reports less)
193
+ if (( memory_kb < $(( 3 * 1024 * 1024 )) )) ; then
194
+ dotpi echo_warning "Low memory device detected: configure 2GB swap"
195
+
196
+ rpi_swap_directory="/etc/rpi"
197
+
198
+ # Trixie
199
+ if [[ -f "${rpi_swap_directory}/swap.conf" ]] ; then
200
+ rpi_swap_directory_user="${rpi_swap_directory}/swap.conf.d"
201
+ sudo mkdir -p "$rpi_swap_directory_user"
202
+ sudo cp "${DOTPI_ROOT}/share/swap/99-dotpi-2GB-swapfile.conf" "${rpi_swap_directory_user}"
203
+
204
+ # Bookworm
205
+ elif [[ -f /etc/dphys-swapfile ]] ; then
206
+ sudo cp "${DOTPI_ROOT}/share/swap/dotpi-2GB-dphys-swapfile" /etc/dphys-swapfile
207
+
208
+ else
209
+ dotpi echo_ERROR "No known swap configuration found, unable to configure."
210
+ fi
211
+
212
+ fi
213
+
181
214
  # read again as it may have changed
182
215
  FIRSTUSER="$(getent passwd 1000 | cut -d: -f1)"
183
216
 
@@ -2,6 +2,12 @@
2
2
 
3
3
  set +e
4
4
 
5
+ # duplicate log to SD card
6
+ log_path='/boot/firmware'
7
+ log_file="${1:-${log_path}/dotpi_prepare_system-$(date +"%Y%m%d-%H%M%S").log}"
8
+ # Self log
9
+ exec &> >(sudo tee -a "$log_file")
10
+
5
11
  error_exit() {
6
12
  error_code="${1:-255}"
7
13
  error_context="${2:-dotpi_prepare_system}"
@@ -23,13 +29,14 @@ if [[ $(whoami) != "${FIRSTUSER}" ]] ; then
23
29
  error_exit 255 "This script MUST be executed by pi user (or first user)" $error_exit_code_init
24
30
  fi
25
31
 
26
- dotpi echo_info "Configure wifi"
27
-
28
32
  DOTPI_ROOT="${DOTPI_ROOT:-/opt/dotpi}"
29
33
  source "${DOTPI_ROOT}/share/dotpi_init.bash" || {
30
34
  error_exit $? "source dotpi_init.bash" $error_exit_code_init
31
35
  }
32
36
 
37
+ ####### wifi
38
+ dotpi echo_info "Configure wifi"
39
+
33
40
  # set wifi country code
34
41
  #
35
42
  # This is also done earlier by `dotpi_firstrun` but doing this
@@ -39,19 +46,21 @@ sudo raspi-config nonint do_wifi_country "${dotpi_wifi_country_code}" || {
39
46
  error_exit $? "set wifi country code" $error_exit_code_init
40
47
  }
41
48
 
49
+ dotpi echo_info "Update network configurations"
50
+ sudo dotpi connections_update
51
+ nmcli connection show
52
+
42
53
  # unblock wifi in any case
43
54
  sudo nmcli radio wifi on
44
55
  sudo rfkill unblock wifi
45
56
 
46
- dotpi echo_info "Update network configurations"
47
- sudo dotpi connections_update
48
-
49
57
  # wait for system time update to be able to verify certificates needed by apt
50
58
  dotpi echo_info "Wait for the system clock to update from network"
51
- while [[ $(timedatectl show --property NTPSynchronized --value | grep yes | wc -l) == 0 ]] ; do
59
+ while [[ $(timedatectl --property NTPSynchronized --value | grep yes | wc -l) == 0 ]] ; do
52
60
  date
53
61
  sleep 5
54
62
  done
63
+ timedatectl status
55
64
  date
56
65
 
57
66
  ############### system packages via apt
@@ -0,0 +1,28 @@
1
+ Copyright (c) 2023-present IRCAM – Centre Pompidou (France, Paris)
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification,
6
+ are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above copyright notice, this
12
+ list of conditions and the following disclaimer in the documentation and/or
13
+ other materials provided with the distribution.
14
+
15
+ * Neither the name of the IRCAM nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,10 +1,11 @@
1
1
  {
2
2
  "name": "@dotpi/avahi-monitor-module",
3
- "version": "1.1.7",
3
+ "version": "1.1.8",
4
4
  "description": "A tool to monitor and restart Avahi service",
5
5
  "scripts": {
6
6
  "postinstall": "./dotpi_install",
7
7
  "preuninstall": "./dotpi_uninstall"
8
8
  },
9
- "license": "BSD-3-clause"
9
+ "license": "BSD-3-clause",
10
+ "gitHead": "0321bc097fea5755a4af8a2d59c9392d30bd452c"
10
11
  }
@@ -0,0 +1,28 @@
1
+ Copyright (c) 2023-present IRCAM – Centre Pompidou (France, Paris)
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification,
6
+ are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above copyright notice, this
12
+ list of conditions and the following disclaimer in the documentation and/or
13
+ other materials provided with the distribution.
14
+
15
+ * Neither the name of the IRCAM nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotpi/javascript",
3
- "version": "1.6.2",
3
+ "version": "1.6.3",
4
4
  "description": "dotpi javascript utilities",
5
5
  "type": "module",
6
6
  "main": "index.js",
@@ -12,5 +12,6 @@
12
12
  "chalk": "^5.4.0",
13
13
  "execa": "^9.5.2",
14
14
  "template-literal": "^1.0.4"
15
- }
15
+ },
16
+ "gitHead": "0321bc097fea5755a4af8a2d59c9392d30bd452c"
16
17
  }
@@ -0,0 +1,28 @@
1
+ Copyright (c) 2023-present IRCAM – Centre Pompidou (France, Paris)
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification,
6
+ are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above copyright notice, this
12
+ list of conditions and the following disclaimer in the documentation and/or
13
+ other materials provided with the distribution.
14
+
15
+ * Neither the name of the IRCAM nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotpi/module",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "dotpi module management",
5
5
  "type": "module",
6
6
  "exports": {
@@ -8,8 +8,9 @@
8
8
  },
9
9
  "license": "BSD-3-clause",
10
10
  "dependencies": {
11
- "@dotpi/javascript": "^1.6.2",
11
+ "@dotpi/javascript": "^1.6.3",
12
12
  "execa": "^9.5.2",
13
13
  "globby": "^14.0.2"
14
- }
14
+ },
15
+ "gitHead": "0321bc097fea5755a4af8a2d59c9392d30bd452c"
15
16
  }
@@ -0,0 +1,28 @@
1
+ Copyright (c) 2023-present IRCAM – Centre Pompidou (France, Paris)
2
+
3
+ All rights reserved.
4
+
5
+ Redistribution and use in source and binary forms, with or without modification,
6
+ are permitted provided that the following conditions are met:
7
+
8
+ * Redistributions of source code must retain the above copyright notice, this
9
+ list of conditions and the following disclaimer.
10
+
11
+ * Redistributions in binary form must reproduce the above copyright notice, this
12
+ list of conditions and the following disclaimer in the documentation and/or
13
+ other materials provided with the distribution.
14
+
15
+ * Neither the name of the IRCAM nor the names of its
16
+ contributors may be used to endorse or promote products derived from
17
+ this software without specific prior written permission.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
20
+ ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
21
+ WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
22
+ DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR
23
+ ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
24
+ (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
25
+ LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON
26
+ ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
27
+ (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
28
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotpi/module-module",
3
- "version": "1.8.2",
3
+ "version": "1.8.3",
4
4
  "description": "dotpi module management",
5
5
  "type": "module",
6
6
  "bin": "./bin/dotpi_module",
@@ -10,8 +10,9 @@
10
10
  },
11
11
  "license": "BSD-3-clause",
12
12
  "dependencies": {
13
- "@dotpi/javascript": "^1.6.2",
14
- "@dotpi/module": "^1.8.2",
13
+ "@dotpi/javascript": "^1.6.3",
14
+ "@dotpi/module": "^1.8.3",
15
15
  "commander": "^12.1.0"
16
- }
16
+ },
17
+ "gitHead": "0321bc097fea5755a4af8a2d59c9392d30bd452c"
17
18
  }
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+
3
+ /usr/bin/env node /opt/dotpi/share/n/bin/corepack "${@}"
4
+
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+
3
+ /opt/dotpi/share/n/bin/node --lite_mode --optimize_for_size "${@}"
4
+
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+
3
+ /usr/bin/env node /opt/dotpi/share/n/bin/npm "${@}"
4
+
@@ -0,0 +1,4 @@
1
+ #!/bin/bash
2
+
3
+ /usr/bin/env node /opt/dotpi/share/n/bin/npx "${@}"
4
+
@@ -0,0 +1,11 @@
1
+ # This file is for Debian Trixie
2
+ # Force a 2GB swap on constrained device (eg. Raspberry Pi Zero 2 W)
3
+
4
+ [Main]
5
+ Mechanism=swapfile
6
+
7
+ [File]
8
+ FixedSizeMiB=2048
9
+
10
+ [Zram]
11
+ FixedSizeMiB=2048
@@ -0,0 +1,5 @@
1
+ # This file is for Debian Bookworm
2
+ # Force a 2GB swap on constrained device (eg. Raspberry Pi Zero 2 W)
3
+
4
+ # set size to absolute value
5
+ CONF_SWAPSIZE=2048
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@dotpi/tools",
3
- "version": "2.9.6",
3
+ "version": "2.10.1",
4
4
  "description": "Set of scripts for managing dotpi fleets of Raspberry Pi",
5
5
  "author": "Jean-Philippe Lambert",
6
6
  "contributors": [
@@ -36,8 +36,8 @@
36
36
  },
37
37
  "license": "BSD-3-Clause",
38
38
  "dependencies": {
39
- "@dotpi/javascript": "^1.6.2",
40
- "@dotpi/module": "^1.8.2",
39
+ "@dotpi/javascript": "^1.6.3",
40
+ "@dotpi/module": "^1.8.3",
41
41
  "chalk": "^5.3.0",
42
42
  "commander": "^12.1.0",
43
43
  "prompts": "^2.4.2",
@@ -46,5 +46,5 @@
46
46
  "devDependencies": {
47
47
  "lerna": "^8.2.4"
48
48
  },
49
- "gitHead": "1932fccf5d1302b69e18b7ff416f9bff60efd0d9"
49
+ "gitHead": "0321bc097fea5755a4af8a2d59c9392d30bd452c"
50
50
  }