oh-my-devpod 0.15.4 → 0.15.6
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 +1 -1
- package/runtime/VERSION +1 -1
- package/runtime/bin/omd +0 -0
- package/runtime/build/omd-brew-provisioner.sh +43 -19
package/package.json
CHANGED
package/runtime/VERSION
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
0.15.
|
|
1
|
+
0.15.6
|
package/runtime/bin/omd
CHANGED
|
Binary file
|
|
@@ -501,32 +501,55 @@ write_inventory_record() {
|
|
|
501
501
|
mv -f "${temporary}" "${destination}"
|
|
502
502
|
}
|
|
503
503
|
|
|
504
|
-
legacy_formula_is_managed() {
|
|
505
|
-
local owner_home="$1" formula="$2" marker
|
|
506
|
-
marker="${owner_home}/.local/state/oh-my-devpod/managed/${formula}"
|
|
507
|
-
[[ -f "${marker}" && ! -L "${marker}" ]] || return 1
|
|
508
|
-
grep -qx 'managed_by=oh-my-devpod' "${marker}" || return 1
|
|
509
|
-
grep -qx 'kind=brew-formula' "${marker}" || return 1
|
|
510
|
-
grep -Fqx "artifact=${formula}" "${marker}" || return 1
|
|
511
|
-
grep -Fqx "brew_prefix=${prefix}" "${marker}" || return 1
|
|
512
|
-
}
|
|
513
|
-
|
|
514
504
|
stage_legacy_inventory() {
|
|
515
|
-
local
|
|
505
|
+
local installation_id="$1" staging="$2" formula
|
|
516
506
|
mkdir -p "${staging}"
|
|
517
507
|
[[ -d "${prefix}/Cellar" ]] || return 0
|
|
518
508
|
while IFS= read -r formula; do
|
|
519
509
|
[[ -n "${formula}" ]] || continue
|
|
520
|
-
|
|
521
|
-
provenance=legacy-preexisting
|
|
522
|
-
if legacy_formula_is_managed "${owner_home}" "${formula}"; then
|
|
523
|
-
state=managed
|
|
524
|
-
provenance=legacy-marker
|
|
525
|
-
fi
|
|
526
|
-
write_inventory_record "${formula}" "${installation_id}" "${state}" "${provenance}" "${staging}/${formula}"
|
|
510
|
+
write_inventory_record "${formula}" "${installation_id}" managed legacy-managed-prefix "${staging}/${formula}"
|
|
527
511
|
done < <(find "${prefix}/Cellar" -mindepth 1 -maxdepth 1 -type d -exec basename {} \; | LC_ALL=C sort -u)
|
|
528
512
|
}
|
|
529
513
|
|
|
514
|
+
legacy_inventory_record_is_recoverable() {
|
|
515
|
+
local record="$1" formula="$2" installation_id="$3" service_uid="$4" service_gid="$5" mode
|
|
516
|
+
[[ -f "${record}" && ! -L "${record}" ]] || return 1
|
|
517
|
+
if [[ "${test_mode}" != "1" ]]; then
|
|
518
|
+
[[ "$(stat_uid "${record}")" == "${service_uid}" && "$(stat_gid "${record}")" == "${service_gid}" ]] || return 1
|
|
519
|
+
mode="$(stat_mode "${record}")" || return 1
|
|
520
|
+
[[ "${mode}" =~ ^[0-7]{3,4}$ ]] || return 1
|
|
521
|
+
(( (8#${mode} & 8#022) == 0 )) || return 1
|
|
522
|
+
fi
|
|
523
|
+
grep -qx 'managed_by=oh-my-devpod' "${record}" || return 1
|
|
524
|
+
grep -Fqx "component=${formula}" "${record}" || return 1
|
|
525
|
+
grep -qx 'kind=brew-formula' "${record}" || return 1
|
|
526
|
+
grep -Fqx "artifact=${formula}" "${record}" || return 1
|
|
527
|
+
grep -Fqx "brew_prefix=${prefix}" "${record}" || return 1
|
|
528
|
+
grep -Fqx "installation_id=${installation_id}" "${record}" || return 1
|
|
529
|
+
grep -qx 'state=external' "${record}" || return 1
|
|
530
|
+
grep -qx 'provenance=legacy-preexisting' "${record}"
|
|
531
|
+
}
|
|
532
|
+
|
|
533
|
+
recover_legacy_inventory() {
|
|
534
|
+
local installation_id service_uid service_gid record formula recovered
|
|
535
|
+
installation_id="$(manifest_value installation_id || true)"
|
|
536
|
+
[[ -n "${installation_id}" ]] || return 0
|
|
537
|
+
service_uid="$(account_uid "${service_user}")"
|
|
538
|
+
service_gid="$(group_gid "${manager_group}")"
|
|
539
|
+
while IFS= read -r -d '' record; do
|
|
540
|
+
formula="$(basename "${record}")"
|
|
541
|
+
valid_formula_name "${formula}" || continue
|
|
542
|
+
legacy_inventory_record_is_recoverable "${record}" "${formula}" "${installation_id}" "${service_uid}" "${service_gid}" || continue
|
|
543
|
+
recovered="${inventory_dir}/.${formula}.recovered.$$"
|
|
544
|
+
write_inventory_record "${formula}" "${installation_id}" managed legacy-managed-prefix-recovered "${recovered}"
|
|
545
|
+
chmod 0644 "${recovered}"
|
|
546
|
+
if [[ "${test_mode}" != "1" ]]; then
|
|
547
|
+
chown "${service_uid}:${service_gid}" "${recovered}"
|
|
548
|
+
fi
|
|
549
|
+
mv -f "${recovered}" "${record}"
|
|
550
|
+
done < <(find "${inventory_dir}" -mindepth 1 -maxdepth 1 -type f -print0)
|
|
551
|
+
}
|
|
552
|
+
|
|
530
553
|
write_manifest() {
|
|
531
554
|
local mirror_profile="$1" installation_id="$2" service_uid="$3" service_gid="$4" destination="$5" resolved_prefix
|
|
532
555
|
resolved_prefix="$(trusted_prefix_resolved "${prefix}")" || fail "shared Brew prefix path is not trusted"
|
|
@@ -593,7 +616,7 @@ initialize_shared_state() {
|
|
|
593
616
|
if [[ -e "${prefix}" || -L "${prefix}" ]]; then
|
|
594
617
|
legacy_info="$(validate_legacy_prefix)"
|
|
595
618
|
IFS=$'\t' read -r legacy_owner legacy_uid legacy_gid legacy_home <<< "${legacy_info}"
|
|
596
|
-
stage_legacy_inventory "${
|
|
619
|
+
stage_legacy_inventory "${installation_id}" "${inventory_staging}"
|
|
597
620
|
else
|
|
598
621
|
created_prefix=1
|
|
599
622
|
if ! initialize_prefix "${mirror_profile}"; then
|
|
@@ -844,6 +867,7 @@ ensure_shared_brew() {
|
|
|
844
867
|
fi
|
|
845
868
|
rm -f "${state_dir}/.legacy-owner"
|
|
846
869
|
fi
|
|
870
|
+
recover_legacy_inventory
|
|
847
871
|
}
|
|
848
872
|
|
|
849
873
|
case "${1:-}" in
|