From 3c27adb33746c295ca611b2eb82e1d8177475b44 Mon Sep 17 00:00:00 2001 From: librelad Date: Thu, 25 Jun 2026 12:43:50 +0100 Subject: [PATCH] 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 Signed-off-by: librelad --- .../install/rootless/rootless_docker.sh | 32 ++++++------------- 1 file changed, 9 insertions(+), 23 deletions(-) diff --git a/scripts/docker/install/rootless/rootless_docker.sh b/scripts/docker/install/rootless/rootless_docker.sh index bc244bc..ecdbf65 100755 --- a/scripts/docker/install/rootless/rootless_docker.sh +++ b/scripts/docker/install/rootless/rootless_docker.sh @@ -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..." - 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 + # 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" + # `slirp4netns --version` prints several lines (version, commit, libslirp, + # 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++))