@@ -25,9 +25,8 @@ set -euo pipefail # Exit on error, undefined vars, pipe failures
2525
2626# Global variables
2727SCRIPT_NAME=" Apache CloudStack Installer"
28- CS_LOGDIR=" /var/log/cloudstack/installer"
29- CS_LOGFILE=" ${CS_LOGDIR} /cloudstack-installer.log"
30- TRACKER_FILE=" $HOME /cloudstack-installer-tracker.conf"
28+ CS_LOGFILE=" $PWD /cloudstack-install.log"
29+ TRACKER_FILE=" $PWD /cloudstack-installer-tracker.conf"
3130
3231OS_TYPE=" "
3332PACKAGE_MANAGER=" "
@@ -914,7 +913,7 @@ show_components_versions() {
914913 ;;
915914 esac
916915 done
917- show_dialog info " Component Versions" " Available versions from repository:\n\n$( printf ' %s\n' " ${versions[@]} " ) " 6 10 60
916+ show_dialog info " Component Versions" " Available versions from repository:\n\n$( printf ' %s\n' " ${versions[@]} " ) " 6 10 55
918917}
919918
920919# Component installation and configuration functions
@@ -1743,58 +1742,51 @@ deploy_zone() {
17431742 )
17441743
17451744 local results=()
1746- if is_interactive; then
1747- # Create form entries
1748- local form_height=$(( ${# defaults[@]} / 2 + 8 ))
1749- local form_entries=()
1750- local i=0
1751- while [[ $i -lt ${# defaults[@]} ]]; do
1752- form_entries+=(" ${defaults[i]} " ) # Label
1753- form_entries+=(" $(( i/ 2 + 1 )) " ) # Row
1754- form_entries+=(" 1" ) # Label column
1755- form_entries+=(" ${defaults[i+1]} " ) # Default value
1756- form_entries+=(" $(( i/ 2 + 1 )) " ) # Row for input
1757- form_entries+=(" 35" ) # Input column
1758- form_entries+=(" 30" ) # Field width
1759- form_entries+=(" 0" ) # Max input length
1760- (( i+= 2 ))
1761- done
1762-
1763- form_args=(
1764- --backtitle " $SCRIPT_NAME "
1765- --title " Zone Configuration"
1766- --form " Configure Zone Deployment Parameters:"
1767- $form_height 70 0
1768- )
1745+ # Create zone form entries
1746+ local form_height=$(( ${# defaults[@]} / 2 + 8 ))
1747+ local form_entries=()
1748+ local i=0
1749+ while [[ $i -lt ${# defaults[@]} ]]; do
1750+ form_entries+=(" ${defaults[i]} " ) # Label
1751+ form_entries+=(" $(( i/ 2 + 1 )) " ) # Row
1752+ form_entries+=(" 1" ) # Label column
1753+ form_entries+=(" ${defaults[i+1]} " ) # Default value
1754+ form_entries+=(" $(( i/ 2 + 1 )) " ) # Row for input
1755+ form_entries+=(" 35" ) # Input column
1756+ form_entries+=(" 30" ) # Field width
1757+ form_entries+=(" 0" ) # Max input length
1758+ (( i+= 2 ))
1759+ done
17691760
1770- for (( i= 0 ; i< ${# form_entries[@]} ; i+= 8 )) ; do
1771- form_args+=(
1772- " ${form_entries[i]} " # Label
1773- " ${form_entries[i+1]} " # Row
1774- " ${form_entries[i+2]} " # Label column
1775- " ${form_entries[i+3]} " # Default value
1776- " ${form_entries[i+4]} " # Input row
1777- " ${form_entries[i+5]} " # Input column
1778- " ${form_entries[i+6]} " # Field width
1779- " ${form_entries[i+7]} " # Max length
1780- )
1781- done
1782- if ! results=$( dialog " ${form_args[@]} " 2>&1 > /dev/tty) ; then
1783- dialog --backtitle " $SCRIPT_NAME " \
1784- --title " Cancelled" \
1785- --msgbox " Zone configuration was cancelled." 6 50
1786- return 1
1787- fi
1761+ form_args=(
1762+ --backtitle " $SCRIPT_NAME "
1763+ --title " Zone Configuration"
1764+ --form " Configure Zone Deployment Parameters:"
1765+ $form_height 70 0
1766+ )
17881767
1789- # Convert results string into array
1790- mapfile -t results <<< " $results"
1791- else
1792- results=()
1793- for (( i= 1 ; i< ${# defaults[@]} ; i+= 2 )) ; do
1794- results+=(" ${defaults[i]} " )
1795- done
1768+ for (( i= 0 ; i< ${# form_entries[@]} ; i+= 8 )) ; do
1769+ form_args+=(
1770+ " ${form_entries[i]} " # Label
1771+ " ${form_entries[i+1]} " # Row
1772+ " ${form_entries[i+2]} " # Label column
1773+ " ${form_entries[i+3]} " # Default value
1774+ " ${form_entries[i+4]} " # Input row
1775+ " ${form_entries[i+5]} " # Input column
1776+ " ${form_entries[i+6]} " # Field width
1777+ " ${form_entries[i+7]} " # Max length
1778+ )
1779+ done
1780+ if ! results=$( dialog " ${form_args[@]} " 2>&1 > /dev/tty) ; then
1781+ dialog --backtitle " $SCRIPT_NAME " \
1782+ --title " Cancelled" \
1783+ --msgbox " Zone configuration was cancelled." 6 50
1784+ return 1
17961785 fi
17971786
1787+ # Convert results string into array
1788+ mapfile -t results <<< " $results"
1789+
17981790 # Map results to variables
17991791 local zone_name=" ${results[0]} "
18001792 local guest_cidr=" ${results[1]} "
@@ -1814,29 +1806,27 @@ deploy_zone() {
18141806 local network_type=" Advanced"
18151807
18161808 # Show confirmation
1817- local confirm_msg=" Please confirm the following configuration:\n\n"
1818- confirm_msg+=" Zone: $zone_name (${network_type} )\n"
1819- confirm_msg+=" Guest CIDR: $guest_cidr \n"
1820- confirm_msg+=" Public IPs: $public_start - $public_end \n"
1821- confirm_msg+=" Pod IPs: $pod_start - $pod_end \n"
1822- confirm_msg+=" VLAN Range: $vlan_range \n"
1823- confirm_msg+=" Physical Network Name: $phy_name \n"
1824- confirm_msg+=" Pod Name: $pod_name \n"
1825- confirm_msg+=" Cluster Name: $cluster_name \n"
1826- confirm_msg+=" Primary Storage Name: $primary_name \n"
1827- confirm_msg+=" Primary Storage Path: $nfs_server$primary_path \n"
1828- confirm_msg+=" Secondary Storage Path: $nfs_server$secondary_path \n"
1829-
1830- log " Zone deployment details: $confirm_msg "
1831-
1809+ local zone_details=" "
1810+ zone_details+=" Zone: $zone_name (${network_type} )\n"
1811+ zone_details+=" Guest CIDR: $guest_cidr \n"
1812+ zone_details+=" Public IPs: $public_start - $public_end \n"
1813+ zone_details+=" Pod IPs: $pod_start - $pod_end \n"
1814+ zone_details+=" VLAN Range: $vlan_range \n"
1815+ zone_details+=" Physical Network Name: $phy_name \n"
1816+ zone_details+=" Pod Name: $pod_name \n"
1817+ zone_details+=" Cluster Name: $cluster_name \n"
1818+ zone_details+=" Primary Storage Name: $primary_name \n"
1819+ zone_details+=" Primary Storage Path: nfs://$nfs_server$primary_path \n"
1820+ zone_details+=" Secondary Storage Path: nfs://$nfs_server$secondary_path \n"
1821+
1822+ log " $( printf " Zone details:\n%b" " $zone_details " ) "
18321823 if is_interactive; then
1824+ local confirm_msg=" Please confirm the following configuration:\n\n$zone_details "
18331825 if ! dialog --backtitle " $SCRIPT_NAME " \
18341826 --title " Confirm Configuration" \
18351827 --yesno " $confirm_msg " 18 60; then
18361828 return 1
18371829 fi
1838- else
1839- show_dialog " info" $title " Zone Configuration: \n$confirm_msg " 5 20 60
18401830 fi
18411831
18421832 if ! wait_for_management_server; then
@@ -1965,27 +1955,7 @@ deploy_zone() {
19651955 show_cloudstack_banner
19661956}
19671957
1968- configure_cloud_init () {
1969- # Check if already configured
1970- if grep -q ' config: disabled' /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg 2> /dev/null; then
1971- dialog --backtitle " $SCRIPT_NAME " \
1972- --title " Cloud-init Configuration" \
1973- --msgbox " Cloud-init network configuration already disabled." 6 50
1974- return 0
1975- fi
1976-
1977- {
1978- echo " 50"
1979- echo " # Disabling cloud-init network configuration..."
1980- echo " network: {config: disabled}" > /etc/cloud/cloud.cfg.d/99-disable-network-config.cfg
1981-
1982- echo " 100"
1983- echo " # Configuration complete!"
1984- } | dialog --backtitle " $SCRIPT_NAME " \
1985- --title " Cloud-init Configuration" \
1986- --gauge " Configuring cloud-init..." 8 60 0
1987- }
1988-
1958+ # Function to setup bridge used for CS
19891959configure_network () {
19901960 if is_interactive; then
19911961 local new_bridge=$( dialog --inputbox " Enter the name for the bridge:" 8 60 " $BRIDGE " 3>&1 1>&2 2>&3 )
@@ -2040,7 +2010,6 @@ network:
20402010 forward-delay: 0
20412011EOF
20422012 chmod 600 " $cfgfile "
2043- # configure_cloud_init
20442013 rm -f /etc/netplan/50-cloud-init.yaml
20452014
20462015 if netplan generate && netplan apply; then
@@ -2314,8 +2283,5 @@ main() {
23142283# Set trap for cleanup
23152284trap ' cleanup 1' INT TERM
23162285
2317- # Ensure log directory exists
2318- mkdir -p $CS_LOGDIR
2319-
23202286# Run main function
23212287main " $@ "
0 commit comments