-
Notifications
You must be signed in to change notification settings - Fork 28
/
install
executable file
·32 lines (27 loc) · 714 Bytes
/
install
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
#!/bin/bash
#
if [[ "${1}" == "go" ]]; then
ECHO=
shift
else
ECHO=echo
fi
DEST="${1}"
if [[ -z "${DEST}" ]]; then
echo "*** please supply the home-assistant /config directory"
exit 1
fi
if [[ ! -d "${DEST}" ]]; then
echo "*** please make sure the destination directory exists"
exit 1
fi
if [[ -n "${ECHO}" ]]; then
echo "**** would run the following commands, use './install go $1' to do the work"
fi
${ECHO} mkdir -p "${DEST}/custom_components"
if [[ -n $(command -v fd) ]]; then
fd -e py -e json -e yaml . custom_components --exec ${ECHO} cp -vf --parents {} "${DEST}" ;
else
${ECHO} cp -afv custom_components/virtual "${DEST}/custom_components"
fi
echo -- finished at "$(date '+%A at %H:%M:%S')"