Skip to content
This repository was archived by the owner on Feb 28, 2020. It is now read-only.

Commit 0bbbe35

Browse files
committed
✨ Adds support for startup init commands
1 parent 2b6e76b commit 0bbbe35

File tree

3 files changed

+20
-14
lines changed

3 files changed

+20
-14
lines changed

README.md

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -110,6 +110,12 @@ installed to your AppDaemon setup (e.g., `PyMySQL`. `Requests`, `Pillow`).
110110
**Note**: _Adding many packages will result in a longer start-up time
111111
for the add-on._
112112

113+
#### Option: `init_commands`
114+
115+
Customize your environment even more with the `init_commands` option.
116+
Add one or more shell commands to the list, and they will be executed every
117+
single time this add-on starts.
118+
113119
## AppDaemon and HADashboard configuration
114120

115121
This add-on does not configure the AppDaemon or HADashboard for you.

appdaemon/config.json

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -6,13 +6,7 @@
66
"url": "https://github.com/hassio-addons/addon-appdaemon3",
77
"webui": "http://[HOST]:[PORT:5050]",
88
"startup": "application",
9-
"arch": [
10-
"aarch64",
11-
"amd64",
12-
"armhf",
13-
"armv7",
14-
"i386"
15-
],
9+
"arch": ["aarch64", "amd64", "armhf", "armv7", "i386"],
1610
"boot": "auto",
1711
"hassio_api": true,
1812
"hassio_role": "default",
@@ -25,20 +19,18 @@
2519
"5000/tcp": "AppDaemon RESTFul API",
2620
"5050/tcp": "HA Dashboard web interface"
2721
},
28-
"map": [
29-
"config:rw",
30-
"share:rw",
31-
"ssl"
32-
],
22+
"map": ["config:rw", "share:rw", "ssl"],
3323
"options": {
3424
"disable_auto_token": false,
3525
"system_packages": [],
36-
"python_packages": []
26+
"python_packages": [],
27+
"init_commands": []
3728
},
3829
"schema": {
3930
"log_level": "match(^(trace|debug|info|notice|warning|error|fatal)$)?",
4031
"disable_auto_token": "bool",
4132
"system_packages": ["str"],
42-
"python_packages": ["str"]
33+
"python_packages": ["str"],
34+
"init_commands": ["str"]
4335
}
4436
}

appdaemon/rootfs/etc/cont-init.d/appdaemon.sh

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -99,3 +99,11 @@ if bashio::config.has_value 'python_packages'; then
9999
|| bashio::exit.nok "Failed installing package ${package}"
100100
done
101101
fi
102+
103+
# Executes user configured/requested commands on startup
104+
if bashio::config.has_value 'init_commands'; then
105+
while read -r cmd; do
106+
eval "${cmd}" \
107+
|| bashio::exit.nok "Failed executing init command: ${cmd}"
108+
done <<< "$(bashio::config 'init_commands')"
109+
fi

0 commit comments

Comments
 (0)