-
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·103 lines (85 loc) · 2.6 KB
/
install.sh
File metadata and controls
executable file
·103 lines (85 loc) · 2.6 KB
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
#!/usr/bin/env bash
# This script can be re-run as it will only install things if needed.
# Note: cpphash is updated using git pull if it exists.
# To update GrowOS itself, please do it manuallly using git pull.
set -o nounset
declare -r CDIR="./cpphash"
declare -r VENV="./build/venv"
# Check that cpphash has been cloned into $CDIR and is up to date
if [ ! -f "$CDIR/make/cpphash.mk" ]; then
echo "cd $(dirname $CDIR)"
cd $(dirname "$CDIR")
echo "git clone https://github.com/maartenSXM/cpphash.git"
git clone https://github.com/maartenSXM/cpphash.git
if [ ! -f "$CDIR/make/cpphash.mk" ]; then
echo "$0: Could not git clone cpphash. Aborting."
exit 1
fi
echo cd -
cd -
fi
# Check that cpphash is successfully installed
echo "$CDIR/install.sh -y -v $VENV"
"$CDIR"/install.sh -y -v "$VENV"
if [ $? -ne 0 ]; then
echo "$0: Could not successfully install cpphash. Aborting."
exit 1
fi
# Check that libmagic is available to esphome on Darwin
if [[ "$(uname)" == "Darwin" ]]; then
if [[ "$(command -v brew)" == "" ]]; then
echo "$0: brew not found. Aborting."
fi
brew list libmagic 2>/dev/null | grep -q libmagic
if [ $? -ne 0 ]; then
echo "brew install libmagic"
brew install libmagic
if [ $? -ne 0 ]; then
echo "$0: Could not brew install libmagic. Aborting."
exit 1
fi
fi
fi
if [[ ! -f "./secrets.h" && ! -f "../secrets.h" ]]; then
while :; do
echo "secrets.h not found. Would you like me to create one? [y/n]"
read -n 1 -r
echo
if [[ $REPLY =~ ^[QqNn]$ ]]; then
break
fi
if [[ $REPLY =~ ^[Yy]$ ]]; then
read -re -p "Please enter the SSID GrowOS should connect to: "
ssid="$REPLY"
while :; do
IFS= read -re -p "Please enter the password for SSID $ssid: "
echo
pwd="$REPLY"
if ((${#pwd} >= 8)); then
break
fi
echo "SSID passwords must be at least 8 characters."
done
echo "
#define _SECRET_WIFI_SSID $ssid
#define _SECRET_WIFI_PASSWORD $pwd
// These #defaults are in gos/network.yaml. Override them here.
// #default _SECRET_HA_PASSWORD _SECRET_WIFI_PASSWORD
// #default _SECRET_OTA_PASSWORD _SECRET_WIFI_PASSWORD
" > secrets.h
break;
fi
done
fi
echo "
GrowOS installation succeeded.
If you change the network configuration from dynamic to static IP addresses,
please either define static IP addresses in your project's config.h or
update the default ones found in ./local.yaml.
The timezone can likewise be set on a per-project basis in config.h or
defaulted from local.yaml.
Recommend next steps are:
source Bashrc
make
"
exit 0