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

Commit

Permalink
✨ Adds support for startup init commands
Browse files Browse the repository at this point in the history
  • Loading branch information
frenck committed Jan 5, 2020
1 parent 2b6e76b commit 0bbbe35
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 14 deletions.
6 changes: 6 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,12 @@ installed to your AppDaemon setup (e.g., `PyMySQL`. `Requests`, `Pillow`).
**Note**: _Adding many packages will result in a longer start-up time
for the add-on._

#### Option: `init_commands`

Customize your environment even more with the `init_commands` option.
Add one or more shell commands to the list, and they will be executed every
single time this add-on starts.

## AppDaemon and HADashboard configuration

This add-on does not configure the AppDaemon or HADashboard for you.
Expand Down
20 changes: 6 additions & 14 deletions appdaemon/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,7 @@
"url": "https://github.com/hassio-addons/addon-appdaemon3",
"webui": "http://[HOST]:[PORT:5050]",
"startup": "application",
"arch": [
"aarch64",
"amd64",
"armhf",
"armv7",
"i386"
],
"arch": ["aarch64", "amd64", "armhf", "armv7", "i386"],
"boot": "auto",
"hassio_api": true,
"hassio_role": "default",
Expand All @@ -25,20 +19,18 @@
"5000/tcp": "AppDaemon RESTFul API",
"5050/tcp": "HA Dashboard web interface"
},
"map": [
"config:rw",
"share:rw",
"ssl"
],
"map": ["config:rw", "share:rw", "ssl"],
"options": {
"disable_auto_token": false,
"system_packages": [],
"python_packages": []
"python_packages": [],
"init_commands": []
},
"schema": {
"log_level": "match(^(trace|debug|info|notice|warning|error|fatal)$)?",
"disable_auto_token": "bool",
"system_packages": ["str"],
"python_packages": ["str"]
"python_packages": ["str"],
"init_commands": ["str"]
}
}
8 changes: 8 additions & 0 deletions appdaemon/rootfs/etc/cont-init.d/appdaemon.sh
Original file line number Diff line number Diff line change
Expand Up @@ -99,3 +99,11 @@ if bashio::config.has_value 'python_packages'; then
|| bashio::exit.nok "Failed installing package ${package}"
done
fi

# Executes user configured/requested commands on startup
if bashio::config.has_value 'init_commands'; then
while read -r cmd; do
eval "${cmd}" \
|| bashio::exit.nok "Failed executing init command: ${cmd}"
done <<< "$(bashio::config 'init_commands')"
fi

0 comments on commit 0bbbe35

Please sign in to comment.