-
Notifications
You must be signed in to change notification settings - Fork 14
Expand file tree
/
Copy pathinstall.sh
More file actions
executable file
·57 lines (45 loc) · 1.59 KB
/
install.sh
File metadata and controls
executable file
·57 lines (45 loc) · 1.59 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
#!/usr/bin/env bash
set -eu
function install_dotfiles() {
local source="${1:-}"
local target="${2:-}"
if test ! -e "${source:-}"; then return 0; fi
while read -r file; do
relative_file_path="${file#"${source}"/}"
target_file="${target}/${relative_file_path}"
target_dir="${target_file%/*}"
if test ! -d "${target_dir}"; then
mkdir -p "${target_dir}"
fi
printf 'Installing dotfiles symlink %s\n' "${target_file}"
ln -sf "${file}" "${target_file}"
done < <(find "${source}" -type f)
}
current_dir="$(cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd)"
install_dotfiles "${current_dir}/home_files" "${HOME}"
if test ! -e "${GITPOD_REPO_ROOT}/.idea/workspace.xml"; then
install_dotfiles "${current_dir}/workspace_repo" "${GITPOD_REPO_ROOT}"
fi
if test -e "${current_dir}/ephemeral_jetbrains_config" && test -v JETBRAINS_BACKEND_QUALIFIER; then
(
shopt -s nullglob
until ides=(/workspace/.config/JetBrains/RemoteDev-*) && test -n "${ides:-}"; do
sleep 0.5
done
install_dotfiles "${current_dir}/ephemeral_jetbrains_config" "${ides[0]}"
) & disown
fi
if test ! -e /usr/bin/commitjb; then
sudo ln -s "${current_dir}/commitjb" /usr/bin/
fi
# workspace_xml="${GITPOD_REPO_ROOT}/.idea/workspace.xml"
# # if test -e "${workspace_xml}"; then
# function watch_workspace_xml() {
# tail -n 0 -F "${workspace_xml}" 2>/dev/null | while read -r line; do
# commitjb
# break;
# done || true;
# watch_workspace_xml;
# }
# watch_workspace_xml & disown
# fi