From 6e8171b23b39c2ad16af487512f82cef933f2195 Mon Sep 17 00:00:00 2001 From: Richard Cunningham Date: Fri, 22 Nov 2024 09:49:05 +0000 Subject: [PATCH] Create diamond-bash-config and general cleanup --- .../features/color/devcontainer-feature.json | 21 ------ .devcontainer/features/color/install.sh | 26 ------- .../colorthree/devcontainer-feature.json | 18 ----- .../colortwo/devcontainer-feature.json | 6 -- .devcontainer/features/colortwo/install.sh | 5 -- .../devcontainer-feature.json | 7 +- .../install.sh | 0 .../features/terminalhistory/install.sh | 70 ------------------- 8 files changed, 4 insertions(+), 149 deletions(-) delete mode 100644 .devcontainer/features/color/devcontainer-feature.json delete mode 100644 .devcontainer/features/color/install.sh delete mode 100644 .devcontainer/features/colorthree/devcontainer-feature.json delete mode 100644 .devcontainer/features/colortwo/devcontainer-feature.json delete mode 100644 .devcontainer/features/colortwo/install.sh rename .devcontainer/features/{terminalhistory => diamond-bash-config}/devcontainer-feature.json (61%) rename .devcontainer/features/{colorthree => diamond-bash-config}/install.sh (100%) delete mode 100644 .devcontainer/features/terminalhistory/install.sh diff --git a/.devcontainer/features/color/devcontainer-feature.json b/.devcontainer/features/color/devcontainer-feature.json deleted file mode 100644 index 82b83c9..0000000 --- a/.devcontainer/features/color/devcontainer-feature.json +++ /dev/null @@ -1,21 +0,0 @@ -{ - "name": "My Favorite Color", - "id": "color", - "version": "1.0.4", - "description": "A feature to remind you of your favorite color", - "options": { - "favorite": { - "type": "string", - "enum": [ - "red", - "gold", - "green" - ], - "default": "red", - "description": "Choose your favorite color." - } - }, - "installsAfter": [ - "ghcr.io/devcontainers/features/common-utils" - ] -} \ No newline at end of file diff --git a/.devcontainer/features/color/install.sh b/.devcontainer/features/color/install.sh deleted file mode 100644 index 0c0c1ee..0000000 --- a/.devcontainer/features/color/install.sh +++ /dev/null @@ -1,26 +0,0 @@ -#!/bin/sh -set -e - -echo "Activating feature 'color'" -echo "The provided favorite color is: ${FAVORITE}" - - -# The 'install.sh' entrypoint script is always executed as the root user. -# -# These following environment variables are passed in by the dev container CLI. -# These may be useful in instances where the context of the final -# remoteUser or containerUser is useful. -# For more details, see https://containers.dev/implementors/features#user-env-var -echo "The effective dev container remoteUser is '$_REMOTE_USER'" -echo "The effective dev container remoteUser's home directory is '$_REMOTE_USER_HOME'" - -echo "The effective dev container containerUser is '$_CONTAINER_USER'" -echo "The effective dev container containerUser's home directory is '$_CONTAINER_USER_HOME'" - -cat > /usr/local/bin/color \ -<< EOF -#!/bin/sh -echo "my favorite color is ${FAVORITE}" -EOF - -chmod +x /usr/local/bin/color \ No newline at end of file diff --git a/.devcontainer/features/colorthree/devcontainer-feature.json b/.devcontainer/features/colorthree/devcontainer-feature.json deleted file mode 100644 index c455a07..0000000 --- a/.devcontainer/features/colorthree/devcontainer-feature.json +++ /dev/null @@ -1,18 +0,0 @@ -{ - "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" -} \ No newline at end of file diff --git a/.devcontainer/features/colortwo/devcontainer-feature.json b/.devcontainer/features/colortwo/devcontainer-feature.json deleted file mode 100644 index 0c13b39..0000000 --- a/.devcontainer/features/colortwo/devcontainer-feature.json +++ /dev/null @@ -1,6 +0,0 @@ -{ - "name": "My Next Favorite Color", - "id": "colortwo", - "version": "1.0.3", - "description": "Another feature to remind you of your favorite color" -} \ No newline at end of file diff --git a/.devcontainer/features/colortwo/install.sh b/.devcontainer/features/colortwo/install.sh deleted file mode 100644 index d9739f7..0000000 --- a/.devcontainer/features/colortwo/install.sh +++ /dev/null @@ -1,5 +0,0 @@ -#!/bin/sh -set -e - -echo "Activating feature 'color'" -echo "The provided favorite color is: ${FAVORITE}" \ No newline at end of file diff --git a/.devcontainer/features/terminalhistory/devcontainer-feature.json b/.devcontainer/features/diamond-bash-config/devcontainer-feature.json similarity index 61% rename from .devcontainer/features/terminalhistory/devcontainer-feature.json rename to .devcontainer/features/diamond-bash-config/devcontainer-feature.json index d02d22a..dc918d9 100644 --- a/.devcontainer/features/terminalhistory/devcontainer-feature.json +++ b/.devcontainer/features/diamond-bash-config/devcontainer-feature.json @@ -1,8 +1,9 @@ { -"name": "BASH terminal auto history configuration", - "id": "terminalhistory", +"name": "Lightweight and configurable BASH eternal history", + //ID *must* match parent folder name *exactly* + "id": "diamond-bash-config", "version": "1.0.0", - "description": "Make default BASH terminal nicer", + "description": "Lightweight BASH setup with eternal history and PS1 tweaks. Fully configurable.", "containerEnv": { "CONFIG_FOLDER": "/devcontainer_rc", "CONFIG_STAGING": "/devcontainer_staging" diff --git a/.devcontainer/features/colorthree/install.sh b/.devcontainer/features/diamond-bash-config/install.sh similarity index 100% rename from .devcontainer/features/colorthree/install.sh rename to .devcontainer/features/diamond-bash-config/install.sh diff --git a/.devcontainer/features/terminalhistory/install.sh b/.devcontainer/features/terminalhistory/install.sh deleted file mode 100644 index 01a6cb5..0000000 --- a/.devcontainer/features/terminalhistory/install.sh +++ /dev/null @@ -1,70 +0,0 @@ -#!/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