-
Notifications
You must be signed in to change notification settings - Fork 37
Rhel distributions #149
base: develop
Are you sure you want to change the base?
Rhel distributions #149
Changes from 3 commits
0a20fe7
fc8653d
9c99bd7
6b91a08
6be6c20
6426bcd
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -26,6 +26,7 @@ DRUDE_COMMANDS_PATH=".drude/commands" | |
# Network settings | ||
DRUDE_IP="192.168.10.10" | ||
DRUDE_SUBNET="192.168.10.1/24" | ||
DRUDE_SUBNET_RHEL="192.168.10.1" | ||
DRUDE_DEFAULT_DNS="8.8.8.8" | ||
DRUDE_VBOX_DNS="10.0.2.3" | ||
|
||
|
@@ -869,7 +870,7 @@ install_prerequisites () | |
bash <(echo "$presetup_script") | ||
read -p "Press enter after the installation in another console window is done..." | ||
elif is_linux ; then | ||
install_ubuntu | ||
install_linux | ||
else # mac | ||
local presetup_script | ||
presetup_script=$(curl -fsS https://raw.githubusercontent.com/blinkreaction/boot2docker-vagrant/$B2D_BRANCH/scripts/presetup-mac.sh) | ||
|
@@ -912,22 +913,79 @@ install_sshagent_service () | |
"blinkreaction/ssh-agent:${DRUDE_ITAG}" >/dev/null 2>&1 | ||
} | ||
|
||
install_subnet_ubuntu () | ||
{ | ||
# Make sure we don't do this twice | ||
if ! grep -q $DRUDE_SUBNET /etc/network/interfaces; then | ||
cat > /tmp/drude.ip.addr <<EOF | ||
up ip addr add $DRUDE_SUBNET dev lo label lo:drude | ||
down ip addr del $DRUDE_SUBNET dev lo label lo:drude | ||
EOF | ||
sudo sed -i '/iface lo inet loopback/r /tmp/drude.ip.addr' /etc/network/interfaces | ||
rm -f /tmp/drude.ip.addr | ||
sudo ifdown lo && sudo ifup lo | ||
fi | ||
} | ||
|
||
install_subnet_rhel () | ||
{ | ||
# Make sure we don't do this twice | ||
interface="/etc/sysconfig/network-scripts/ifcfg-lo:drude" | ||
# Make sure we don't do this twice. | ||
if [ ! -f $interface ]; then | ||
sudo touch $interface | ||
sudo chmod 0777 $interface | ||
sudo cat > $interface << EOF | ||
DEVICE=lo:drude | ||
NAME=lo:drude | ||
NM_CONTROLLED=yes | ||
TYPE=Loopback | ||
IPADDR=$DRUDE_SUBNET_RHEL | ||
NETMASK=255.255.255.0 | ||
ONBOOT=yes | ||
PEERDNS=yes | ||
DNS=$DRUDE_IP | ||
EOF | ||
sudo chmod 0655 $interface | ||
sudo ifdown lo:drude && sudo ifup lo:drude | ||
fi | ||
} | ||
|
||
is_redhat() | ||
{ | ||
if [[ -r /etc/redhat-release || -r /etc/gentoo-release || -r /etc/gentoo-release ]]; then | ||
return 0 | ||
else | ||
return 1 | ||
fi | ||
} | ||
|
||
# Install Docker and setup Drude on Ubuntu 14.04+ | ||
install_ubuntu () | ||
install_linux () | ||
{ | ||
if [ -r /etc/lsb-release ]; then | ||
lsb_dist="$(. /etc/lsb-release && echo "$DISTRIB_ID")" | ||
lsb_release="$(. /etc/lsb-release && echo "$DISTRIB_RELEASE")" | ||
fi | ||
|
||
if [[ $lsb_dist != 'Ubuntu' || $(ver_to_int $lsb_release) < $(ver_to_int '14.04') ]]; then | ||
if [[ $lsb_dist == 'Ubuntu' && $(ver_to_int $lsb_release) < $(ver_to_int '14.04') ]]; then | ||
echo-red "dsh: prerequisites installation is currently supported only on Ubuntu 14.04+" | ||
if is_tty; then | ||
echo-yellow "You can continue at your own risk, if you know your Linux distribution is compatible with Ubuntu 14.04+" | ||
_confirm "Are you sure you want to continue?" | ||
else | ||
exit 1 | ||
fi | ||
else | ||
if is_redhat; then | ||
echo-red "dsh: prerequisites installation for RHEL Family is tested on Fedora (22, 23), RHEL (6.8, 7.2), CentOS(7)" | ||
if is_tty; then | ||
echo-yellow "You can continue at your own risk, if you know your Linux distribution is compatible with previously declared distributions" | ||
_confirm "Are you sure you want to continue?" | ||
else | ||
exit 1 | ||
fi | ||
fi | ||
fi | ||
|
||
echo-green "Installing Docker..." | ||
|
@@ -949,17 +1007,13 @@ install_ubuntu () | |
if_failed "Docker Compose installation/upgrade has failed." | ||
|
||
echo-green "Adding a subnet for Drude..." | ||
# Make sure we don't do this twice | ||
if ! grep -q $DRUDE_SUBNET /etc/network/interfaces; then | ||
cat > /tmp/drude.ip.addr <<EOF | ||
up ip addr add $DRUDE_SUBNET dev lo label lo:drude | ||
down ip addr del $DRUDE_SUBNET dev lo label lo:drude | ||
EOF | ||
sudo sed -i '/iface lo inet loopback/r /tmp/drude.ip.addr' /etc/network/interfaces | ||
rm -f /tmp/drude.ip.addr | ||
sudo ifdown lo && sudo ifup lo | ||
if_failed "Docker subnet configuration failed failed." | ||
if is_redhat; then | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. We should have There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Let's not rename functions right now @lmakarov There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. OK, agreed. |
||
install_subnet_rhel | ||
else | ||
install_subnet_ubuntu | ||
fi | ||
if_failed "Docker subnet configuration failed failed." | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. failed failed |
||
|
||
|
||
echo-green "Creating Drude HTTP/HTTPS reverse proxy..." | ||
install_proxy_service | ||
|
@@ -973,9 +1027,13 @@ EOF | |
install_sshagent_service | ||
if_failed "Drude ssh-agent service setup failed." | ||
|
||
echo-green "Configuring host DNS resolver for .drude domain..." | ||
echo -e "\n# .drude domain resolution\nnameserver $DRUDE_IP" | sudo tee -a /etc/resolvconf/resolv.conf.d/head | ||
sudo resolvconf -u | ||
if ! is_redhat; then | ||
echo-green "Configuring host DNS resolver for .drude domain..." | ||
echo -e "\n# .drude domain resolution\nnameserver $DRUDE_IP" | sudo tee -a /etc/resolvconf/resolv.conf.d/head | ||
sudo resolvconf -u | ||
else | ||
sudo systemctl restart NetworkManager.service | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Looking at the lo:drude interface configuration above, it looks like Drude's DNS will be used on that interface. Is this enough to have |
||
fi | ||
|
||
echo-green "To run docker without sudo please re-login or run 'newgrp docker' now." | ||
} | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I don't like that we have two very similar constants.
Maybe do
DRUDE_SUBNET="192.168.10.1
, and append/24
to it ininstall_subnet_ubuntu
.There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
192.168.10.1
is not subnet. It is a Drude Gateway IP