Adds user configuration upgrade method

This commit is contained in:
Franck Nijhof 2019-04-19 18:16:31 +02:00
parent 62e959d314
commit bf63c46cc6
No known key found for this signature in database
GPG key ID: D62583BA8AB11CA3
2 changed files with 28 additions and 16 deletions

View file

@ -4,13 +4,18 @@
# 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
mkdir -p /data/vscode/extensions \
|| bashio::exit.nok "Could not create persistent storage folder."
fi
# Copy in the extensions we deliver
# Copy in the extensions we deliver.
cp -R /root/.code-server/extensions/* /data/vscode/extensions
# 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
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
if ! bashio::fs.file_exists '/data/vscode/Backups/workspaces.json'; then
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
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
if ! bashio::fs.file_exists '/data/vscode/User/workspaceStorage'; then
mkdir -p /data/vscode/User/workspaceStorage \

View file

@ -13,16 +13,17 @@
"editor.selectionClipboard": false,
"terminal.integrated.copyOnSelection": true,
"settings": {
"editor.tabSize": 2,
"editor.renderWhitespace": "boundary",
"yaml.customTags": [
"!secret",
"!yaml",
"!include",
"!include_dir_list",
"!include_dir_named",
"!include_dir_merge_list",
"!include_dir_merge_named"
]
}
"editor.tabSize": 2,
"editor.renderWhitespace": "boundary",
"yaml.customTags": [
"!env_var",
"!include_dir_list",
"!include_dir_merge_list",
"!include_dir_merge_named",
"!include_dir_named",
"!include",
"!secret",
"!yaml"
]
}
}