From 219c36e849d5abe6caa1b644aec774f5f1cf3ffa Mon Sep 17 00:00:00 2001 From: Paul Sinclair Date: Mon, 25 Mar 2019 20:16:07 -0400 Subject: [PATCH] :wrench: Move global gitconfig to persistent (#3) * :wrench: Move global gitconfig to persistent * :ok_hand: Feedback from Frenck :) --- .../rootfs/etc/cont-init.d/51-git-config.sh | 22 +++++++++++++++++++ 1 file changed, 22 insertions(+) create mode 100644 vscode/rootfs/etc/cont-init.d/51-git-config.sh diff --git a/vscode/rootfs/etc/cont-init.d/51-git-config.sh b/vscode/rootfs/etc/cont-init.d/51-git-config.sh new file mode 100644 index 0000000..0f3fda3 --- /dev/null +++ b/vscode/rootfs/etc/cont-init.d/51-git-config.sh @@ -0,0 +1,22 @@ +#!/usr/bin/with-contenv bashio +# ============================================================================== +# Community Hass.io Add-ons: Visual Studio Code +# Sets up the users git global config to be persistent +# ============================================================================== +readonly GIT_USER_PATH=/data/git + +if ! bashio::fs.directory_exists "${GIT_USER_PATH}"; then + mkdir -p "${GIT_USER_PATH}" \ + || bashio::exit.nok 'Failed to create a persistent git folder' + + chmod 700 "${GIT_USER_PATH}" \ + || bashio::exit.nok \ + 'Failed setting permissions on persistent git folder' +fi + +if ! bashio::fs.file_exists "${GIT_USER_PATH}/.gitconfig"; then + touch "${GIT_USER_PATH}/.gitconfig" \ + || bashio::exit.nok 'Failed to create .gitconfig' +fi + +ln -s "${GIT_USER_PATH}/.gitconfig" ~/.gitconfig