mirror of
https://github.com/hassio-addons/addon-vscode.git
synced 2025-05-06 20:21:32 +00:00
✨ Adds user configuration upgrade method
This commit is contained in:
parent
62e959d314
commit
bf63c46cc6
2 changed files with 28 additions and 16 deletions
|
@ -4,13 +4,18 @@
|
||||||
# Sets up code-server.
|
# Sets up code-server.
|
||||||
# ==============================================================================
|
# ==============================================================================
|
||||||
|
|
||||||
# Ensure persistent data folder exists
|
# List of previous config hashes, to allow upgrade "default" configs.
|
||||||
|
readonly -a PREVIOUS_DEFAULT_CONFIG_HASHES=(
|
||||||
|
86776df88391c3d94f79f62b430f9ff8538960628d5e04fb660165a5a46640d2e74f89cd68b3e6985dc59101ae2dda00a1e25aa48381acfd4736858c5f23878b
|
||||||
|
)
|
||||||
|
|
||||||
|
# Ensure persistent data folder exists.
|
||||||
if ! bashio::fs.directory_exists '/data/vscode'; then
|
if ! bashio::fs.directory_exists '/data/vscode'; then
|
||||||
mkdir -p /data/vscode/extensions \
|
mkdir -p /data/vscode/extensions \
|
||||||
|| bashio::exit.nok "Could not create persistent storage folder."
|
|| bashio::exit.nok "Could not create persistent storage folder."
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Copy in the extensions we deliver
|
# Copy in the extensions we deliver.
|
||||||
cp -R /root/.code-server/extensions/* /data/vscode/extensions
|
cp -R /root/.code-server/extensions/* /data/vscode/extensions
|
||||||
|
|
||||||
# Sets up default user settings on first start.
|
# Sets up default user settings on first start.
|
||||||
|
@ -21,7 +26,13 @@ if ! bashio::fs.file_exists '/data/vscode/User/settings.json'; then
|
||||||
cp /root/.code-server/settings.json /data/vscode/User/settings.json
|
cp /root/.code-server/settings.json /data/vscode/User/settings.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Workaround workspace bug for code-server
|
# Upgrade settings.json is still default from previous version.
|
||||||
|
current=$(sha512sum /data/vscode/User/settings.json|cut -d " " -f 1)
|
||||||
|
if [[ " ${PREVIOUS_DEFAULT_CONFIG_HASHES[*]} " == *" ${current} "* ]]; then
|
||||||
|
cp /root/.code-server/settings.json /data/vscode/User/settings.json
|
||||||
|
fi
|
||||||
|
|
||||||
|
# Workaround workspace bug for code-server.
|
||||||
# https://github.com/codercom/code-server/issues/121
|
# https://github.com/codercom/code-server/issues/121
|
||||||
if ! bashio::fs.file_exists '/data/vscode/Backups/workspaces.json'; then
|
if ! bashio::fs.file_exists '/data/vscode/Backups/workspaces.json'; then
|
||||||
mkdir -p /data/vscode/Backups \
|
mkdir -p /data/vscode/Backups \
|
||||||
|
@ -29,7 +40,7 @@ if ! bashio::fs.file_exists '/data/vscode/Backups/workspaces.json'; then
|
||||||
cp /root/.code-server/workspaces.json /data/vscode/Backups/workspaces.json
|
cp /root/.code-server/workspaces.json /data/vscode/Backups/workspaces.json
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Workaround workspace bug for code-server (same as above, part 2)
|
# Workaround workspace bug for code-server (same as above, part 2).
|
||||||
# https://github.com/codercom/code-server/issues/121
|
# https://github.com/codercom/code-server/issues/121
|
||||||
if ! bashio::fs.file_exists '/data/vscode/User/workspaceStorage'; then
|
if ! bashio::fs.file_exists '/data/vscode/User/workspaceStorage'; then
|
||||||
mkdir -p /data/vscode/User/workspaceStorage \
|
mkdir -p /data/vscode/User/workspaceStorage \
|
||||||
|
|
|
@ -13,16 +13,17 @@
|
||||||
"editor.selectionClipboard": false,
|
"editor.selectionClipboard": false,
|
||||||
"terminal.integrated.copyOnSelection": true,
|
"terminal.integrated.copyOnSelection": true,
|
||||||
"settings": {
|
"settings": {
|
||||||
"editor.tabSize": 2,
|
"editor.tabSize": 2,
|
||||||
"editor.renderWhitespace": "boundary",
|
"editor.renderWhitespace": "boundary",
|
||||||
"yaml.customTags": [
|
"yaml.customTags": [
|
||||||
"!secret",
|
"!env_var",
|
||||||
"!yaml",
|
"!include_dir_list",
|
||||||
"!include",
|
"!include_dir_merge_list",
|
||||||
"!include_dir_list",
|
"!include_dir_merge_named",
|
||||||
"!include_dir_named",
|
"!include_dir_named",
|
||||||
"!include_dir_merge_list",
|
"!include",
|
||||||
"!include_dir_merge_named"
|
"!secret",
|
||||||
]
|
"!yaml"
|
||||||
}
|
]
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue