@fungi.computer/spore 0.23.1 → 0.24.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.
@@ -57,11 +57,21 @@ provision:
57
57
  script: |
58
58
  #!/bin/bash
59
59
  set -euo pipefail
60
- if ! command -v bwrap >/dev/null || ! command -v git >/dev/null; then
60
+ # Packages and Node.js with Spore do not need each other, so they install side
61
+ # by side. Lima's image already carries package lists, so apt updates them
62
+ # only when an install fails on stale ones.
63
+ install_apt() {
64
+ if command -v bwrap >/dev/null && command -v git >/dev/null; then
65
+ return 0
66
+ fi
61
67
  export DEBIAN_FRONTEND=noninteractive
62
- apt-get update -q
63
- apt-get install -yq --no-install-recommends bubblewrap ca-certificates curl git xz-utils
64
- fi
68
+ local packages=(bubblewrap ca-certificates curl git xz-utils)
69
+ apt-get install -yq --no-install-recommends "${packages[@]}" ||
70
+ { apt-get update -q &&
71
+ apt-get install -yq --no-install-recommends "${packages[@]}"; }
72
+ }
73
+ install_apt &
74
+ apt_job=$!
65
75
  # Ubuntu 24.04 blocks unprivileged user namespaces by default, which
66
76
  # leaves Fungi's Workspace sandbox (bubblewrap) unavailable in the VM.
67
77
  echo "kernel.apparmor_restrict_unprivileged_userns = 0" >/etc/sysctl.d/60-fungi-sandbox.conf
@@ -85,22 +95,28 @@ provision:
85
95
  }
86
96
  EOF
87
97
  fi
88
- if [ "$(node --version 2>/dev/null)" != "v${PARAM_NODE_VERSION}" ]; then
89
- case "$(uname -m)" in
90
- x86_64) node_arch=x64; node_sha256="${PARAM_NODE_SHA256_X64}" ;;
91
- aarch64) node_arch=arm64; node_sha256="${PARAM_NODE_SHA256_ARM64}" ;;
92
- *) echo "Fungi VM supports x86_64 and aarch64 guests, not $(uname -m)" >&2; exit 1 ;;
93
- esac
94
- archive="node-v${PARAM_NODE_VERSION}-linux-${node_arch}.tar.xz"
95
- curl -fsSLo "/tmp/${archive}" "https://nodejs.org/dist/v${PARAM_NODE_VERSION}/${archive}"
96
- echo "${node_sha256} /tmp/${archive}" | sha256sum -c -
97
- tar -xJf "/tmp/${archive}" -C /usr/local --strip-components=1 \
98
- --exclude=CHANGELOG.md --exclude=LICENSE --exclude=README.md
99
- rm -f "/tmp/${archive}"
100
- fi
101
- if [ ! -e /usr/local/lib/node_modules/@fungi.computer/spore/package.json ]; then
102
- npm install --global --no-fund --no-audit "@fungi.computer/spore@${PARAM_SPORE_VERSION}"
103
- fi
98
+ install_node_and_spore() {
99
+ if [ "$(node --version 2>/dev/null)" != "v${PARAM_NODE_VERSION}" ]; then
100
+ case "$(uname -m)" in
101
+ x86_64) node_arch=x64; node_sha256="${PARAM_NODE_SHA256_X64}" ;;
102
+ aarch64) node_arch=arm64; node_sha256="${PARAM_NODE_SHA256_ARM64}" ;;
103
+ *) echo "Fungi VM supports x86_64 and aarch64 guests, not $(uname -m)" >&2; exit 1 ;;
104
+ esac
105
+ archive="node-v${PARAM_NODE_VERSION}-linux-${node_arch}.tar.xz"
106
+ curl -fsSLo "/tmp/${archive}" "https://nodejs.org/dist/v${PARAM_NODE_VERSION}/${archive}"
107
+ echo "${node_sha256} /tmp/${archive}" | sha256sum -c -
108
+ tar -xJf "/tmp/${archive}" -C /usr/local --strip-components=1 \
109
+ --exclude=CHANGELOG.md --exclude=LICENSE --exclude=README.md
110
+ rm -f "/tmp/${archive}"
111
+ fi
112
+ if [ ! -e /usr/local/lib/node_modules/@fungi.computer/spore/package.json ]; then
113
+ npm install --global --no-fund --no-audit "@fungi.computer/spore@${PARAM_SPORE_VERSION}"
114
+ fi
115
+ }
116
+ install_node_and_spore &
117
+ node_job=$!
118
+ wait "$apt_job"
119
+ wait "$node_job"
104
120
 
105
121
  probes:
106
122
  - mode: readiness