Skip to content

Commit

Permalink
Merge "Closes-Bug: #1561766 - SM Setup script changes : extra option …
Browse files Browse the repository at this point in the history
…to prevent internet repo setup"
  • Loading branch information
Zuul authored and opencontrail-ci-admin committed Mar 28, 2016
2 parents e8536d0 + fef097c commit dda818e
Showing 1 changed file with 53 additions and 19 deletions.
72 changes: 53 additions & 19 deletions build/deb_server_manager_setup.sh
Expand Up @@ -25,6 +25,7 @@ NOWEBUI=""
WEBCORE=""
CERT_NAME=""
SMLITE=""
NOEXTERNALREPOS=""
HOST_IP_LIST=`ifconfig | sed -n -e 's/:127\.0\.0\.1 //g' -e 's/ *inet addr:\([0-9.]\+\).*/\1/gp'`
HOSTIP=`echo $HOST_IP_LIST | cut -d' ' -f1`
rel=`lsb_release -r`
Expand Down Expand Up @@ -62,18 +63,9 @@ function cleanup_smgr_repos()

}

function setup_smgr_repos()
function setup_apt_conf()
{
# Push this to makefile - Copy only the file we need into installer.
if [ ${rel[1]} == "14.04" ]; then
cp /opt/contrail/contrail_server_manager/ubuntu_14_04_1_sources.list /etc/apt/sources.list.d/smgr_sources.list
elif [ ${rel[1]} == "12.04" ]; then
cp /opt/contrail/contrail_server_manager/ubuntu_12_04_3_sources.list /etc/apt/sources.list.d/smgr_sources.list
else
echo "$space$arrow This version of Ubuntu ${rel[1]} is not supported"
exit
fi

echo "$space$arrow Allow Install of Unauthenticated APT packages"
# Allow unauthenticated pacakges to get installed.
# Do not over-write apt.conf. Instead just append what is necessary
# retaining other useful configurations such as http::proxy info.
Expand All @@ -86,24 +78,54 @@ function setup_smgr_repos()
echo "$apt_auth" >> /etc/apt/apt.conf
fi

echo "$space$arrow Setting up the repositories for Server Manager Install"
set +e
apt-get update >> $log_file 2>&1
set -e
}


echo "$space$arrow Installing dependent packages for Setting up repos"
function setup_smgr_repos()
{

echo "$space$arrow Installing dependent packages for Setting up Smgr repos"
#scan pkgs in local repo and create Packages.gz
apt-get --no-install-recommends -y install dpkg-dev >> $log_file 2>&1
# Dependencies to add apt-repos
apt-get --no-install-recommends -y install python-software-properties debmirror >> $log_file 2>&1
apt-get --no-install-recommends -y install software-properties-common >> $log_file 2>&1

pushd /opt/contrail/contrail_server_manager >> $log_file 2>&1
dpkg-scanpackages . | gzip -9c > Packages.gz | >> $log_file 2>&1
popd >> $log_file 2>&1

echo "deb file:/opt/contrail/contrail_server_manager ./" > /tmp/local_repo
cat /tmp/local_repo /etc/apt/sources.list.d/smgr_sources.list > /tmp/new_smgr_sources.list
mv /tmp/new_smgr_sources.list /etc/apt/sources.list.d/smgr_sources.list

set +e
apt-get update >> $log_file 2>&1
set -e

}

function setup_internet_repos()
{
echo "$space$arrow Setting up Internet Repos"
# Push this to makefile - Copy only the file we need into installer.
if [ ${rel[1]} == "14.04" ]; then
cp /opt/contrail/contrail_server_manager/ubuntu_14_04_1_sources.list /etc/apt/sources.list.d/smgr_sources.list
elif [ ${rel[1]} == "12.04" ]; then
cp /opt/contrail/contrail_server_manager/ubuntu_12_04_3_sources.list /etc/apt/sources.list.d/smgr_sources.list
else
echo "$space$arrow This version of Ubuntu ${rel[1]} is not supported"
exit
fi

set +e
apt-get update >> $log_file 2>&1
set -e

# Dependencies to add apt-repos
apt-get --no-install-recommends -y install python-software-properties debmirror >> $log_file 2>&1
apt-get --no-install-recommends -y install software-properties-common >> $log_file 2>&1

puppet_list_file="/etc/apt/sources.list.d/puppet.list"
passenger_list_file="/etc/apt/sources.list.d/passenger.list"
dist='precise'
Expand Down Expand Up @@ -136,7 +158,10 @@ function setup_smgr_repos()
add-apt-repository "deb http://download.opensuse.org/repositories/home:/libertas-ict:/cobbler26/xUbuntu_12.04/ ./" >> $log_file 2>&1
fi
fi

set +e
apt-get update >> $log_file 2>&1
set -e

}

Expand Down Expand Up @@ -199,11 +224,14 @@ while [ "$1" != "" ]; do
--hostip)
HOSTIP=$VALUE
rm -rf /opt/contrail/contrail_server_manager/IP.txt
echo $HOSTIP >> /opt/contrail/contrail_server_manager/IP.txt
echo $HOSTIP >> /opt/contrail/contrail_server_manager/IP.txt
;;
--cert-name)
CERT_NAME=$VALUE
;;
--no-external-repos)
NOEXTERNALREPOS="TRUE"
;;
*)
echo "ERROR: unknown parameter \"$PARAM\""
usage
Expand All @@ -214,6 +242,12 @@ while [ "$1" != "" ]; do
done

cleanup_smgr_repos
setup_apt_conf
if [ "$NOEXTERNALREPOS" == "" ]; then
setup_internet_repos
else
touch /etc/apt/sources.list.d/smgr_sources.list
fi
setup_smgr_repos

RESTART_SERVER_MANAGER=""
Expand Down Expand Up @@ -373,7 +407,7 @@ fi

# Should we remove Puppet/Passenger sources.list.d files also?
echo "$arrow Reverting Repos to old state"
rm -f /etc/apt/sources.list.d/puppet.list >> $log_file 2>&1
rm -f /etc/apt/sources.list.d/puppet.list >> $log_file 2>&1
rm -f /etc/apt/sources.list.d/passenger.list >> $log_file 2>&1
rm -f /etc/apt/sources.list.d/smgr_sources.list >> $log_file 2>&1
apt-get update >> $log_file 2>&1
Expand Down

0 comments on commit dda818e

Please sign in to comment.