mirror of
https://github.com/home-assistant/core.git
synced 2026-12-02 11:33:11 -04:00
62 lines
1.4 KiB
Bash
Executable File
62 lines
1.4 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Setups the repository.
|
|
|
|
# Stop on errors
|
|
set -e
|
|
|
|
cd "$(dirname "$0")/.."
|
|
|
|
# Add default vscode settings if not existing
|
|
SETTINGS_FILE=./.vscode/settings.json
|
|
SETTINGS_TEMPLATE_FILE=./.vscode/settings.default.jsonc
|
|
if [ ! -f "$SETTINGS_FILE" ]; then
|
|
echo "Copy $SETTINGS_TEMPLATE_FILE to $SETTINGS_FILE."
|
|
cp "$SETTINGS_TEMPLATE_FILE" "$SETTINGS_FILE"
|
|
fi
|
|
|
|
mkdir -p config
|
|
|
|
if [ ! -n "$VIRTUAL_ENV" ]; then
|
|
if [ -x "$(command -v uv)" ]; then
|
|
uv venv .venv
|
|
else
|
|
python3 -m venv .venv
|
|
fi
|
|
source .venv/bin/activate
|
|
fi
|
|
|
|
if ! [ -x "$(command -v uv)" ]; then
|
|
python3 -m pip install uv
|
|
fi
|
|
|
|
script/bootstrap
|
|
|
|
# Remove hooks installed by pre-commit before it was replaced by prek, so prek
|
|
# doesn't keep them as legacy hooks and run in migration mode
|
|
hooks_dir="$(git rev-parse --git-path hooks)"
|
|
for hook in "$hooks_dir/pre-commit" "$hooks_dir/pre-commit.legacy"; do
|
|
if grep -qs "File generated by pre-commit" "$hook"; then
|
|
echo "Removing $hook installed by pre-commit."
|
|
rm "$hook"
|
|
fi
|
|
done
|
|
|
|
prek install
|
|
|
|
hass --script ensure_config -c config
|
|
|
|
if ! grep -R "logger" config/configuration.yaml >> /dev/null; then
|
|
echo "
|
|
logger:
|
|
default: info
|
|
logs:
|
|
homeassistant.components.cloud: debug
|
|
" >> config/configuration.yaml
|
|
fi
|
|
|
|
if ! grep -R "debug_console" config/configuration.yaml >> /dev/null; then
|
|
echo "
|
|
debug_console:
|
|
" >> config/configuration.yaml
|
|
fi
|