You cannot select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
		
			
	
	
		
			
				
					
						
							|  |  |  | #!/bin/bash
 | 
					
						
							|  |  |  | set -e | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Check the number of input parameters. | 
					
						
							|  |  |  | if [ $# -ne 1 ]; then | 
					
						
							|  |  |  |     echo "usage: $0 [config_path]" | 
					
						
							|  |  |  |     exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | # Get the config path. | 
					
						
							|  |  |  | config_path=$1 | 
					
						
							|  |  |  | # Check if config path exists. | 
					
						
							|  |  |  | if [ ! -d "$config_path" ]; then | 
					
						
							|  |  |  |     echo "$config_path does not exist" | 
					
						
							|  |  |  |     exit 1 | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Remove the old version. | 
					
						
							|  |  |  | rm -rf "$config_path/custom_components/xiaomi_home" | 
					
						
							|  |  |  | # Get the script path. | 
					
						
							|  |  |  | script_path=$(dirname "$0") | 
					
						
							|  |  |  | # Change to the script path. | 
					
						
							|  |  |  | cd "$script_path" | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Copy the new version. | 
					
						
							|  |  |  | if [ -d "$config_path/custom_components" ]; then | 
					
						
							|  |  |  |     cp -r custom_components/xiaomi_home/  "$config_path/custom_components/" | 
					
						
							|  |  |  | else | 
					
						
							|  |  |  |     cp -r custom_components/  "$config_path/custom_components/" | 
					
						
							|  |  |  | fi | 
					
						
							|  |  |  | 
 | 
					
						
							|  |  |  | # Done. | 
					
						
							|  |  |  | echo "Xiaomi Home installation is completed. Please restart Home Assistant." | 
					
						
							|  |  |  | exit 0 |