@@ -30,7 +30,7 @@ GREEN='\033[0;32m'
3030BLUE=' \033[0;34m'
3131NC=' \033[0m' # No Color
3232YELLOW=' \033[0;33m'
33- omnia_release=2.0 .0.0
33+ omnia_release=2.1 .0.0
3434
3535core_container_status=false
3636omnia_path=" "
@@ -925,9 +925,10 @@ start_container_session() {
925925}
926926
927927show_help () {
928- echo " Usage: $0 [--install | --uninstall | --help]"
928+ echo " Usage: $0 [--install | --uninstall | --version | -- help]"
929929 echo " -i, --install Install and start the Omnia core container"
930930 echo " -u, --uninstall Uninstall the Omnia core container and clean up configuration"
931+ echo " -v, --version Display Omnia version information"
931932 echo " -h, --help More information about usage"
932933}
933934
@@ -1110,6 +1111,34 @@ install_omnia_core() {
11101111 fi
11111112}
11121113
1114+ # Check if Omnia core container is running
1115+ check_container_status () {
1116+ # Check if the Omnia core container is running
1117+ if ! podman ps --format ' {{.Names}}' | grep -qw " omnia_core" ; then
1118+ echo -e " ${RED} ERROR: Omnia core container is not running.${NC} "
1119+ exit 1
1120+ fi
1121+ }
1122+
1123+ # Function to display version information
1124+ display_version () {
1125+ # Check if metadata file exists and Omnia core container is running
1126+ check_container_status
1127+
1128+ # Fetch the metadata from the oim_metadata.yml file in the container
1129+ echo -e " ${GREEN} Fetching metadata from omnia_core container...${NC} "
1130+ core_config=$( podman exec omnia_core /bin/bash -c ' cat /opt/omnia/.data/oim_metadata.yml' )
1131+
1132+ # Extract Omnia version from metadata file
1133+ omnia_version=$( echo " $core_config " | grep " omnia_version:" | cut -d' :' -f2 | tr -d ' \t\n\r' )
1134+
1135+ # Display version information
1136+ echo " Omnia version: $omnia_version "
1137+
1138+ # Return exit code 0 on success
1139+ exit 0
1140+ }
1141+
11131142# Main function to check if omnia_core container is already running.
11141143# If yes, ask the user if they want to enter the container or reinstall.
11151144# If no, set it up.
@@ -1121,6 +1150,9 @@ main() {
11211150 --uninstall|-u)
11221151 cleanup_omnia_core
11231152 ;;
1153+ --version|-v)
1154+ display_version
1155+ ;;
11241156 --help|-h|" " )
11251157 show_help
11261158 ;;
0 commit comments