refactor(docker/rootless): just ensure slirp4netns via apt
Drop the GitHub-release version comparison entirely. We install slirp4netns from apt regardless, so comparing against the GitHub-latest tag only produced a perpetual 'outdated' loop and a no-op re-install. apt-get install -y is already idempotent, so run it unconditionally and report the resulting version. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com> Signed-off-by: librelad <librelad@digitalangels.vip>
This commit is contained in:
parent
46eb1bedfd
commit
3c27adb337
@ -28,29 +28,15 @@ installDockerRootless()
|
||||
echo "---- $menu_number. Installing slirp4netns."
|
||||
echo ""
|
||||
|
||||
# slirp4netns update and install
|
||||
if ! command -v slirp4netns &> /dev/null; then
|
||||
isNotice "slirp4netns is not installed. Installing..."
|
||||
# slirp4netns — ensure it's installed via apt (idempotent: installs if missing,
|
||||
# no-op if already present). We install from apt, so there's no point chasing the
|
||||
# GitHub-latest release.
|
||||
local result; result=$(runSystem apt-get install -y slirp4netns)
|
||||
checkSuccess "Installing slirp4netns"
|
||||
else
|
||||
isNotice "slirp4netns is already installed"
|
||||
# `slirp4netns --version` prints several lines (version, commit, libslirp,
|
||||
# SLIRP_CONFIG_VERSION_MAX); read only the first line and take the version field.
|
||||
installed_version=$(slirp4netns --version | head -n1 | awk '{print $3}')
|
||||
latest_version=$(curl -s https://api.github.com/repos/rootless-containers/slirp4netns/releases/latest | grep tag_name | cut -d '"' -f 4)
|
||||
latest_version=${latest_version#v} # GitHub tags are vX.Y.Z; strip the v to compare
|
||||
if [[ -n "$latest_version" && "$installed_version" != "$latest_version" ]]; then
|
||||
isNotice "slirp4netns version $installed_version is outdated."
|
||||
isNotice "Installing version $latest_version..."
|
||||
local result; result=$(runSystem apt-get update)
|
||||
checkSuccess "Updating apt packages"
|
||||
local result; result=$(runSystem apt-get install -y slirp4netns)
|
||||
checkSuccess "Installing slirp4netns"
|
||||
else
|
||||
isSuccessful "slirp4netns version $installed_version is up to date"
|
||||
fi
|
||||
fi
|
||||
# SLIRP_CONFIG_VERSION_MAX); read only the first line, field 3 is the number.
|
||||
installed_version=$(slirp4netns --version 2>/dev/null | head -n1 | awk '{print $3}')
|
||||
isSuccessful "slirp4netns ${installed_version:-installed} is ready"
|
||||
|
||||
if [[ $(lsb_release -rs) == "10" ]]; then
|
||||
((menu_number++))
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user