forked from XiaoMi/ha_xiaomi_home
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·35 lines (29 loc) · 766 Bytes
/
Copy pathinstall.sh
File metadata and controls
executable file
·35 lines (29 loc) · 766 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/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
# Get the script path.
script_path=$(dirname "$0")
# 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.
mkdir -p "$target_root"
cp -r "$source_path" "$target_path"
# Done.
echo "Xiaomi Home installation is completed. Please restart Home Assistant."
exit 0