forked from driesvints/dotfiles
-
Notifications
You must be signed in to change notification settings - Fork 1
/
codespaces-post-create
executable file
·39 lines (35 loc) · 1.7 KB
/
codespaces-post-create
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
#!/usr/bin/env bash
cd "$(dirname "$0")"
source ./helpers/runtime.sh
source ../bin/helpers/trap_and_trace.sh
# This script should be codespace agnosic. It is intended to be run as part of a
# codespaces' `postCreateCommand` lifecycle event to perform additional setup
# steps specific to these dotfiles and my development preferences.
#
# NOTE: THIS IS NOT BASED ON ANY BUILT-IN MECHANISM of devcontainers or
# codespaces, it's something YOU MUST MANUALLY ENABLE via one of the lifecycle
# event hooks - the most obvious targets being `postCreateCommand` and
# `postAttachCommand` events - by adding something like the following to a
# script that's assigned to the event in your `.devcontainer.json` file:
#
# ```sh
# # Run any additional user-specific hooks. This runs every time the container is attached.
# if [[ -f /workspaces/.codespaces/.persistedshare/dotfiles/scripts/codespaces-post-create ]]; then
# /workspaces/.codespaces/.persistedshare/dotfiles/codespaces-post-create
# fi
# ```
#
# The file names `codespaces-post-attach` and `codespaces-post-create` are the
# convention used at GitHub, but you can use any name you like. The script will
# be executed in the context of whatever user account the devcontainer is
# configured to use, and remember to make sure the scripts are executable.
#
# Caveat lector: While codespaces are typically isolated environments, you
# should still take care to only enable this for devcontainers in repos that you
# trust and that have a reasonable level security and observability.
log_info "Running post create script from dotfiles"
if [[ "$(is_codespace)" != "true" ]]; then
log_attention "Not a codespace; skipping $0"
exit 0
fi
log_success "Done running post create script!"