mirror of
https://github.com/hassio-addons/addon-vscode.git
synced 2025-05-03 18:51:23 +00:00
devenv
This commit is contained in:
parent
83cd8e9c99
commit
dcd9eb65d9
12 changed files with 55 additions and 1 deletions
5
todo.txt
5
todo.txt
|
@ -1,3 +1,8 @@
|
|||
persist SERVER
|
||||
add workspace persistant file
|
||||
? add new custom service to run linking, store in data
|
||||
|
||||
|
||||
cli
|
||||
https://github.com/coder/code-server/blob/e3c09efcbcdfd632cbeac6044692d7ea9f493386/src/node/cli.ts#L35
|
||||
|
||||
|
|
|
@ -11,4 +11,4 @@ export HASS_SERVER="http://supervisor/core"
|
|||
export HASS_TOKEN="${SUPERVISOR_TOKEN:-}"
|
||||
|
||||
# Run the code server
|
||||
exec code-server /SERVER
|
||||
exec code-server $CODE_SERVER_WORKSPACE_FILE
|
||||
|
|
|
@ -27,6 +27,8 @@ readonly DEFAULT_CONFIG_PATH="/data/vscode"
|
|||
readonly ROOT_CODE_SERVER_CONFIG_PATH="/root/.config/code-server/" # needed for code-server to cleanly
|
||||
readonly CODE_SERVER_EXTENSIONS_INSTALL_PATH="$DEFAULT_CONFIG_PATH/extensions"
|
||||
readonly CODE_SERVER_EXTENSIONS_LIST="$DEFAULT_CONFIG_PATH/vscode.extensions"
|
||||
readonly CODE_SERVER_WORKSPACE_FILE="$DEFAULT_CONFIG_PATH/SERVER.code-workspace"
|
||||
|
||||
readonly -a DIRECTORIES=(addons addon_configs backup config media share ssl)
|
||||
|
||||
CODE_SERVER_CONFIG="$DEFAULT_CONFIG_PATH/config.yaml"
|
||||
|
@ -38,6 +40,7 @@ run() {
|
|||
set_log_level
|
||||
set_user_settings
|
||||
setup_extensions
|
||||
setup_code_workspace
|
||||
}
|
||||
|
||||
setup_clean_view() {
|
||||
|
@ -51,6 +54,16 @@ setup_clean_view() {
|
|||
bashio::log.warning "Failed linking common directory: ${dir}"
|
||||
}
|
||||
|
||||
setup_code_workspace() {
|
||||
# Copies the default workspace
|
||||
if [ ! -e "$CODE_SERVER_WORKSPACE_FILE" ]; then
|
||||
bashio::log.warning "CODE_SERVER_CONFIG does not exist.."
|
||||
cp "$DEFAULT_FILES_PATH/SERVER.code-workspace" "$CODE_SERVER_WORKSPACE_FILE"
|
||||
fi
|
||||
|
||||
export CODE_SERVER_WORKSPACE_FILE=$CODE_SERVER_WORKSPACE_FILE
|
||||
}
|
||||
|
||||
setup_config_path() {
|
||||
# Ensure config path exists
|
||||
if bashio::config.has_value "vscode_config_path"; then
|
||||
|
|
26
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-custom-bash/run
Normal file
26
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-custom-bash/run
Normal file
|
@ -0,0 +1,26 @@
|
|||
#!/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"
|
||||
|
||||
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."
|
||||
fi
|
||||
|
||||
for script in "$CUSTOM_BASH_SCRIPTS_PATH"/*.sh; do
|
||||
chmod +x "$script"
|
||||
"$CUSTOM_BASH_SCRIPTS_PATH"/"$script"
|
||||
done
|
||||
|
||||
}
|
||||
|
||||
run
|
|
@ -0,0 +1 @@
|
|||
oneshot
|
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-custom-bash/up
Normal file
1
vscode/rootfs/etc/s6-overlay/s6-rc.d/init-custom-bash/up
Normal file
|
@ -0,0 +1 @@
|
|||
/etc/s6-overlay/s6-rc.d/init-custom-bash/run
|
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"folders": [
|
||||
{
|
||||
"path": "."
|
||||
}
|
||||
],
|
||||
"settings": {}
|
||||
}
|
Loading…
Add table
Add a link
Reference in a new issue