v0.2.0 - Gather Virtual Machine ID
This commit is contained in:
		@@ -15,7 +15,8 @@ Just Execute the script, it's a guided Script (chmod +x CreateCloudInitVM.sh &&
 | 
				
			|||||||
   - [ ] Guided VM Creation
 | 
					   - [ ] Guided VM Creation
 | 
				
			||||||
   - [ ] Image Download URL
 | 
					   - [ ] Image Download URL
 | 
				
			||||||
   - [ ] Instant VM-Start after Creation
 | 
					   - [ ] Instant VM-Start after Creation
 | 
				
			||||||
 | 
					   - [ ] Image Selection
 | 
				
			||||||
 | 
					   - [X] VM-ID check
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Bookstack Link to general Cloud-Init Information
 | 
					# Bookstack Link to general Cloud-Init Information
 | 
				
			||||||
https://bookstack.voser.cloud/books/virtualisierung/chapter/cloud-init
 | 
					https://bookstack.voser.cloud/books/virtualisierung/chapter/cloud-init
 | 
				
			||||||
@@ -9,22 +9,43 @@
 | 
				
			|||||||
# Date of Last Maintenance: 03.12.2021
 | 
					# Date of Last Maintenance: 03.12.2021
 | 
				
			||||||
#
 | 
					#
 | 
				
			||||||
# Current State: Development
 | 
					# Current State: Development
 | 
				
			||||||
# Version: 0.0.1
 | 
					# Version: 0.2.0
 | 
				
			||||||
# Version History:
 | 
					# Version History:
 | 
				
			||||||
# v0.0.1 - Basic Script Structure
 | 
					# v0.0.1 - Basic Script Structure
 | 
				
			||||||
 | 
					# v0.1.0 - Get the User input
 | 
				
			||||||
 | 
					# v0.2.0 - Gather Virtual Machine ID
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Planned Features:
 | 
					# Planned Features:
 | 
				
			||||||
#   - [ ] Guided VM Creation
 | 
					#   - [ ] Guided VM Creation
 | 
				
			||||||
#   - [ ] Image Download URL
 | 
					#   - [ ] Image Download URL
 | 
				
			||||||
#   - [ ] Instant VM-Start after Creation
 | 
					#   - [ ] Instant VM-Start after Creation
 | 
				
			||||||
 | 
					#   - [ ] Image Selection
 | 
				
			||||||
 | 
					#   - [X] VM-ID check
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Global Conigurable Variables
 | 
					# Global Conigurable Variables
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Global Constantst
 | 
					# Global Constants
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Functions
 | 
					# Functions
 | 
				
			||||||
 | 
					function gather_vmid {
 | 
				
			||||||
 | 
					    echo "Already used IDs"
 | 
				
			||||||
 | 
					    qm list | tr -s ' ' | cut -d ' ' -f 2,3
 | 
				
			||||||
 | 
					    echo "Enter the new ID of your Virtual Machine (It must be unused)"
 | 
				
			||||||
 | 
					    read VM_ID
 | 
				
			||||||
 | 
					    i=0
 | 
				
			||||||
 | 
					    readarray -t vmid_array < <(qm list | tail -n +2 | tr -s ' ' | cut -d ' ' -f 2)
 | 
				
			||||||
 | 
					    if [[ "${vmid_array[*]}" =~ "$VM_ID" ]]; then
 | 
				
			||||||
 | 
					        echo "Your selected Virtual Machine ID is already in use, choose an other ID"
 | 
				
			||||||
 | 
					        gather_vmid
 | 
				
			||||||
 | 
					    fi
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
 | 
					function get_user_input {
 | 
				
			||||||
 | 
					    gather_vmid
 | 
				
			||||||
 | 
					    
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
# Main Script
 | 
					# Main Script
 | 
				
			||||||
 | 
					get_user_input
 | 
				
			||||||
 | 
					
 | 
				
			||||||
# Debug
 | 
					# Debug
 | 
				
			||||||
		Reference in New Issue
	
	Block a user