Skip to content
This repository has been archived by the owner on Jan 25, 2023. It is now read-only.

Rebase be39b6d - select yum or apt-get in systemd-resolved #228

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 20 additions & 4 deletions modules/setup-systemd-resolved/setup-systemd-resolved
Original file line number Diff line number Diff line change
Expand Up @@ -67,14 +67,30 @@ function assert_not_empty {
fi
}

function has_yum {
[ -n "$(command -v yum)" ]
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: we follow the Google Bash style guide, so would you mind updating to [[ ]] instead of [ ]?

}

function has_apt_get {
[ -n "$(command -v apt-get)" ]
}

function install_dependencies {
local -r consul_ip="$1"

log_info "Installing dependencies"
sudo apt-get update -y
echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections
sudo apt-get install -y iptables-persistent
if has_apt_get; then
sudo apt-get update -y
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Not related to this PR, but I think we want:

Suggested change
sudo apt-get update -y
sudo DEBIAN_FRONTEND=noninteractive apt-get update -y

Without it, we may occasionally get an interactive prompt here, causing the build to hang on input.

echo iptables-persistent iptables-persistent/autosave_v4 boolean true | sudo debconf-set-selections
echo iptables-persistent iptables-persistent/autosave_v6 boolean true | sudo debconf-set-selections
sudo apt-get install -y iptables-persistent
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

NIT: Not related to this PR, but I think we want:

Suggested change
sudo apt-get install -y iptables-persistent
sudo DEBIAN_FRONTEND=noninteractive apt-get install -y iptables-persistent

Without it, we may occasionally get an interactive prompt here, causing the build to hang on input.

elif has_yum; then
sudo yum update -y
sudo yum install -y iptables-services
else
log_error "Could not find apt-get or yum. Cannot install dependencies on this OS."
exit 1
fi
}

function configure_systemd_resolved {
Expand Down