-
-
Notifications
You must be signed in to change notification settings - Fork 9
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
5 changed files
with
87 additions
and
36 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -66,6 +66,5 @@ venv.bak/ | |
|
||
|
||
|
||
/dev-config | ||
/custom_components/__init__.py | ||
/test*.py |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,86 @@ | ||
#!/usr/bin/env bash | ||
|
||
# Stop on errors | ||
set -e | ||
|
||
ROOT="$( cd "$( dirname "$(readlink -f "$0")" )/.." >/dev/null 2>&1 && pwd )" | ||
cd "${ROOT}" | ||
|
||
# Load common functions | ||
source ./bin/_common | ||
|
||
dk=$(which docker) || die "ERROR: Docker not found." | ||
|
||
workspace=${PWD##*/} | ||
workdir="/workspaces/${workspace}" | ||
|
||
container="dev-${workspace}" | ||
port="127.0.0.1:9123:8123" | ||
image="ludeeus/container:integration-debian" | ||
volume="${ROOT}:${workdir}" | ||
|
||
cmd="${1:-menu}" | ||
|
||
if ! ${dk} ps -a | grep -wq ${container} && [[ "${cmd}" != "down" ]]; then | ||
log.info "Create container..." | ||
${dk} create -it --name "${container}" -p "${port}" -v "${volume}" "${image}" | ||
fi | ||
|
||
if [[ "${cmd}" == "menu" ]]; then | ||
PS3='Please enter your choice: ' | ||
options=(\ | ||
"Run Home Assistant on port 9123" | ||
"Run Home Assistant configuration against /config" | ||
"Upgrade Home Assistant to latest dev" | ||
"Install a specific version of Home Assistant" | ||
) | ||
echo | ||
select opt in "${options[@]}" | ||
do | ||
case $REPLY in | ||
1 ) | ||
cmd="start" | ||
;; | ||
2 ) | ||
cmd="check" | ||
;; | ||
3 ) | ||
cmd="upgrade" | ||
;; | ||
4 ) | ||
cmd="set-version" | ||
;; | ||
esac | ||
break | ||
done | ||
fi | ||
case "${cmd}" in | ||
"stop" ) | ||
log.info "Stop container..." | ||
${dk} stop "${container}" | ||
;; | ||
"down" ) | ||
log.info "Destroy container..." | ||
${dk} stop -t 10 "${container}" >/dev/null | ||
${dk} rm "${container}" | ||
;; | ||
"bash" ) | ||
if ! ${dk} ps | grep -wq ${container}; then | ||
log.info "Start container..." | ||
${dk} start "${container}" | ||
fi | ||
log.info "Interactive mode..." | ||
${dk} exec -it "${container}" bash | ||
;; | ||
* ) | ||
if ! ${dk} ps | grep -wq ${container}; then | ||
log.info "Start container..." | ||
${dk} start "${container}" | ||
fi | ||
log.info "Send command '${cmd}' to container..." | ||
if [[ "${cmd}" == "start" ]]; then | ||
log.info "After Home Assistant initialization you can access to system on http://localhost:9123/" | ||
fi | ||
${dk} exec -it -w "${workdir}" "${container}" container "${cmd}" | ||
;; | ||
esac |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters