This repository was archived by the owner on Dec 1, 2018. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 37
Rhel distributions #149
Open
DamirGadiev
wants to merge
6
commits into
develop
Choose a base branch
from
rhel-distributions
base: develop
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Rhel distributions #149
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
0a20fe7
Add RHEL compatibility
fc8653d
Minor updates to RHEL support changes
9c99bd7
Add typo fix and update network manager restart
6b91a08
Merge branch 'develop' of github.com:blinkreaction/drude into rhel-di…
6be6c20
Fix rhel dns relolving
6426bcd
Correct saving of dispatcher and interface files
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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,96 @@ install_sshagent_service () | |
"blinkreaction/ssh-agent:${DRUDE_ITAG}" >/dev/null 2>&1 | ||
} | ||
|
||
install_subnet_debian () | ||
{ | ||
# 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 | ||
cat > /tmp/drude.lo.interface << EOF | ||
DEVICE=lo:drude | ||
NAME=lo:drude | ||
NM_CONTROLLED=yes | ||
TYPE=Loopback | ||
IPADDR=$DRUDE_SUBNET_RHEL | ||
NETMASK=255.255.255.0 | ||
ONBOOT=yes | ||
EOF | ||
sudo cp /tmp/drude.lo.interface $interface | ||
sudo chmod 0655 $interface | ||
rm -r /tmp/drude.lo.interface | ||
sudo ifdown lo:drude && sudo ifup lo:drude | ||
fi | ||
} | ||
|
||
create_rhel_network_dispatcher_script () | ||
{ | ||
dispatcher="/etc/NetworkManager/dispatcher.d/lo:drude-up" | ||
# Make sure this is not done twice | ||
if [ ! -f $dispatcher ]; then | ||
sudo touch $dispatcher | ||
sudo chmod 0777 $dispatcher | ||
cat > /tmp/drude.dispatcher << EOF | ||
grep -q -F $DRUDE_SUBNET_RHEL /etc/resolv.conf || echo "nameserver $DRUDE_SUBNET_RHEL" | tee -a /etc/resolv.conf | ||
EOF | ||
sudo cp /tmp/drude.dispatcher $dispatcher | ||
sudo chmod 0655 $dispatcher | ||
rm -r /tmp/drude.dispatcher | ||
sudo systemctl restart NetworkManager.service | ||
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 +1024,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_debian | ||
fi | ||
if_failed "Docker subnet configuration failed." | ||
|
||
|
||
echo-green "Creating Drude HTTP/HTTPS reverse proxy..." | ||
install_proxy_service | ||
|
@@ -973,9 +1044,15 @@ 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 | ||
echo-green "Configuring host DNS resolver for .drude domain..." | ||
create_rhel_network_dispatcher_script | ||
if_failed "DNS resolver configuration failed." | ||
fi | ||
|
||
echo-green "To run docker without sudo please re-login or run 'newgrp docker' now." | ||
} | ||
|
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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