From: garciadeblas Date: Fri, 28 Jan 2022 16:15:39 +0000 (+0100) Subject: Added ctrl_c function to trap user installation interruptions X-Git-Tag: v12.0.0rc1~50 X-Git-Url: https://osm.etsi.org/gitweb/?a=commitdiff_plain;h=refs%2Fchanges%2F92%2F11592%2F2;p=osm%2Fdevops.git Added ctrl_c function to trap user installation interruptions Change-Id: I81c8f2443557887562512a4cc3b1f3c8ecb33ae9 Signed-off-by: garciadeblas --- diff --git a/installers/full_install_osm.sh b/installers/full_install_osm.sh index 75949846..d8113829 100755 --- a/installers/full_install_osm.sh +++ b/installers/full_install_osm.sh @@ -627,6 +627,10 @@ EOF" function install_osm() { [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function + + trap ctrl_c INT + track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none + track checks checkingroot_ok [ "$USER" == "root" ] && FATAL "You are running the installer as root. The installer is prepared to be executed as a normal user with sudo privileges." track checks noroot_ok @@ -862,6 +866,13 @@ function parse_docker_registry_url() { [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function } +function ctrl_c() { + [ -z "${DEBUG_INSTALL}" ] || DEBUG beginning of function + echo "** Trapped CTRL-C" + FATAL "User stopped the installation" + [ -z "${DEBUG_INSTALL}" ] || DEBUG end of function +} + LXD_VERSION=4.0 JUJU_VERSION=2.9 JUJU_AGENT_VERSION=2.9.17 @@ -1179,10 +1190,6 @@ OSM_K8S_WORK_DIR="$OSM_DOCKER_WORK_DIR/osm_pods" && OSM_NAMESPACE_VOL="${OSM_HOS #Installation starts here wget -q -O- https://osm-download.etsi.org/ftp/osm-11.0-eleven/README.txt &> /dev/null export OSM_TRACK_INSTALLATION_ID="$(date +%s)-$(head /dev/urandom | tr -dc A-Za-z0-9 | head -c 16)" - -track start release $RELEASE none none docker_tag $OSM_DOCKER_TAG none none installation_type $OSM_INSTALLATION_TYPE none none - install_osm echo -e "\nDONE" exit 0 -