mirror of
				https://github.com/XiaoMi/ha_xiaomi_home.git
				synced 2025-10-31 09:22:08 +08:00 
			
		
		
		
	Simplify the install logic.
This commit is contained in:
		
							
								
								
									
										20
									
								
								install.sh
									
									
									
									
									
								
							
							
						
						
									
										20
									
								
								install.sh
									
									
									
									
									
								
							| @@ -14,19 +14,21 @@ if [ ! -d "$config_path" ]; then | |||||||
|     exit 1 |     exit 1 | ||||||
| fi | fi | ||||||
|  |  | ||||||
| # Remove the old version. |  | ||||||
| rm -rf "$config_path/custom_components/xiaomi_home" |  | ||||||
| # Get the script path. | # Get the script path. | ||||||
| script_path=$(dirname "$0") | script_path=$(dirname "$0") | ||||||
| # Change to the script path. |  | ||||||
| cd "$script_path" | # Set source and target | ||||||
|  | component_name=xiaomi_home | ||||||
|  | source_path="$script_path/custom_components/$component_name" | ||||||
|  | target_root="$config_path/custom_components" | ||||||
|  | target_path="$target_root/$component_name" | ||||||
|  |  | ||||||
|  | # Remove the old version. | ||||||
|  | rm -rf "$target_path" | ||||||
|  |  | ||||||
| # Copy the new version. | # Copy the new version. | ||||||
| if [ -d "$config_path/custom_components" ]; then | mkdir -p "$target_root" | ||||||
|     cp -r custom_components/xiaomi_home/  "$config_path/custom_components/" | cp -r "$source_path" "$target_path" | ||||||
| else |  | ||||||
|     cp -r custom_components/  "$config_path/custom_components/" |  | ||||||
| fi |  | ||||||
|  |  | ||||||
| # Done. | # Done. | ||||||
| echo "Xiaomi Home installation is completed. Please restart Home Assistant." | echo "Xiaomi Home installation is completed. Please restart Home Assistant." | ||||||
|   | |||||||
		Reference in New Issue
	
	Block a user