Skip to content

Commit

Permalink
Merge pull request #7 from iprak/define-default_user
Browse files Browse the repository at this point in the history
Define default user
  • Loading branch information
iprak authored Feb 23, 2025
2 parents cb87faa + 8d6009c commit a2eb4c7
Show file tree
Hide file tree
Showing 5 changed files with 69 additions and 27 deletions.
11 changes: 11 additions & 0 deletions .vscode/tasks.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
"version": "2.0.0",
"tasks": [
{
"label": "Build",
"type": "shell",
"command": "docker build -t custom-integration-image:local . --force-rm",
"problemMatcher": []
}
]
}
2 changes: 1 addition & 1 deletion Instructions.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
* `#"tests".msg = "You should not import tests"`

## Test
* Run `docker build -t custom-integration-image:local .` to build the image locally.
* Run `docker build -t custom-integration-image:local . --force-rm` to build the image locally.
* Test is locally by changing Dopckerfile in the test project to `FROM custom-integration-image:local`

## Prepare release
Expand Down
3 changes: 2 additions & 1 deletion container_content/.vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
"args": [
"--debug",
"-c",
"config"
"config",
"-v"
],
"serverReadyAction": {
"action": "openExternally"
Expand Down
13 changes: 13 additions & 0 deletions container_content/onboarding
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
{
"version": 4,
"minor_version": 1,
"key": "onboarding",
"data": {
"done": [
"user",
"core_config",
"integration",
"analytics"
]
}
}
67 changes: 42 additions & 25 deletions container_content/scripts/setup.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,37 +3,54 @@
# Stop on errors
set -e

echo "Copying pylint folder"
if [ -f "pylint" ]; then
rm -R pylint
fi
cp -rf /workspaces/container_content/pylint .
function ensure_hass_config() {
echo "Preparing config folder"
mkdir -p config
hass --script ensure_config -c config

echo "Copying pyproject.toml"
cp -f /workspaces/container_content/pyproject.toml .
echo "Creating Home Assistant User"
hass --script auth -c config add test test

echo "Copying .pre-commit-config.yaml"
cp -f /workspaces/container_content/.pre-commit-config.yaml .
echo "Skipping onboarding"
cp -f /workspaces/container_content/onboarding config/.storage
}

echo "Preparing .vscode folder"
if [ -f ".vscode" ]; then
rm -R .vscode
fi
cp -rf /workspaces/container_content/.vscode .
function copy_dev_content() {
echo "Copying pylint folder"
if [ -f "pylint" ]; then
rm -R pylint
fi
cp -rf /workspaces/container_content/pylint .

echo "Preparing config folder"
mkdir -p config
hass --script ensure_config -c config
echo "Copying pyproject.toml"
cp -f /workspaces/container_content/pyproject.toml .

if [ -f ".devcontainer/configuration.yaml" ]; then
echo "Linking configuration.yaml"
ln -sfr ".devcontainer/configuration.yaml" config/configuration.yaml
fi
echo "Copying .pre-commit-config.yaml"
cp -f /workspaces/container_content/.pre-commit-config.yaml .

echo "Preparing .vscode folder"
if [ -f ".vscode" ]; then
rm -R .vscode
fi
cp -rf /workspaces/container_content/.vscode .
}

function copy_configuration_overrides() {
if [ -f ".devcontainer/configuration.yaml" ]; then
echo "Linking configuration.yaml"
ln -sfr ".devcontainer/configuration.yaml" config/configuration.yaml
fi

if [ -f ".devcontainer/secrets.yaml" ]; then
echo "Linking secrets.yaml"
ln -sfr ".devcontainer/secrets.yaml" config/secrets.yaml
fi
}

ensure_hass_config
copy_dev_content
copy_configuration_overrides

if [ -f ".devcontainer/secrets.yaml" ]; then
echo "Linking secrets.yaml"
ln -sfr ".devcontainer/secrets.yaml" config/secrets.yaml
fi

echo "Linking custom_components"
rm -rf /config/custom_components
Expand Down

0 comments on commit a2eb4c7

Please sign in to comment.