From: Francisco-Javier Ramón Salguero Date: Sat, 22 Feb 2020 00:45:41 +0000 (+0100) Subject: Fix for unattended install of iptables-persistent X-Git-Tag: release-v8.0-start~60 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=4205c192a9b6c2e30459987491e02a44ca3695d6;p=osm%2Fdevops.git Fix for unattended install of iptables-persistent Change-Id: Ib639707484edbd8b4eb8f93b451c6e72c341f8a4 Signed-off-by: Francisco-Javier Ramón Salguero --- diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index d657ccf7..550e90fd 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -203,11 +203,21 @@ EONG return 0 } +#Safe unattended install of iptables-persistent +function check_install_iptables_persistent(){ + echo -e "\nChecking required packages: iptables-persistent" + if dpkg -l iptables-persistent &>/dev/null; then + echo -e " Not installed.\nInstalling iptables-persistent requires root privileges" + 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 -yq install iptables-persistent + fi +} + #Configure NAT rules, based on the current IP addresses of containers function nat(){ - echo -e "\nChecking required packages: iptables-persistent" - dpkg -l iptables-persistent &>/dev/null || ! echo -e " Not installed.\nInstalling iptables-persistent requires root privileges" || \ - sudo apt-get -yq install iptables-persistent + check_install_iptables_persistent + echo -e "\nConfiguring NAT rules" echo -e " Required root privileges" sudo $OSM_DEVOPS/installers/nat_osm @@ -362,9 +372,7 @@ function juju_createcontroller() { } function juju_createproxy() { - echo -e "\nChecking required packages: iptables-persistent" - dpkg -l iptables-persistent &>/dev/null || ! echo -e " Not installed.\nInstalling iptables-persistent requires root privileges" || \ - sudo apt-get -yq install iptables-persistent + check_install_iptables_persistent if ! sudo iptables -t nat -C PREROUTING -p tcp -m tcp -d $DEFAULT_IP --dport 17070 -j DNAT --to-destination $OSM_VCA_HOST; then sudo iptables -t nat -A PREROUTING -p tcp -m tcp -d $DEFAULT_IP --dport 17070 -j DNAT --to-destination $OSM_VCA_HOST