Compare commits

..

No commits in common. "1f0215631839a5e3516dac26ce4e5ed5b475b26c" and "46eb1bedfdabe633aa4f1eb979097dbf66804b71" have entirely different histories.

View File

@ -28,15 +28,29 @@ installDockerRootless()
echo "---- $menu_number. Installing slirp4netns."
echo ""
# 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.
# 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, field 3 is the number.
installed_version=$(slirp4netns --version 2>/dev/null | head -n1 | awk '{print $3}')
isSuccessful "slirp4netns ${installed_version:-installed} is ready"
# 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
if [[ $(lsb_release -rs) == "10" ]]; then
((menu_number++))