Skip to content

Commit

Permalink
Create colorthree
Browse files Browse the repository at this point in the history
  • Loading branch information
Richard Cunningham committed Nov 22, 2024
1 parent 3ad3fe6 commit 5fbe9bf
Show file tree
Hide file tree
Showing 3 changed files with 90 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .devcontainer/features/color/devcontainer-feature.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "My Favorite Color",
"id": "a",
"version": "1.0.3",
"id": "color",
"version": "1.0.4",
"description": "A feature to remind you of your favorite color",
"options": {
"favorite": {
Expand Down
18 changes: 18 additions & 0 deletions .devcontainer/features/colorthree/devcontainer-feature.json
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"
}
70 changes: 70 additions & 0 deletions .devcontainer/features/colorthree/install.sh
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

0 comments on commit 5fbe9bf

Please sign in to comment.