mirror of
https://github.com/hassio-addons/addon-vscode.git
synced 2025-05-03 18:51:23 +00:00
28 lines
1.1 KiB
Text
28 lines
1.1 KiB
Text
#!/command/with-contenv bashio
|
|
# shellcheck shell=bash
|
|
# ==============================================================================
|
|
# Home Assistant Community Add-on: Studio Code Server
|
|
# Sets up code-server.
|
|
# ==============================================================================
|
|
bashio::log.info "Initalizing code-server configs"
|
|
|
|
# List of previous config hashes, to allow upgrade "default" configs.
|
|
readonly CUSTOM_BASH_SCRIPTS_PATH="/data/vscode/custom"
|
|
readonly DEFAULT_FILES_PATH="/var/lib/code-server/defaults"
|
|
|
|
run() {
|
|
if [ ! -d "$CUSTOM_BASH_SCRIPTS_PATH" ]; then
|
|
bashio::log.warning "Config path did not exist, creating $CUSTOM_BASH_SCRIPTS_PATH"
|
|
mkdir -p "$CUSTOM_BASH_SCRIPTS_PATH" ||
|
|
bashio::exit.nok "Could not create persistent storage folder."
|
|
cp "$DEFAULT_FILES_PATH"/custom-template.sh "$CUSTOM_BASH_SCRIPTS_PATH"
|
|
fi
|
|
|
|
for script in $CUSTOM_BASH_SCRIPTS_PATH/*.sh; do
|
|
bashio::log.info "Config script: $script"
|
|
chmod +x "$script"
|
|
"$CUSTOM_BASH_SCRIPTS_PATH"/"$script"
|
|
done
|
|
}
|
|
|
|
run
|