-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Richard Cunningham
committed
Nov 22, 2024
1 parent
3ad3fe6
commit 5fbe9bf
Showing
3 changed files
with
90 additions
and
2 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
18 changes: 18 additions & 0 deletions
18
.devcontainer/features/colorthree/devcontainer-feature.json
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
{ | ||
"name": "My Final Favorite Color", | ||
"id": "colorthree", | ||
"version": "1.0.0", | ||
"description": "Another feature to remind you of your favorite color", | ||
"containerEnv": { | ||
"CONFIG_FOLDER": "/devcontainer_rc", | ||
"CONFIG_STAGING": "/devcontainer_staging" | ||
}, | ||
"mounts": [ | ||
{ | ||
"source": "${localEnv:HOME}/.config/devcontainer_rc", | ||
"target": "/devcontainer_rc", | ||
"type": "bind" | ||
} | ||
], | ||
"onCreateCommand": "bash /devcontainer_staging/onCreateCommand.sh" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
#!/bin/bash | ||
set -e | ||
|
||
echo "Activating feature 'terminal-history'" | ||
echo "User: ${_REMOTE_USER} User home: ${_REMOTE_USER_HOME}" | ||
|
||
mkdir -p $CONFIG_STAGING | ||
|
||
# ------------------------------------------------------------------------------- | ||
cat > $CONFIG_STAGING/onCreateCommand.sh \ | ||
<< EOF | ||
#!/bin/bash | ||
# copy in the opinionated default settings from the feature | ||
cp $CONFIG_STAGING/feature_settings_rc $CONFIG_FOLDER/feature_settings_rc | ||
# copy in the user editable settings unless they already exist | ||
if [[ ! -f $CONFIG_FOLDER/bashrc ]] ; then | ||
cp $CONFIG_STAGING/bashrc $CONFIG_FOLDER | ||
cp $CONFIG_STAGING/inputrc $CONFIG_FOLDER | ||
fi | ||
# hook in the config to the root account | ||
ln -s $CONFIG_FOLDER/inputrc /root/.inputrc | ||
echo "source $CONFIG_FOLDER/bashrc" >> /root/.bashrc | ||
EOF | ||
|
||
# ------------------------------------------------------------------------------- | ||
cat > $CONFIG_STAGING/inputrc \ | ||
<< EOF | ||
# Readline configuration for bash shell. | ||
# Incremental history searching with up and down arrows (C-P and C-N for old | ||
# style navigation). | ||
"\e[A": history-search-backward | ||
"\e[B": history-search-forward | ||
# Control left and right for word movement | ||
"\e[5C": forward-word | ||
"\e[5D": backward-word | ||
EOF | ||
|
||
# ------------------------------------------------------------------------------- | ||
cat > $CONFIG_STAGING/bashrc \ | ||
<< EOF | ||
#!/bin/bash | ||
# execute default opinionated settings - delete this line to remove defaults | ||
source $CONFIG_FOLDER/feature_settings_rc | ||
# add your personal custom settings below | ||
EOF | ||
|
||
# ------------------------------------------------------------------------------- | ||
cat > $CONFIG_STAGING/feature_settings_rc \ | ||
<< EOF | ||
#!/bin/bash | ||
# default opinioned bash configuration | ||
# set the prompt | ||
export PS1="\[\033[1;34m\]\W \[\033[0m\]# " | ||
# enable enternal shared history | ||
export HISTCONTROL=ignoreboth:erasedups | ||
export HISTFILESIZE=-1 | ||
export SAVEHIST=-1 | ||
export HISTFILE=$CONFIG_FOLDER/.bash_eternal_history | ||
PROMPT_COMMAND="history -a; $PROMPT_COMMAND" | ||
EOF |