GV

GeezerVison

The World Wide Web, restored to 800 pixels of glory.

Home|About|Gaming cabinet|Archives|How it works|Starter sites

On this site

  • Sign in
  • ActionsCI/CD and automation
  • CodespacesCloud development environments
  • All Features
  • Documentation
  • Training
  • Certifications
  • Build with Copilot
  • Customize Copilot
  • Integrations
  • Trending repos
  • GitHub Sponsors
  • Developer articles
  • Enterprises

This view

  • Original page
  • New address

GeezerVison is showing github.com — fix(install): restore localpibox package on legacy installs; LPB_BRAN… · lpb-stack/devstack@7cbdb12

File tree

Expand file treeCollapse file tree
Open diff view settings
Filter options
  • scripts
    • install.sh
    • lpb.py
    • test_lpb_selfupdate.py
Expand file treeCollapse file tree
Open diff view settings
Collapse file

‎scripts/install.sh‎

Copy file name to clipboardExpand all lines: scripts/install.sh
+13-9Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,12 @@ set -euo pipefail
1414
INSTALL_DIR="${HOME}/.local/bin"
1515
CONFIG_DIR="${HOME}/.lpb-stack/devstack"
1616
CONFIG_FILE="${CONFIG_DIR}/config"
17-
SCRIPT_URL="https://raw.githubusercontent.com/lpb-stack/devstack/main/scripts/lpb"
17+
# Source branch: main by default. Set LPB_BRANCH=dev to install the dev
18+
# pipeline code (e.g. the unified setup wizard) so the launcher matches
19+
# *-dev images: LPB_BRANCH=dev bash install.sh
20+
OWNER_REPO="lpb-stack/devstack"
21+
BRANCH="${LPB_BRANCH:-main}"
22+
SCRIPT_URL="https://raw.githubusercontent.com/${OWNER_REPO}/${BRANCH}/scripts/lpb"
1823

1924
# 1. Validate prerequisites
2025
for dep in curl; do
@@ -31,29 +36,28 @@ echo "Installing lpb..."
3136
curl -fsSL "${SCRIPT_URL}" -o "${INSTALL_DIR}/lpb"
3237
chmod +x "${INSTALL_DIR}/lpb"
3338
# The shell wrapper execs lpb.py from the same directory.
34-
OWNER_REPO="lpb-stack/devstack"
35-
curl -fsSL "https://raw.githubusercontent.com/${OWNER_REPO}/main/scripts/lpb.py" -o "${INSTALL_DIR}/lpb.py"
39+
curl -fsSL "https://raw.githubusercontent.com/${OWNER_REPO}/${BRANCH}/scripts/lpb.py" -o "${INSTALL_DIR}/lpb.py"
3640
chmod +x "${INSTALL_DIR}/lpb.py"
3741
# Install the canonical env defaults alongside so a plain install picks up
3842
# stack/repo defaults (a fork's lpb.py loads these via CONFIG_DIR fallback).
39-
curl -fsSL "https://raw.githubusercontent.com/${OWNER_REPO}/main/lpb.stack.env" -o "${CONFIG_DIR}/lpb.stack.env"
40-
curl -fsSL "https://raw.githubusercontent.com/${OWNER_REPO}/main/lpb.conf.env" -o "${CONFIG_DIR}/lpb.conf.env"
43+
curl -fsSL "https://raw.githubusercontent.com/${OWNER_REPO}/${BRANCH}/lpb.stack.env" -o "${CONFIG_DIR}/lpb.stack.env"
44+
curl -fsSL "https://raw.githubusercontent.com/${OWNER_REPO}/${BRANCH}/lpb.conf.env" -o "${CONFIG_DIR}/lpb.conf.env"
4145
# Installed VERSION file (source for `lpb --version`; refreshed by self-update)
42-
curl -fsSL "https://raw.githubusercontent.com/${OWNER_REPO}/main/VERSION" -o "${CONFIG_DIR}/VERSION"
46+
curl -fsSL "https://raw.githubusercontent.com/${OWNER_REPO}/${BRANCH}/VERSION" -o "${CONFIG_DIR}/VERSION"
4347

4448
# 3b. Stack tools (config repo manager + devstack DevOps tool) and the shared
4549
# localpibox package they import (resolved via ~/.lpb-stack/devstack/).
4650
echo "Installing lpb-config + lpb-devstack..."
4751
for tool in lpb-config lpb-devstack; do
48-
curl -fsSL "https://raw.githubusercontent.com/${OWNER_REPO}/main/scripts/${tool}" -o "${INSTALL_DIR}/${tool}"
52+
curl -fsSL "https://raw.githubusercontent.com/${OWNER_REPO}/${BRANCH}/scripts/${tool}" -o "${INSTALL_DIR}/${tool}"
4953
chmod +x "${INSTALL_DIR}/${tool}"
5054
done
5155
mkdir -p "${CONFIG_DIR}/localpibox/stack"
5256
for f in __init__.py cli.py env.py log.py run.py setup.py; do
53-
curl -fsSL "https://raw.githubusercontent.com/${OWNER_REPO}/main/scripts/localpibox/${f}" -o "${CONFIG_DIR}/localpibox/${f}"
57+
curl -fsSL "https://raw.githubusercontent.com/${OWNER_REPO}/${BRANCH}/scripts/localpibox/${f}" -o "${CONFIG_DIR}/localpibox/${f}"
5458
done
5559
for f in __init__.py gitutil.py repos.py version.py workspace.py validate.py release.py; do
56-
curl -fsSL "https://raw.githubusercontent.com/${OWNER_REPO}/main/scripts/localpibox/stack/${f}" -o "${CONFIG_DIR}/localpibox/stack/${f}"
60+
curl -fsSL "https://raw.githubusercontent.com/${OWNER_REPO}/${BRANCH}/scripts/localpibox/stack/${f}" -o "${CONFIG_DIR}/localpibox/stack/${f}"
5761
done
5862

5963
# 4. Add to PATH if needed (warn only, don't modify shell configs)
Collapse file

‎scripts/lpb.py‎

Copy file name to clipboardExpand all lines: scripts/lpb.py
+13-7Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -416,11 +416,14 @@ def _discover_ssh_pubkeys(ssh_dir: Path | None = None) -> list[Path]:
416416

417417

418418
def _fetch_file(url: str, dest: Path, staging: Path) -> None:
419-
"""Download url and atomically replace dest if the content changed."""
419+
"""Download url and atomically replace dest if the content changed.
420+
421+
A missing dest is treated as "content changed" — self-update uses this to
422+
install files the original (pre-package) install.sh never laid down.
423+
"""
420424
with urllib.request.urlopen(url, timeout=10) as resp:
421425
new_data = resp.read()
422-
with open(dest, "rb") as f:
423-
old_data = f.read()
426+
old_data = dest.read_bytes() if dest.is_file() else None
424427
if new_data == old_data:
425428
return
426429
info(f"Updating {dest.name}...")
@@ -442,7 +445,10 @@ def self_update() -> None:
442445
443446
Also refreshes lpb-config / lpb-devstack + the localpibox package under
444447
CONFIG_DIR so the host-side setup wizard (lpb setup / lpb doctor) stays
445-
in sync with the engine — mirroring scripts/install.sh.
448+
in sync with the engine — mirroring scripts/install.sh. The localpibox
449+
package is installed unconditionally (legacy installs predate it and the
450+
engine's wizard import depends on it); the standalone tools are only
451+
refreshed when already present.
446452
"""
447453
engine_path = LPB_ENGINE_PATH
448454
if not engine_path.is_file():
@@ -471,9 +477,9 @@ def self_update() -> None:
471477
}
472478
for rel, files in localpibox_dirs.items():
473479
pkg_dir = CONFIG_DIR / rel
474-
if pkg_dir.is_dir():
475-
for f in files:
476-
_fetch_file(base_url + rel + "/" + f, pkg_dir / f, staging)
480+
pkg_dir.mkdir(parents=True, exist_ok=True)
481+
for f in files:
482+
_fetch_file(base_url + rel + "/" + f, pkg_dir / f, staging)
477483
# Keep the installed VERSION file in sync (best effort —
478484
# `lpb --version` reads it; only present in install.sh installs)
479485
version_dest = CONFIG_DIR / "VERSION"
Collapse file

‎scripts/test_lpb_selfupdate.py‎

Copy file name to clipboardExpand all lines: scripts/test_lpb_selfupdate.py
+9-2Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,13 +79,19 @@ def test_self_update_branch_selection():
7979
("0.0.27-lpb", "main"), # versioned stable pin
8080
("", "main"), # no tag → main (install default)
8181
]
82+
# engine + wrapper + 13 localpibox package files (+ trailing VERSION fetch)
8283
for tag, expected_branch in cases:
8384
with tempfile.TemporaryDirectory() as td:
8485
fetched = _run_self_update(mod, tag, td)
8586
expect = f"https://raw.githubusercontent.com/lpb-stack/devstack/{expected_branch}/scripts/"
86-
assert len(fetched) == 2, f"tag={tag!r}: expected 2 fetches, got {fetched}"
87+
non_version = [u for u in fetched if not u.endswith("/VERSION")]
88+
assert len(non_version) == 2 + 13, \
89+
f"tag={tag!r}: expected 15 script fetches, got {len(non_version)}: {non_version}"
8790
assert fetched[0] == expect + "lpb.py", f"tag={tag!r}: engine URL wrong: {fetched[0]}"
8891
assert fetched[1] == expect + "lpb", f"tag={tag!r}: wrapper URL wrong: {fetched[1]}"
92+
# every fetch (incl. the localpibox package) must come from the right branch
93+
assert all(u.startswith(expect) for u in non_version), \
94+
f"tag={tag!r}: off-branch fetch: {[u for u in non_version if not u.startswith(expect)]}"
8995
print(" PASS\n")
9096

9197

@@ -117,7 +123,8 @@ def test_self_update_no_wrapper():
117123
_run_self_update(mod, "dev", td)
118124
(_P(td) / "lpb").unlink()
119125
fetched = _run_self_update(mod, "dev", td, create_wrapper=False)
120-
assert len(fetched) == 1, f"expected engine-only fetch, got {fetched}"
126+
# engine only (+ the 13 localpibox package files, re-fetched on run 2, + VERSION)
127+
assert len(fetched) == 1 + 13 + 1, f"expected engine-only fetch, got {len(fetched)}: {fetched}"
121128
assert ( _P(td) / "lpb.py" ).read_text().startswith("NEW-CONTENT-")
122129
print(" PASS\n")
123130

0 commit comments

Comments
0 (0)
You are visitor 01402520 — GeezerVison does not store the pages you look up.
Best viewed with Netscape Navigator 4.7 or Internet Explorer 6 at 800×600. No cookies required.