Add OS detection; surface version in header; centralise pip installs
lib/common.sh:
- detect_os(): reads /etc/os-release into OS_DISTRO, OS_VERSION,
OS_CODENAME globals (exported, auto-called on source)
- ubuntu_version_ge(): numeric version comparison helper
- pip_user_install(): central wrapper for pip3 install --user so any
future version-specific flags are in one place
setup.sh:
- Both header banners now show detected OS line (e.g., "Ubuntu 24.04 (noble)")
- First-run path warns if not Ubuntu or < 24.04
services/sky-cam.sh, services/sync-cc.sh:
- Replace inline pip3 invocations with pip_user_install helper
https://claude.ai/code/session_01Y4dMKtkqkpvmgDKoRdzhTG
This commit is contained in:
+1
-2
@@ -43,8 +43,7 @@ install_sky-cam() {
|
||||
|
||||
# ── Python packages ──────────────────────────────────────────────────────
|
||||
log_info "Installing Python packages..."
|
||||
local PIP="pip3 install --user --quiet"
|
||||
sudo -u "$ACTUAL_USER" $PIP suntime pytz requests skyfield Pillow numpy scipy \
|
||||
pip_user_install suntime pytz requests skyfield Pillow numpy scipy \
|
||||
|| log_warning "Some pip packages may have failed — check output above"
|
||||
log_success "Python packages installed"
|
||||
|
||||
|
||||
+1
-3
@@ -48,10 +48,8 @@ install_sync-cc() {
|
||||
log_success "System packages installed"
|
||||
|
||||
# ── pip packages ─────────────────────────────────────────────────────────
|
||||
# Install as the actual (non-root) user so packages land in ~/.local
|
||||
log_info "Installing Python packages (openai-whisper, ffsubsync)..."
|
||||
local PIP_CMD="pip3 install --user --quiet openai-whisper ffsubsync"
|
||||
if sudo -u "$ACTUAL_USER" $PIP_CMD; then
|
||||
if pip_user_install openai-whisper ffsubsync; then
|
||||
log_success "Python packages installed"
|
||||
else
|
||||
log_warning "pip install reported errors — the tool may still work if packages were partially installed"
|
||||
|
||||
Reference in New Issue
Block a user