From: Igor D.C Date: Mon, 23 Oct 2017 13:36:03 +0000 (+0000) Subject: bug 397 Preserve env running install-openmano.sh X-Git-Tag: v3.0.0rc14~1 X-Git-Url: https://osm.etsi.org/gitweb/?p=osm%2FRO.git;a=commitdiff_plain;h=bf669b95be698c7ca0e1f43577e27aa355d11228 bug 397 Preserve env running install-openmano.sh This is a partial bug fix for bug 397, by making sure that sudo is not invoked inside the install-openmano.sh script (which would discard the environment already set, at least on default Ubuntu 16.04). It is safe to not invoke sudo because the script requires to be run as root. Additionally, it is now recommended to use "sudo -E" when invoking the script, instead of just "sudo", to make sure the environment is preserved. The "sudo -E" recommendation has also been added to install-openmano-service.sh. Change-Id: Ib8fc5807e26f7018d9e5331c8b0c045794346d5a Signed-off-by: Igor D.C --- diff --git a/scripts/install-openmano-service.sh b/scripts/install-openmano-service.sh index 64766188..499120db 100755 --- a/scripts/install-openmano-service.sh +++ b/scripts/install-openmano-service.sh @@ -25,7 +25,7 @@ #it configures openmano to run as a service function usage(){ - echo -e "usage: sudo $0 [OPTIONS]" + echo -e "usage: sudo -E $0 [OPTIONS]" echo -e "Configures openmano to run as a service at /opt" echo -e " OPTIONS" echo -e " -u USER_OWNER user owner of the service, 'root' by default" diff --git a/scripts/install-openmano.sh b/scripts/install-openmano.sh index fc051ea3..7e082fb8 100755 --- a/scripts/install-openmano.sh +++ b/scripts/install-openmano.sh @@ -26,7 +26,7 @@ #Ask for database user and password if not provided function usage(){ - echo -e "usage: sudo $0 [OPTIONS]" + echo -e "usage: sudo -E $0 [OPTIONS]" echo -e "Install last stable source code in ./openmano and the needed packages" echo -e "On a Ubuntu 16.04 it configures openmano as a service" echo -e " OPTIONS" @@ -217,10 +217,10 @@ then [ "$_DISTRO" == "Ubuntu" ] && apt-get update -y [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && yum check-update -y - [ "$_DISTRO" == "CentOS" ] && sudo yum install -y epel-release + [ "$_DISTRO" == "CentOS" ] && yum install -y epel-release [ "$_DISTRO" == "Red" ] && wget http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-5.noarch.rpm \ - && sudo rpm -ivh epel-release-7-5.noarch.rpm && sudo yum install -y epel-release && rm -f epel-release-7-5.noarch.rpm - [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && sudo yum repolist + && rpm -ivh epel-release-7-5.noarch.rpm && yum install -y epel-release && rm -f epel-release-7-5.noarch.rpm + [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && yum repolist echo -e "\n"\ "#################################################################\n"\ @@ -239,11 +239,11 @@ then [ "$_DISTRO" == "CentOS" -o "$_DISTRO" == "Red" ] && easy_install -U bottle # required for vmware connector TODO move that to separete opt in install script - sudo pip install --upgrade pip - sudo pip install pyvcloud - sudo pip install progressbar - sudo pip install prettytable - sudo pip install pyvmomi + pip install --upgrade pip + pip install pyvcloud + pip install progressbar + pip install prettytable + pip install pyvmomi # required for AWS connector [ "$_DISTRO" == "Ubuntu" ] && install_packages "python-boto" @@ -427,7 +427,7 @@ then # echo 'alias service-openmano="service openmano"' >> ${HOME}/.bashrc echo echo "Done! installed at /opt/openmano" - echo " Manage server with 'sudo service osm-ro start|stop|status|...' " + echo " Manage server with 'sudo -E service osm-ro start|stop|status|...' " else echo echo "Done! you may need to logout and login again for loading client configuration"