Files
connector-popos/configure.d/lib/packages.sh
T
davidandClaude Opus 5.5 b609252e1c Pin srt to a tested version; support only Pop!_OS 26.04 and later
srt is pinned to 0.0.83, the version the smoketest passed with. A computer
with another version sees the agents item as to do in configure, which
installs the pinned one. Move the pin only after smoketest/run 50 80 passes.

The installer and configure stop on Pop!_OS (or Ubuntu) older than 26.04.
The smoketest builds on Ubuntu 26.04, with checks that 24.04 is refused.
26.04's own AppArmor profile lets bubblewrap make user namespaces, so the
connector's profile for it, and the code that offered to add it, are gone.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-28 20:49:54 -07:00

70 lines
2.1 KiB
Bash

#!/bin/bash
#
# Purpose : Install what an item needs from Pop!_OS' and Ubuntu's apt
# repositories, and from Flathub. Source this file; it uses
# confirm_yes from configure.
#
# Pop!_OS comes with less than CoreDesktop installs up front, so each item
# installs what it needs the first time you set it up, after asking.
is_pop() {
[ "$(. /etc/os-release 2> /dev/null && echo "$ID")" = pop ]
}
# Pop!_OS (or Ubuntu) older than 26.04, which the connector no longer supports
os_too_old() {
local id version
id="$(. /etc/os-release 2> /dev/null && echo "$ID")"
version="$(. /etc/os-release 2> /dev/null && echo "$VERSION_ID")"
case "$id" in pop|ubuntu) ;; *) return 1 ;; esac
[ -n "$version" ] && [ "$(printf '%s\n' 26.04 "$version" | sort -V | head -n 1)" != 26.04 ]
}
os_name() {
(. /etc/os-release 2> /dev/null && echo "${PRETTY_NAME:-$ID}") || uname -s
}
# True if every package named is installed
pkg_installed() {
local pkg
for pkg in "$@"; do
[ "$(dpkg-query -W -f '${db:Status-Status}' "$pkg" 2> /dev/null)" = installed ] || return 1
done
}
# pkg_ensure <what they're for> <package>...: offer to install the packages
# that are missing. Fails if any is still missing.
pkg_ensure() {
local why="$1" pkg missing=()
shift
for pkg in "$@"; do
pkg_installed "$pkg" || missing+=("$pkg")
done
[ ${#missing[@]} -eq 0 ] && return 0
echo "$why needs: ${missing[*]}"
confirm_yes "Install them now (with apt; asks for your password)?" || return 1
pkg_install "${missing[@]}"
}
# Install packages without asking. apt's lists may be old on a new install,
# so they're refreshed once per run if the install fails.
pkg_install() {
sudo apt-get install -y "$@" && return 0
[ -n "$PKG_UPDATED" ] && return 1
PKG_UPDATED=1
sudo apt-get update && sudo apt-get install -y "$@"
}
# Flatpak apps come from Flathub, as in the COSMIC Store
flatpak_installed() {
flatpak info "$1" &> /dev/null
}
# flatpak_ensure <app id> <name> <what it's for>
flatpak_ensure() {
flatpak_installed "$1" && return 0
echo "$2 isn't installed. $3"
confirm_yes "Install $2 from Flathub?" || return 1
flatpak install -y --noninteractive flathub "$1"
}