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

Skip package update with args #242

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
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
15 changes: 12 additions & 3 deletions modules/install-consul/install-consul
Original file line number Diff line number Diff line change
Expand Up @@ -118,13 +118,18 @@ function has_apt_get {
}

function install_dependencies {
local -r skip_package_update="$1"
log_info "Installing dependencies"

if has_apt_get; then
sudo apt-get update -y
if [[ "$skip_package_update" == "false" ]]; then
sudo apt-get update -y
fi
sudo apt-get install -y awscli curl unzip jq
elif has_yum; then
sudo yum update -y
if [[ "$skip_package_update" == "false" ]]; then
sudo yum update -y
fi
sudo yum install -y aws curl unzip jq
else
log_error "Could not find apt-get or yum. Cannot install dependencies on this OS."
Expand Down Expand Up @@ -274,6 +279,7 @@ function install {
local ca_file_path=""
local cert_file_path=""
local key_file_path=""
local skip_package_update="false"

while [[ $# -gt 0 ]]; do
local key="$1"
Expand Down Expand Up @@ -310,6 +316,9 @@ function install {
key_file_path="$2"
shift
;;
--skip-package-update)
skip_package_update="true"
;;
--help)
print_usage
exit
Expand All @@ -330,7 +339,7 @@ function install {

log_info "Starting Consul install"

install_dependencies
install_dependencies "$skip_package_update"
create_consul_user "$user"
create_consul_install_paths "$path" "$user"

Expand Down
15 changes: 12 additions & 3 deletions modules/install-dnsmasq/install-dnsmasq
Original file line number Diff line number Diff line change
Expand Up @@ -78,14 +78,19 @@ function has_apt_get {

function install_dnsmasq {
local -r consul_ip="$1"
local -r skip_package_update="$2"

log_info "Installing Dnsmasq"

if has_apt_get; then
sudo apt-get update -y
if [[ "$skip_package_update" == "false" ]]; then
sudo apt-get update -y
fi
sudo apt-get install -y dnsmasq
elif has_yum; then
sudo yum update -y
if [[ "$skip_package_update" == "false" ]]; then
sudo yum update -y
fi
sudo yum install -y dnsmasq
echo "prepend domain-name-servers $consul_ip;" | sudo tee -a "/etc/dhcp/dhclient.conf" > /dev/null
echo "conf-dir=$DNS_MASQ_CONFIG_DIR" | sudo tee -a "/etc/dnsmasq.conf" > /dev/null
Expand Down Expand Up @@ -119,6 +124,7 @@ function install {
local consul_ip="$DEFAULT_CONSUL_IP"
local consul_dns_port="$DEFAULT_CONSUL_DNS_PORT"
local dnsmasq_listen_address="$DEFAULT_DNSMASQ_LISTEN_ADDRESS"
local skip_package_update="false"

while [[ $# -gt 0 ]]; do
local key="$1"
Expand All @@ -144,6 +150,9 @@ function install {
dnsmasq_listen_address="$2"
shift
;;
--skip-package-update)
skip_package_update="true"
;;
--help)
print_usage
exit
Expand All @@ -163,7 +172,7 @@ function install {
fi

log_info "Starting Dnsmasq install"
install_dnsmasq "$consul_ip"
install_dnsmasq "$consul_ip" "$skip_package_update"
write_consul_config "$consul_domain" "$consul_ip" "$consul_dns_port" "$dnsmasq_listen_address"
log_info "Dnsmasq install complete!"
}
Expand Down