oh-my-devpod 0.15.0 → 0.15.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.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "oh-my-devpod",
3
- "version": "0.15.0",
3
+ "version": "0.15.1",
4
4
  "description": "Ubuntu productivity tool manager with the omd terminal interface",
5
5
  "license": "MIT",
6
6
  "author": "zhangdw156",
package/runtime/VERSION CHANGED
@@ -1 +1 @@
1
- 0.15.0
1
+ 0.15.1
package/runtime/bin/omd CHANGED
Binary file
@@ -421,16 +421,8 @@ omd_source_brew_core_remote() {
421
421
  }
422
422
 
423
423
  omd_activate_shared_linuxbrew_profile_if_present() {
424
- local release_root="$1" profile="$2" helper prefix state_dir
424
+ local release_root="$1" profile="$2" helper
425
425
  helper="${release_root}/modules/lib/shared-linuxbrew.sh"
426
- if [[ "${OHMYDEVPOD_SHARED_BREW_TEST_MODE:-0}" == "1" ]]; then
427
- prefix="${OHMYDEVPOD_SHARED_BREW_PREFIX:-/home/linuxbrew/.linuxbrew}"
428
- state_dir="${OHMYDEVPOD_SHARED_BREW_STATE_DIR:-/var/lib/oh-my-devpod/linuxbrew}"
429
- else
430
- prefix="/home/linuxbrew/.linuxbrew"
431
- state_dir="/var/lib/oh-my-devpod/linuxbrew"
432
- fi
433
- [[ -e "${prefix}" || -L "${prefix}" || -e "${state_dir}/manifest" || -L "${state_dir}/manifest" ]] || return 0
434
426
  [[ -f "${helper}" && ! -L "${helper}" ]] || {
435
427
  omd_warn "Installed release cannot activate the existing shared Linuxbrew installation"
436
428
  return 1
@@ -43,6 +43,38 @@ omd_shared_linuxbrew_state_claim_present() {
43
43
  [[ -e "${manifest}" || -L "${manifest}" ]]
44
44
  }
45
45
 
46
+ omd_shared_linuxbrew_legacy_marker() {
47
+ local prefix owner_uid owner_home=""
48
+ prefix="$(omd_shared_linuxbrew_prefix)"
49
+ if omd_shared_linuxbrew_test_mode; then
50
+ owner_home="${OHMYDEVPOD_SHARED_BREW_TEST_LEGACY_HOME:-${HOME}}"
51
+ else
52
+ owner_uid="$(omd_shared_linuxbrew_stat_uid "${prefix}")" || return 1
53
+ if command -v getent >/dev/null 2>&1; then
54
+ owner_home="$(getent passwd "${owner_uid}" 2>/dev/null | awk -F: '{print $6}')"
55
+ elif [[ "$(id -u)" == "${owner_uid}" ]]; then
56
+ owner_home="${HOME}"
57
+ fi
58
+ fi
59
+ [[ "${owner_home}" == /* && -d "${owner_home}" && ! -L "${owner_home}" ]] || return 1
60
+ printf '%s/.local/state/oh-my-devpod/managed/linuxbrew\n' "${owner_home}"
61
+ }
62
+
63
+ omd_shared_linuxbrew_activation_candidate() {
64
+ local prefix marker
65
+ if omd_shared_linuxbrew_state_claim_present; then
66
+ return 0
67
+ fi
68
+ prefix="$(omd_shared_linuxbrew_prefix)"
69
+ [[ -e "${prefix}" || -L "${prefix}" ]] || return 1
70
+ marker="$(omd_shared_linuxbrew_legacy_marker)"
71
+ [[ -f "${marker}" && ! -L "${marker}" ]] || return 1
72
+ grep -Fqx 'managed_by=oh-my-devpod' "${marker}" || return 1
73
+ grep -Fqx 'component=linuxbrew' "${marker}" || return 1
74
+ grep -Fqx 'kind=directory' "${marker}" || return 1
75
+ grep -Fqx "artifact=${prefix}" "${marker}"
76
+ }
77
+
46
78
  omd_shared_linuxbrew_enabled() {
47
79
  [[ "${OHMYDEVPOD_SHARED_BREW_DISABLE:-0}" != "1" ]]
48
80
  }
@@ -233,10 +265,8 @@ omd_shared_linuxbrew_set_profile() {
233
265
  }
234
266
 
235
267
  omd_shared_linuxbrew_activate_if_present() {
236
- local bundle_root="$1" mirror_profile="${2:-upstream}" prefix manifest
268
+ local bundle_root="$1" mirror_profile="${2:-upstream}"
237
269
  omd_shared_linuxbrew_enabled || return 0
238
- prefix="$(omd_shared_linuxbrew_prefix)"
239
- manifest="$(omd_shared_linuxbrew_manifest)"
240
- [[ -e "${prefix}" || -L "${prefix}" || -e "${manifest}" || -L "${manifest}" ]] || return 0
270
+ omd_shared_linuxbrew_activation_candidate || return 0
241
271
  omd_shared_linuxbrew_provision "${bundle_root}" "${mirror_profile}"
242
272
  }