X-Git-Url: https://osm.etsi.org/gitweb/?a=blobdiff_plain;f=installers%2Finstall_osm.sh;h=5be26707eace84a4e3e7a562c8e24c1b4349b96c;hb=ae0784f4e86e61f36dc4802e889504f1086dddd0;hp=0f5e6bb0e7d8ab8a07f162c17e49807193e87fd3;hpb=44c021904b2eec4520dc5aef58d1de43ce62dd12;p=osm%2Fdevops.git diff --git a/installers/install_osm.sh b/installers/install_osm.sh index 0f5e6bb0..5be26707 100755 --- a/installers/install_osm.sh +++ b/installers/install_osm.sh @@ -13,9 +13,9 @@ # limitations under the License. # REPOSITORY_BASE=https://osm-download.etsi.org/repository/osm/debian -RELEASE=ReleaseSEVEN -REPOSITORY=stable -DOCKER_TAG=7 +RELEASE=ReleaseSEVEN-daily +REPOSITORY=testing +DOCKER_TAG=releaseseven function usage(){ echo -e "usage: $0 [OPTIONS]" @@ -61,6 +61,7 @@ function usage(){ echo -e " --nat: (only for Rel THREE with --soui) install only NAT rules" echo -e " --noconfigure: (only for Rel THREE with --soui) DO NOT install osmclient, DO NOT install NAT rules, DO NOT configure modules" echo -e " --showopts: print chosen options and exit (only for debugging)" + #echo -e " --clean_volumes To clear all the mounted volumes from docker swarm" echo -e " -y: do not prompt for confirmation, assumes yes" echo -e " -h / --help: print this help" } @@ -90,6 +91,36 @@ add_repo() { return 1 } +clean_old_packages() { +dpkg -s 'osm-devops' &> /dev/null + +if [ $? -eq 0 ]; then + + # Remove old packages + echo "Removing the old OSM packages" + sudo apt-get remove -y osm-devops + sudo apt-get remove -y osm-imdocs + sudo apt-get remove -y python3-osmclient + sudo apt-get remove -y python3-osm-im + # Clean the previous repos that might exist + sudo sed -i "/osm-download.etsi.org/d" /etc/apt/sources.list +fi +} + +#TBD +clean_volumes(){ + result=`docker stack ls|wc -l` + echo "Stack is running ####%%%%% $result" + if [ $result -gt 1 ]; then + echo "Inside $result > 1" + #TBD take user confirmation + docker stack ls |awk '{print $1}' |tail -n+2|xargs docker stack rm + sleep 3m + docker volume ls|awk '/_mon_db|_mongo_db|_osm_packages|_pol_db|_prom_db|_ro|_ro_db/{print $2}' \ + |xargs -r --no-run-if-empty docker volume rm + fi +} + while getopts ":hr:R:u:t:-:" o; do case "${o}" in h) @@ -116,6 +147,7 @@ while getopts ":hr:R:u:t:-:" o; do esac done +clean_old_packages add_repo "deb [arch=amd64] $REPOSITORY_BASE/$RELEASE $REPOSITORY devops" sudo DEBIAN_FRONTEND=noninteractive apt-get -q update sudo DEBIAN_FRONTEND=noninteractive apt-get install osm-devops