Skip to content

Commit bbf10bd

Browse files
committed
added missing tracker, percentage bar issue for rocky, skip dialog for installed and configured components
1 parent e9f81b8 commit bbf10bd

1 file changed

Lines changed: 48 additions & 42 deletions

File tree

installer.sh

Lines changed: 48 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -315,7 +315,7 @@ update_system_packages() {
315315

316316
apt-get upgrade -y 2>&1 | while IFS= read -r line; do
317317
percent=$((percent + 1))
318-
[ $percent -gt 90 ] && percent=90
318+
[ $percent -gt 80 ] && percent=80
319319
update_progress_bar "$percent" "# Installing updates...\n\n$line"
320320
done
321321
;;
@@ -328,14 +328,14 @@ update_system_packages() {
328328

329329
dnf makecache 2>&1 | while IFS= read -r line; do
330330
percent=$((percent + 1))
331-
[ $percent -gt 70 ] && percent=70
331+
[ $percent -gt 60 ] && percent=60
332332
update_progress_bar "40" "# Updating package cache...\n\n$line"
333333
done
334334

335335
dnf update -y 2>&1 | while IFS= read -r line; do
336336
percent=$((percent + 1))
337-
[ $percent -gt 90 ] && percent=90
338-
update_progress_bar "75" "# Installing system updates...\n\n$line"
337+
[ $percent -gt 80 ] && percent=80
338+
update_progress_bar "$percent" "# Installing system updates...\n\n$line"
339339
done
340340
;;
341341
esac
@@ -606,6 +606,17 @@ find_free_ip_range() {
606606
#-------------------------------------------------------------------------------
607607

608608

609+
is_cloudstack_pkg_selected() {
610+
if [[ " ${SELECTED_COMPONENTS[@]} " =~ " management " || \
611+
" ${SELECTED_COMPONENTS[@]} " =~ " agent " || \
612+
" ${SELECTED_COMPONENTS[@]} " =~ " usage " ]]; then
613+
return 0 # true
614+
else
615+
return 1 # false
616+
fi
617+
}
618+
619+
609620
# Configure CloudStack repository for Debian/Ubuntu
610621
#-------------------------------------------------------------------------------
611622

@@ -910,6 +921,7 @@ install_management_server() {
910921
local package_name="cloudstack-management"
911922
local tracker_key="management_installed"
912923
if is_step_tracked "$tracker_key"; then
924+
show_dialog "info" "Management Server Installation" "Management Server is already installed.\n\nSkipping installation."
913925
log "CloudStack Management Server is already installed. Skipping installation."
914926
return 0
915927
fi
@@ -927,6 +939,7 @@ configure_management_server_database() {
927939
local tracker_key="db_deployed"
928940
if is_step_tracked "$tracker_key"; then
929941
log "CloudStack database is already deployed. Skipping deployment."
942+
show_dialog "info" "$title" "$title is already done.\n\nSkipping it."
930943
return 0
931944
fi
932945
log "Starting CloudStack database deployment..."
@@ -996,6 +1009,7 @@ install_mysql_server() {
9961009
local tracker_key="mysql_installed"
9971010
if is_step_tracked "$tracker_key"; then
9981011
log "MySQL is already installed. Skipping installation."
1012+
show_dialog "info" "MySQL Server Installation" "MySQL Server is already installed.\n\nSkipping installation."
9991013
return 0
10001014
fi
10011015

@@ -1012,6 +1026,7 @@ configure_mysql_for_cloudstack() {
10121026
local tracker_key="mysql_configured"
10131027
if is_step_tracked "$tracker_key"; then
10141028
log "MySQL is already configured for CloudStack. Skipping configuration."
1029+
show_dialog "info" "MySQL Server Configuration" "MySQL Server is already configured.\n\nSkipping configuration."
10151030
return 0
10161031
fi
10171032
log "Starting MySQL configuration..."
@@ -1024,7 +1039,7 @@ configure_mysql_for_cloudstack() {
10241039

10251040
local config_file="$MYSQL_CONF_DIR/cloudstack.cnf"
10261041
if [[ -f "$config_file" ]]; then
1027-
show_dialog "info" "$title" "Configuration already exists at:\n$config_file\nSkipping MySQL setup."
1042+
show_dialog "info" "$title" "Configuration already exists at:\n$config_file\n\nSkipping MySQL setup."
10281043
set_tracker_field "$tracker_key" "yes"
10291044
return 0
10301045
fi
@@ -1065,14 +1080,14 @@ install_nfs_server() {
10651080
local tracker_key="nfs_installed"
10661081
if is_step_tracked "$tracker_key"; then
10671082
log "NFS Server is already installed. Skipping installation."
1068-
show_dialog "info" "NFS Server Installation" "NFS Server is already installed. Skipping installation."
1083+
show_dialog "info" "NFS Server Installation" "NFS Server is already installed.\n\nSkipping installation."
10691084
return 0
10701085
fi
10711086

10721087
if command -v exportfs &>/dev/null; then
10731088
log "NFS Server is already installed."
10741089
set_tracker_field "$tracker_key" "yes"
1075-
show_dialog "info" "NFS Server Installation" "NFS Server is already installed. Skipping installation."
1090+
show_dialog "info" "NFS Server Installation" "NFS Server is already installed.\n\nSkipping installation."
10761091
return 0
10771092
fi
10781093

@@ -1113,15 +1128,16 @@ get_export_cidr() {
11131128
# Configure NFS Server
11141129
configure_nfs_server() {
11151130
local tracker_key="nfs_configured"
1116-
local title="NFS Storage Configuration"
1131+
local title="NFS Server Configuration"
11171132
if is_step_tracked "$tracker_key"; then
1118-
log "NFS storage is already configured. Skipping setup."
1133+
log "NFS Server is already configured. Skipping configuration."
1134+
show_dialog "info" "$title" "NFS Server is already configured.\n\nSkipping configuration."
11191135
return 0
11201136
fi
11211137
log "Starting NFS storage configuration..."
11221138

11231139
if [[ -d "/export" ]] && grep -q "^/export " /etc/exports; then
1124-
show_dialog "info" "$title" "NFS is already configured. Skipping setup."
1140+
show_dialog "info" "$title" "NFS Server is already configured.\n\nSkipping configuration."
11251141
set_tracker_field "$tracker_key" "yes"
11261142
return 0
11271143
fi
@@ -1190,6 +1206,7 @@ install_kvm_agent() {
11901206
local tracker_key="agent_installed"
11911207
if is_step_tracked "$tracker_key"; then
11921208
log "KVM Agent is already installed. Skipping installation."
1209+
show_dialog "info" "Cloudstack Agent Installation" "CloudStack Agent is already installed.\n\nSkipping installation."
11931210
return 0
11941211
fi
11951212
if is_package_installed "$package_name"; then
@@ -1202,13 +1219,14 @@ install_kvm_agent() {
12021219

12031220
configure_kvm_agent() {
12041221
local tracker_key="agent_configured"
1205-
local title="KVM Host Configuration"
1222+
local title="CloudStack Agent Configuration"
12061223
if is_step_tracked "$tracker_key"; then
12071224
log "KVM Agent is already configured. Skipping configuration."
1225+
show_dialog "info" "$title" "CloudStack Agent is already configured.\n\nSkipping configuration."
12081226
return 0
12091227
fi
1210-
log "Starting KVM host configuration..."
1211-
show_dialog "info" "$title" "Starting KVM host configuration..."
1228+
log "Starting CloudStack Agent configuration..."
1229+
show_dialog "info" "$title" "Starting CloudStack Agent configuration..."
12121230

12131231
# Configure VNC
12141232
{
@@ -1350,20 +1368,6 @@ configure_kvm_agent() {
13501368
--title "KVM Agent Configuration" \
13511369
--gauge "Configuring KVM Agent..." 10 70 0
13521370

1353-
# Show configuration summary
1354-
local summary="KVM Host Configuration Summary:\n\n"
1355-
summary+="✓ VNC configured for remote access\n"
1356-
summary+="✓ Libvirt TCP access enabled\n"
1357-
summary+="✓ Security policies configured\n"
1358-
summary+="✓ Firewall rules added for ports:\n"
1359-
summary+=" - SSH (22)\n"
1360-
summary+=" - Libvirt (16509)\n"
1361-
summary+=" - VNC (5900-6100)\n"
1362-
summary+=" - Live Migration (49152-49216)\n"
1363-
1364-
show_dialog "info" "$title" "$summary" 15 60
1365-
1366-
# Verify configuration
13671371
if ! systemctl is-active --quiet libvirtd; then
13681372
show_dialog "msg" "$title" "Libvirt service is not running! Please check system logs."
13691373
fi
@@ -1376,6 +1380,7 @@ install_usage_server() {
13761380
local tracker_key="usage_installed"
13771381
if is_step_tracked "$tracker_key"; then
13781382
log "CloudStack Usage Server is already installed. Skipping installation."
1383+
show_dialog "info" "Usage Server Installation" "CloudStack Usage Server is already installed.\n\nSkipping installation."
13791384
return 0
13801385
fi
13811386
if is_package_installed "$package_name"; then
@@ -1398,6 +1403,7 @@ configure_usage_server() {
13981403
local tracker_key="usage_configured"
13991404
if is_step_tracked "$tracker_key"; then
14001405
log "Usage Server is already configured. Skipping configuration."
1406+
show_dialog "info" "Usage Server Configuration" "CloudStack Usage Server is already configured.\n\nSkipping configuration."
14011407
return 0
14021408
fi
14031409
log "Starting Usage Server configuration..."
@@ -1410,8 +1416,8 @@ configure_usage_server() {
14101416
show_dialog "msg" "Usage Server Configuration" "Database configuration files not found!\nPlease ensure CloudStack Management Server is configured."
14111417
return 1
14121418
fi
1413-
1414-
sleep 5
1419+
set_tracker_field "$tracker_key" "yes"
1420+
sleep 2
14151421
}
14161422

14171423
# Function to present component selection dialog
@@ -1447,17 +1453,19 @@ show_validation_summary() {
14471453
local status_ok=true
14481454

14491455
# 1. Network Validation
1450-
if ip link show "$BRIDGE" &>/dev/null; then
1451-
local bridge_ip=$(ip -4 addr show "$BRIDGE" | awk '/inet / {print $2}' | cut -d/ -f1)
1452-
if [[ -n "$bridge_ip" ]]; then
1453-
summary+="✓ Network: Bridge $BRIDGE configured with IP $bridge_ip\n"
1456+
if is_cloudstack_pkg_selected; then
1457+
if ip link show "$BRIDGE" &>/dev/null; then
1458+
local bridge_ip=$(ip -4 addr show "$BRIDGE" | awk '/inet / {print $2}' | cut -d/ -f1)
1459+
if [[ -n "$bridge_ip" ]]; then
1460+
summary+="✓ Network: Bridge $BRIDGE configured with IP $bridge_ip\n"
1461+
else
1462+
summary+="✗ Network: Bridge $BRIDGE has no IP address\n"
1463+
status_ok=false
1464+
fi
14541465
else
1455-
summary+="✗ Network: Bridge $BRIDGE has no IP address\n"
1466+
summary+="✗ Network: Bridge $BRIDGE not found\n"
14561467
status_ok=false
14571468
fi
1458-
else
1459-
summary+="✗ Network: Bridge $BRIDGE not found\n"
1460-
status_ok=false
14611469
fi
14621470

14631471
# 2. MySQL Validation
@@ -2124,7 +2132,7 @@ setup_network() {
21242132
log "Starting network configuration"
21252133
if is_step_tracked "network_name"; then
21262134
BRIDGE=$(get_tracker_field "network_name")
2127-
show_dialog "info" "Network Configuration" "Network already configured with bridge $BRIDGE\n\n Skipping network configuration."
2135+
show_dialog "info" "Network Configuration" "Network already configured with bridge $BRIDGE.\n\n Skipping network configuration."
21282136
return 0
21292137
fi
21302138
configure_network
@@ -2197,13 +2205,11 @@ custom_install() {
21972205
if [ ${#SELECTED_COMPONENTS[@]} -eq 0 ]; then
21982206
select_components_to_setup
21992207
fi
2200-
22012208
log "Selected components for installation: ${SELECTED_COMPONENTS[*]}"
2202-
2203-
if [[ " ${SELECTED_COMPONENTS[@]} " =~ " management " || " ${SELECTED_COMPONENTS[@]} " =~ " agent " || " ${SELECTED_COMPONENTS[@]} " =~ " usage " ]]; then
2209+
if is_cloudstack_pkg_selected; then
22042210
setup_network
2211+
configure_repo
22052212
fi
2206-
configure_repo
22072213
update_system_packages
22082214
install_configure_components
22092215
}

0 commit comments

Comments
 (0)