oh-my-devpod 0.14.2 → 0.14.4
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.
- package/README.md +11 -1
- package/bin/omd +6 -1
- package/lib/source.js +3 -0
- package/package.json +1 -1
- package/runtime/VERSION +1 -1
- package/runtime/bin/omd +0 -0
- package/runtime/build/install-gitee-cli.sh +141 -0
- package/runtime/components.toml +30 -0
- package/runtime/config/.zsh_plugins.txt +1 -0
- package/runtime/config/.zshrc +1 -1
- package/runtime/install/bootstrap.sh +13 -3
- package/runtime/install/update.sh +233 -63
- package/runtime/modules/core/micromamba.sh +11 -1
- package/runtime/modules/core/uv.sh +11 -1
- package/runtime/modules/lib/common.sh +115 -28
- package/runtime/modules/lib/postflight.sh +16 -0
- package/runtime/modules/lib/source-config.sh +307 -0
- package/runtime/modules/tools/gh.sh +26 -0
- package/runtime/modules/tools/gitee.sh +101 -0
- package/runtime/modules/tools/yq.sh +26 -0
|
@@ -7,6 +7,8 @@ export OHMYDEVPOD_BOOTSTRAP_LIB_ONLY=1
|
|
|
7
7
|
source "${bundle_root}/install/bootstrap.sh"
|
|
8
8
|
# shellcheck source=../modules/lib/common.sh
|
|
9
9
|
source "${bundle_root}/modules/lib/common.sh"
|
|
10
|
+
# shellcheck source=../modules/lib/source-config.sh
|
|
11
|
+
source "${bundle_root}/modules/lib/source-config.sh"
|
|
10
12
|
|
|
11
13
|
omd_update_normalize_version() {
|
|
12
14
|
printf '%s\n' "${1#v}"
|
|
@@ -30,10 +32,44 @@ omd_update_archive_version() {
|
|
|
30
32
|
printf '%s\n' "${version}"
|
|
31
33
|
}
|
|
32
34
|
|
|
35
|
+
omd_update_install_archive() {
|
|
36
|
+
local archive="$1" prefix="$2" bin_dir="$3" cache_dir="$4"
|
|
37
|
+
local staging_dir candidate_root candidate_bootstrap installed_version
|
|
38
|
+
staging_dir="$(mktemp -d "${cache_dir}/.candidate-bootstrap.XXXXXX")" || return 1
|
|
39
|
+
if ! tar -xzf "${archive}" -C "${staging_dir}"; then
|
|
40
|
+
rm -rf "${staging_dir}"
|
|
41
|
+
return 1
|
|
42
|
+
fi
|
|
43
|
+
candidate_root="${staging_dir}/oh-my-devpod"
|
|
44
|
+
if ! omd_validate_bundle "${candidate_root}"; then
|
|
45
|
+
rm -rf "${staging_dir}"
|
|
46
|
+
return 1
|
|
47
|
+
fi
|
|
48
|
+
candidate_bootstrap="${candidate_root}/install/bootstrap.sh"
|
|
49
|
+
if ! installed_version="$(
|
|
50
|
+
OHMYDEVPOD_BOOTSTRAP_LIB_ONLY=1 \
|
|
51
|
+
bash -c '
|
|
52
|
+
set -euo pipefail
|
|
53
|
+
source "$1"
|
|
54
|
+
omd_install_archive "$2" "$3" "$4"
|
|
55
|
+
' _ \
|
|
56
|
+
"${candidate_bootstrap}" \
|
|
57
|
+
"${archive}" \
|
|
58
|
+
"${prefix}" \
|
|
59
|
+
"${bin_dir}"
|
|
60
|
+
)"; then
|
|
61
|
+
rm -rf "${staging_dir}"
|
|
62
|
+
return 1
|
|
63
|
+
fi
|
|
64
|
+
rm -rf "${staging_dir}"
|
|
65
|
+
[[ -n "${installed_version}" ]] || return 1
|
|
66
|
+
printf '%s\n' "${installed_version}"
|
|
67
|
+
}
|
|
68
|
+
|
|
33
69
|
omd_update_snapshot_source_config() {
|
|
34
70
|
local config_dir="$1" snapshot_dir="$2" name
|
|
35
71
|
mkdir -p "${snapshot_dir}" || return 1
|
|
36
|
-
for name in source mirror-profile env uv.toml install-prefix bin-dir cache-dir; do
|
|
72
|
+
for name in source npm-source mirror-profile env uv.toml install-prefix bin-dir cache-dir; do
|
|
37
73
|
if [[ -f "${config_dir}/${name}" ]]; then
|
|
38
74
|
cp -p "${config_dir}/${name}" "${snapshot_dir}/${name}" || return 1
|
|
39
75
|
else
|
|
@@ -45,7 +81,7 @@ omd_update_snapshot_source_config() {
|
|
|
45
81
|
omd_update_restore_source_config() {
|
|
46
82
|
local config_dir="$1" snapshot_dir="$2" name
|
|
47
83
|
mkdir -p "${config_dir}" || return 1
|
|
48
|
-
for name in source mirror-profile env uv.toml install-prefix bin-dir cache-dir; do
|
|
84
|
+
for name in source npm-source mirror-profile env uv.toml install-prefix bin-dir cache-dir; do
|
|
49
85
|
if [[ -f "${snapshot_dir}/.missing-${name}" ]]; then
|
|
50
86
|
rm -f "${config_dir}/${name}" || return 1
|
|
51
87
|
else
|
|
@@ -61,12 +97,24 @@ OMD_UPDATE_BREW_REMOTE=""
|
|
|
61
97
|
OMD_UPDATE_BREW_REMOTE_PRESENT=0
|
|
62
98
|
OMD_UPDATE_BREW_REMOTE_CHANGED=0
|
|
63
99
|
OMD_UPDATE_BREW_LEGACY=0
|
|
100
|
+
OMD_UPDATE_BREW_CORE_PREFIX=""
|
|
101
|
+
OMD_UPDATE_BREW_CORE_REMOTE=""
|
|
102
|
+
OMD_UPDATE_BREW_CORE_REMOTE_PRESENT=0
|
|
103
|
+
OMD_UPDATE_BREW_CORE_REMOTE_CHANGED=0
|
|
64
104
|
|
|
65
105
|
omd_update_capture_brew_remote() {
|
|
66
|
-
local marker_prefix
|
|
106
|
+
local marker_prefix core_prefix
|
|
67
107
|
omd_module_is_managed linuxbrew || return 0
|
|
68
108
|
marker_prefix="$(omd_module_marker_value linuxbrew artifact || true)"
|
|
69
|
-
[[ -n "${marker_prefix}" && -d "${marker_prefix}" ]] ||
|
|
109
|
+
[[ -n "${marker_prefix}" && -d "${marker_prefix}" && -x "${marker_prefix}/bin/brew" ]] || {
|
|
110
|
+
omd_warn "Managed Homebrew prefix is missing or invalid: ${marker_prefix:-<empty>}"
|
|
111
|
+
return 1
|
|
112
|
+
}
|
|
113
|
+
marker_prefix="$(cd "${marker_prefix}" 2>/dev/null && pwd -P)" || return 1
|
|
114
|
+
omd_module_brew_cmd_matches_prefix "${marker_prefix}/bin/brew" "${marker_prefix}" || {
|
|
115
|
+
omd_warn "Managed Homebrew command does not belong to its recorded prefix"
|
|
116
|
+
return 1
|
|
117
|
+
}
|
|
70
118
|
command -v git >/dev/null 2>&1 || {
|
|
71
119
|
omd_warn "Git is required to switch the managed Homebrew remote"
|
|
72
120
|
return 1
|
|
@@ -75,50 +123,91 @@ omd_update_capture_brew_remote() {
|
|
|
75
123
|
OMD_UPDATE_BREW_PREFIX="${marker_prefix}"
|
|
76
124
|
if [[ ! -d "${marker_prefix}/.git" ]]; then
|
|
77
125
|
OMD_UPDATE_BREW_LEGACY=1
|
|
78
|
-
return 0
|
|
79
|
-
fi
|
|
80
|
-
if OMD_UPDATE_BREW_REMOTE="$(git -C "${marker_prefix}" remote get-url origin 2>/dev/null)"; then
|
|
81
|
-
OMD_UPDATE_BREW_REMOTE_PRESENT=1
|
|
82
126
|
else
|
|
83
|
-
OMD_UPDATE_BREW_REMOTE=""
|
|
84
|
-
|
|
127
|
+
if OMD_UPDATE_BREW_REMOTE="$(git -C "${marker_prefix}" remote get-url origin 2>/dev/null)"; then
|
|
128
|
+
OMD_UPDATE_BREW_REMOTE_PRESENT=1
|
|
129
|
+
else
|
|
130
|
+
OMD_UPDATE_BREW_REMOTE=""
|
|
131
|
+
OMD_UPDATE_BREW_REMOTE_PRESENT=0
|
|
132
|
+
fi
|
|
133
|
+
fi
|
|
134
|
+
|
|
135
|
+
core_prefix="${marker_prefix}/Library/Taps/homebrew/homebrew-core"
|
|
136
|
+
if [[ -d "${core_prefix}/.git" ]]; then
|
|
137
|
+
OMD_UPDATE_BREW_CORE_PREFIX="${core_prefix}"
|
|
138
|
+
if OMD_UPDATE_BREW_CORE_REMOTE="$(git -C "${core_prefix}" remote get-url origin 2>/dev/null)"; then
|
|
139
|
+
OMD_UPDATE_BREW_CORE_REMOTE_PRESENT=1
|
|
140
|
+
else
|
|
141
|
+
OMD_UPDATE_BREW_CORE_REMOTE=""
|
|
142
|
+
OMD_UPDATE_BREW_CORE_REMOTE_PRESENT=0
|
|
143
|
+
fi
|
|
85
144
|
fi
|
|
86
145
|
}
|
|
87
146
|
|
|
88
147
|
omd_update_apply_brew_remote() {
|
|
89
|
-
local source="$1" target_remote
|
|
148
|
+
local source="$1" target_remote target_core_remote
|
|
90
149
|
[[ -n "${OMD_UPDATE_BREW_PREFIX}" ]] || return 0
|
|
91
150
|
target_remote="$(omd_source_brew_remote "${source}")" || return 1
|
|
92
151
|
if [[ "${OMD_UPDATE_BREW_LEGACY}" == "1" ]]; then
|
|
93
152
|
git -C "${OMD_UPDATE_BREW_PREFIX}" init -q || return 1
|
|
94
153
|
OMD_UPDATE_BREW_REMOTE_CHANGED=1
|
|
95
154
|
git -C "${OMD_UPDATE_BREW_PREFIX}" remote add origin "${target_remote}" || return 1
|
|
96
|
-
|
|
155
|
+
else
|
|
156
|
+
if [[ "${OMD_UPDATE_BREW_REMOTE_PRESENT}" == "1" ]]; then
|
|
157
|
+
if [[ "${OMD_UPDATE_BREW_REMOTE}" != "${target_remote}" ]]; then
|
|
158
|
+
git -C "${OMD_UPDATE_BREW_PREFIX}" remote set-url origin "${target_remote}" ||
|
|
159
|
+
return 1
|
|
160
|
+
OMD_UPDATE_BREW_REMOTE_CHANGED=1
|
|
161
|
+
fi
|
|
162
|
+
else
|
|
163
|
+
git -C "${OMD_UPDATE_BREW_PREFIX}" remote add origin "${target_remote}" || return 1
|
|
164
|
+
OMD_UPDATE_BREW_REMOTE_CHANGED=1
|
|
165
|
+
fi
|
|
97
166
|
fi
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
167
|
+
|
|
168
|
+
[[ -n "${OMD_UPDATE_BREW_CORE_PREFIX}" ]] || return 0
|
|
169
|
+
target_core_remote="$(omd_source_brew_core_remote "${source}")" || return 1
|
|
170
|
+
if [[ "${OMD_UPDATE_BREW_CORE_REMOTE_PRESENT}" == "1" ]]; then
|
|
171
|
+
if [[ "${OMD_UPDATE_BREW_CORE_REMOTE}" != "${target_core_remote}" ]]; then
|
|
172
|
+
git -C "${OMD_UPDATE_BREW_CORE_PREFIX}" remote set-url origin "${target_core_remote}" ||
|
|
173
|
+
return 1
|
|
174
|
+
OMD_UPDATE_BREW_CORE_REMOTE_CHANGED=1
|
|
175
|
+
fi
|
|
101
176
|
else
|
|
102
|
-
git -C "${
|
|
177
|
+
git -C "${OMD_UPDATE_BREW_CORE_PREFIX}" remote add origin "${target_core_remote}" ||
|
|
178
|
+
return 1
|
|
179
|
+
OMD_UPDATE_BREW_CORE_REMOTE_CHANGED=1
|
|
103
180
|
fi
|
|
104
|
-
OMD_UPDATE_BREW_REMOTE_CHANGED=1
|
|
105
181
|
}
|
|
106
182
|
|
|
107
183
|
omd_update_restore_brew_remote() {
|
|
108
|
-
|
|
109
|
-
if [[ "${
|
|
110
|
-
|
|
111
|
-
|
|
184
|
+
local rollback_failed=0
|
|
185
|
+
if [[ "${OMD_UPDATE_BREW_CORE_REMOTE_CHANGED}" == "1" ]]; then
|
|
186
|
+
if [[ "${OMD_UPDATE_BREW_CORE_REMOTE_PRESENT}" == "1" ]]; then
|
|
187
|
+
git -C "${OMD_UPDATE_BREW_CORE_PREFIX}" remote set-url origin "${OMD_UPDATE_BREW_CORE_REMOTE}" ||
|
|
188
|
+
rollback_failed=1
|
|
189
|
+
else
|
|
190
|
+
git -C "${OMD_UPDATE_BREW_CORE_PREFIX}" remote remove origin ||
|
|
191
|
+
rollback_failed=1
|
|
192
|
+
fi
|
|
112
193
|
fi
|
|
113
|
-
if [[ "${
|
|
114
|
-
|
|
115
|
-
|
|
116
|
-
|
|
194
|
+
if [[ "${OMD_UPDATE_BREW_REMOTE_CHANGED}" == "1" ]]; then
|
|
195
|
+
if [[ "${OMD_UPDATE_BREW_LEGACY}" == "1" ]]; then
|
|
196
|
+
rm -rf "${OMD_UPDATE_BREW_PREFIX}/.git" || rollback_failed=1
|
|
197
|
+
elif [[ "${OMD_UPDATE_BREW_REMOTE_PRESENT}" == "1" ]]; then
|
|
198
|
+
git -C "${OMD_UPDATE_BREW_PREFIX}" remote set-url origin "${OMD_UPDATE_BREW_REMOTE}" ||
|
|
199
|
+
rollback_failed=1
|
|
200
|
+
else
|
|
201
|
+
git -C "${OMD_UPDATE_BREW_PREFIX}" remote remove origin ||
|
|
202
|
+
rollback_failed=1
|
|
203
|
+
fi
|
|
117
204
|
fi
|
|
205
|
+
return "${rollback_failed}"
|
|
118
206
|
}
|
|
119
207
|
|
|
120
208
|
omd_update_abort_with_rollback() {
|
|
121
209
|
local message="$1" config_dir="$2" snapshot_dir="$3" rollback_failed=0
|
|
210
|
+
omd_source_config_restore "${snapshot_dir}" || rollback_failed=1
|
|
122
211
|
omd_update_restore_brew_remote || rollback_failed=1
|
|
123
212
|
omd_update_restore_source_config "${config_dir}" "${snapshot_dir}" || rollback_failed=1
|
|
124
213
|
if [[ "${rollback_failed}" == "0" ]]; then
|
|
@@ -128,10 +217,45 @@ omd_update_abort_with_rollback() {
|
|
|
128
217
|
omd_error "${message}; automatic rollback was incomplete; recovery snapshot: ${snapshot_dir}"
|
|
129
218
|
}
|
|
130
219
|
|
|
220
|
+
omd_update_current_source() {
|
|
221
|
+
local config_dir="$1" install_channel="$2" source
|
|
222
|
+
if [[ "${install_channel}" == "npm" ]]; then
|
|
223
|
+
source="${OHMYDEVPOD_NPM_SOURCE:-}"
|
|
224
|
+
if [[ -z "${source}" && -f "${config_dir}/npm-source" ]]; then
|
|
225
|
+
source="$(tr -d '[:space:]' < "${config_dir}/npm-source")"
|
|
226
|
+
fi
|
|
227
|
+
case "${source}" in
|
|
228
|
+
github|gitee)
|
|
229
|
+
printf '%s\n' "${source}"
|
|
230
|
+
return 0
|
|
231
|
+
;;
|
|
232
|
+
*)
|
|
233
|
+
omd_warn "Invalid npm source '${source:-<empty>}'; falling back to GitHub"
|
|
234
|
+
printf 'github\n'
|
|
235
|
+
return 0
|
|
236
|
+
;;
|
|
237
|
+
esac
|
|
238
|
+
fi
|
|
239
|
+
omd_read_saved_source "${config_dir}"
|
|
240
|
+
}
|
|
241
|
+
|
|
242
|
+
omd_update_persist_selected_source() {
|
|
243
|
+
local source="$1" config_dir="$2" configure_source="$3" install_channel="$4"
|
|
244
|
+
if [[ "${install_channel}" == "npm" ]]; then
|
|
245
|
+
omd_persist_source "${source}" "${config_dir}" 0 || return 1
|
|
246
|
+
printf '%s\n' "${source}" |
|
|
247
|
+
omd_atomic_write "${config_dir}/npm-source" ||
|
|
248
|
+
return 1
|
|
249
|
+
return 0
|
|
250
|
+
fi
|
|
251
|
+
omd_persist_source "${source}" "${config_dir}" "${configure_source}"
|
|
252
|
+
}
|
|
253
|
+
|
|
131
254
|
omd_update_main() {
|
|
132
255
|
local requested_source="" current_source update_source current_version latest_tag latest_version
|
|
133
256
|
local target prefix bin_dir cache_dir config_dir archive checksum archive_version installed_version
|
|
134
|
-
local snapshot_dir="" source_changed=0 configure_source=0 manage_source=0
|
|
257
|
+
local snapshot_dir="" source_changed=0 configure_source=0 manage_source=0 source_only=0
|
|
258
|
+
local install_channel="${OHMYDEVPOD_INSTALL_CHANNEL:-bootstrap}"
|
|
135
259
|
|
|
136
260
|
case "$#" in
|
|
137
261
|
0) ;;
|
|
@@ -148,21 +272,33 @@ omd_update_main() {
|
|
|
148
272
|
*) omd_error "Unknown self-update option: $1" ;;
|
|
149
273
|
esac
|
|
150
274
|
;;
|
|
275
|
+
2)
|
|
276
|
+
[[ "$1" == "--source-only" ]] ||
|
|
277
|
+
omd_error "Use only one of --github or --gitee"
|
|
278
|
+
source_only=1
|
|
279
|
+
configure_source=1
|
|
280
|
+
case "$2" in
|
|
281
|
+
--github) requested_source="github" ;;
|
|
282
|
+
--gitee) requested_source="gitee" ;;
|
|
283
|
+
*) omd_error "Source-only switching requires --github or --gitee" ;;
|
|
284
|
+
esac
|
|
285
|
+
;;
|
|
151
286
|
*) omd_error "Use only one of --github or --gitee" ;;
|
|
152
287
|
esac
|
|
153
288
|
|
|
154
289
|
omd_require_linux
|
|
155
|
-
|
|
156
|
-
|
|
157
|
-
|
|
290
|
+
if [[ "${source_only}" != "1" ]]; then
|
|
291
|
+
omd_require_command curl
|
|
292
|
+
omd_require_command tar
|
|
293
|
+
omd_require_command sha256sum
|
|
294
|
+
fi
|
|
158
295
|
|
|
159
|
-
target="$(omd_target_triple)"
|
|
160
296
|
prefix="${OHMYDEVPOD_PREFIX:-${OMD_DEFAULT_PREFIX}}"
|
|
161
297
|
bin_dir="${OHMYDEVPOD_BIN_DIR:-${OMD_DEFAULT_BIN_DIR}}"
|
|
162
298
|
cache_dir="${OHMYDEVPOD_CACHE_DIR:-${OMD_DEFAULT_CACHE_DIR}}"
|
|
163
299
|
config_dir="${OHMYDEVPOD_CONFIG_DIR:-${OMD_DEFAULT_CONFIG_DIR}}"
|
|
164
300
|
current_version="${OHMYDEVPOD_CURRENT_VERSION:-$(tr -d '[:space:]' < "${bundle_root}/VERSION")}"
|
|
165
|
-
current_source="$(
|
|
301
|
+
current_source="$(omd_update_current_source "${config_dir}" "${install_channel}")"
|
|
166
302
|
update_source="${requested_source:-${current_source}}"
|
|
167
303
|
[[ "${current_source}" == "${update_source}" ]] || source_changed=1
|
|
168
304
|
if [[ "${configure_source}" == "1" ]]; then
|
|
@@ -174,40 +310,47 @@ omd_update_main() {
|
|
|
174
310
|
|
|
175
311
|
mkdir -p "${cache_dir}" "$(dirname "${config_dir}")"
|
|
176
312
|
|
|
177
|
-
if [[
|
|
178
|
-
archive="
|
|
179
|
-
|
|
180
|
-
|
|
181
|
-
omd_error "Local archive override requires a checksum file: ${checksum}"
|
|
182
|
-
omd_verify_checksum "${archive}" "${checksum}" ||
|
|
183
|
-
omd_error "Self-update checksum verification failed; current installation and source were preserved"
|
|
184
|
-
latest_tag="$(omd_update_archive_version "${archive}" "${cache_dir}")" ||
|
|
185
|
-
omd_error "Self-update archive validation failed; current installation and source were preserved"
|
|
313
|
+
if [[ "${source_only}" == "1" ]]; then
|
|
314
|
+
archive=""
|
|
315
|
+
printf 'Current source: %s\n' "${current_source}"
|
|
316
|
+
printf 'New source: %s\n' "${update_source}"
|
|
186
317
|
else
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
318
|
+
target="$(omd_target_triple)"
|
|
319
|
+
if [[ -n "${OHMYDEVPOD_OMD_ARCHIVE:-}" ]]; then
|
|
320
|
+
archive="${OHMYDEVPOD_OMD_ARCHIVE}"
|
|
321
|
+
checksum="${OHMYDEVPOD_OMD_CHECKSUM:-${archive}.sha256}"
|
|
322
|
+
[[ -f "${checksum}" ]] ||
|
|
323
|
+
omd_error "Local archive override requires a checksum file: ${checksum}"
|
|
324
|
+
omd_verify_checksum "${archive}" "${checksum}" ||
|
|
325
|
+
omd_error "Self-update checksum verification failed; current installation and source were preserved"
|
|
326
|
+
latest_tag="$(omd_update_archive_version "${archive}" "${cache_dir}")" ||
|
|
327
|
+
omd_error "Self-update archive validation failed; current installation and source were preserved"
|
|
328
|
+
else
|
|
329
|
+
latest_tag="$(omd_resolve_version "${update_source}" "${OHMYDEVPOD_VERSION:-latest}")" ||
|
|
330
|
+
omd_error "Failed to query the latest ${update_source} release; current installation and source were preserved"
|
|
331
|
+
fi
|
|
332
|
+
latest_version="$(omd_update_normalize_version "${latest_tag}")"
|
|
191
333
|
|
|
192
|
-
|
|
193
|
-
|
|
194
|
-
|
|
195
|
-
|
|
334
|
+
printf 'Current version: %s\n' "${current_version}"
|
|
335
|
+
printf 'Current source: %s\n' "${current_source}"
|
|
336
|
+
printf 'Update source: %s\n' "${update_source}"
|
|
337
|
+
printf 'Latest version: %s\n' "${latest_version}"
|
|
196
338
|
|
|
197
|
-
|
|
198
|
-
|
|
199
|
-
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
339
|
+
if [[ "$(omd_update_normalize_version "${current_version}")" != "${latest_version}" ]]; then
|
|
340
|
+
if [[ -z "${OHMYDEVPOD_OMD_ARCHIVE:-}" ]]; then
|
|
341
|
+
OMD_DOWNLOADED_ARCHIVE=""
|
|
342
|
+
OMD_SELECTED_SOURCE=""
|
|
343
|
+
omd_download_release "${update_source}" "${latest_tag}" "${target}" "${cache_dir}" ||
|
|
344
|
+
omd_error "Self-update download or checksum verification failed; current installation and source were preserved"
|
|
345
|
+
archive="${OMD_DOWNLOADED_ARCHIVE}"
|
|
346
|
+
archive_version="$(omd_update_archive_version "${archive}" "${cache_dir}")" ||
|
|
347
|
+
omd_error "Self-update archive validation failed; current installation and source were preserved"
|
|
348
|
+
[[ "$(omd_update_normalize_version "${archive_version}")" == "${latest_version}" ]] ||
|
|
349
|
+
omd_error "Release archive version ${archive_version} does not match ${latest_tag}; current installation and source were preserved"
|
|
350
|
+
fi
|
|
351
|
+
else
|
|
352
|
+
archive=""
|
|
208
353
|
fi
|
|
209
|
-
else
|
|
210
|
-
archive=""
|
|
211
354
|
fi
|
|
212
355
|
|
|
213
356
|
if [[ -n "${archive}" ]]; then
|
|
@@ -228,11 +371,23 @@ omd_update_main() {
|
|
|
228
371
|
rm -rf "${snapshot_dir}"
|
|
229
372
|
omd_error "Could not snapshot source configuration"
|
|
230
373
|
}
|
|
374
|
+
omd_source_config_validate "${update_source}" || {
|
|
375
|
+
rm -rf "${snapshot_dir}"
|
|
376
|
+
omd_error "Installed managed software has user-modified source configuration; current source was preserved"
|
|
377
|
+
}
|
|
378
|
+
omd_source_config_snapshot "${snapshot_dir}" || {
|
|
379
|
+
rm -rf "${snapshot_dir}"
|
|
380
|
+
omd_error "Could not snapshot installed software source configuration"
|
|
381
|
+
}
|
|
231
382
|
omd_update_capture_brew_remote || {
|
|
232
383
|
rm -rf "${snapshot_dir}"
|
|
233
384
|
omd_error "Could not inspect the managed Homebrew remote"
|
|
234
385
|
}
|
|
235
|
-
if !
|
|
386
|
+
if ! omd_update_persist_selected_source \
|
|
387
|
+
"${update_source}" \
|
|
388
|
+
"${config_dir}" \
|
|
389
|
+
"${configure_source}" \
|
|
390
|
+
"${install_channel}"; then
|
|
236
391
|
omd_update_abort_with_rollback "Could not update source configuration" "${config_dir}" "${snapshot_dir}"
|
|
237
392
|
fi
|
|
238
393
|
if ! omd_persist_install_paths "${prefix}" "${bin_dir}" "${cache_dir}" "${config_dir}"; then
|
|
@@ -241,10 +396,25 @@ omd_update_main() {
|
|
|
241
396
|
if ! omd_update_apply_brew_remote "${update_source}"; then
|
|
242
397
|
omd_update_abort_with_rollback "Could not switch the managed Homebrew remote" "${config_dir}" "${snapshot_dir}"
|
|
243
398
|
fi
|
|
399
|
+
if ! omd_source_config_apply "${update_source}"; then
|
|
400
|
+
omd_update_abort_with_rollback "Could not switch installed software source configuration" "${config_dir}" "${snapshot_dir}"
|
|
401
|
+
fi
|
|
402
|
+
fi
|
|
403
|
+
|
|
404
|
+
if [[ "${source_only}" == "1" ]]; then
|
|
405
|
+
[[ -z "${snapshot_dir}" ]] || rm -rf "${snapshot_dir}"
|
|
406
|
+
printf 'Source configuration updated successfully.\n'
|
|
407
|
+
return 0
|
|
244
408
|
fi
|
|
245
409
|
|
|
246
410
|
if [[ -n "${archive}" ]]; then
|
|
247
|
-
if ! installed_version="$(
|
|
411
|
+
if ! installed_version="$(
|
|
412
|
+
omd_update_install_archive \
|
|
413
|
+
"${archive}" \
|
|
414
|
+
"${prefix}" \
|
|
415
|
+
"${bin_dir}" \
|
|
416
|
+
"${cache_dir}"
|
|
417
|
+
)"; then
|
|
248
418
|
if [[ "${manage_source}" == "1" ]]; then
|
|
249
419
|
omd_update_abort_with_rollback "Self-update installation failed" "${config_dir}" "${snapshot_dir}"
|
|
250
420
|
fi
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/lib/common.sh"
|
|
5
|
+
# shellcheck source=../lib/source-config.sh
|
|
6
|
+
source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/lib/source-config.sh"
|
|
5
7
|
|
|
6
8
|
component="micromamba"
|
|
7
9
|
formula="micromamba"
|
|
@@ -14,7 +16,15 @@ install_or_update() {
|
|
|
14
16
|
shift
|
|
15
17
|
omd_module_formula_install_or_update "${component}" "${formula}" "${command_name}" "${action}" "$@"
|
|
16
18
|
}
|
|
17
|
-
uninstall() {
|
|
19
|
+
uninstall() {
|
|
20
|
+
if omd_module_dry_run "$@"; then
|
|
21
|
+
omd_module_formula_uninstall "${component}" "${formula}" "$@"
|
|
22
|
+
return
|
|
23
|
+
fi
|
|
24
|
+
omd_module_formula_uninstall_keep_marker "${component}" "${formula}" "$@" || return
|
|
25
|
+
omd_source_config_remove_component "${component}" || return
|
|
26
|
+
omd_module_unmark_managed "${component}"
|
|
27
|
+
}
|
|
18
28
|
|
|
19
29
|
case "${1:-}" in
|
|
20
30
|
status) status ;;
|
|
@@ -2,6 +2,8 @@
|
|
|
2
2
|
set -euo pipefail
|
|
3
3
|
|
|
4
4
|
source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/lib/common.sh"
|
|
5
|
+
# shellcheck source=../lib/source-config.sh
|
|
6
|
+
source "$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)/lib/source-config.sh"
|
|
5
7
|
|
|
6
8
|
component="uv"
|
|
7
9
|
formula="uv"
|
|
@@ -14,7 +16,15 @@ install_or_update() {
|
|
|
14
16
|
shift
|
|
15
17
|
omd_module_formula_install_or_update "${component}" "${formula}" "${command_name}" "${action}" "$@"
|
|
16
18
|
}
|
|
17
|
-
uninstall() {
|
|
19
|
+
uninstall() {
|
|
20
|
+
if omd_module_dry_run "$@"; then
|
|
21
|
+
omd_module_formula_uninstall "${component}" "${formula}" "$@"
|
|
22
|
+
return
|
|
23
|
+
fi
|
|
24
|
+
omd_module_formula_uninstall_keep_marker "${component}" "${formula}" "$@" || return
|
|
25
|
+
omd_source_config_remove_component "${component}" || return
|
|
26
|
+
omd_module_unmark_managed "${component}"
|
|
27
|
+
}
|
|
18
28
|
|
|
19
29
|
case "${1:-}" in
|
|
20
30
|
status) status ;;
|