From 7fb554740ac2d0915f5c449d9996d2697d332557 Mon Sep 17 00:00:00 2001 From: Luke Date: Fri, 31 Dec 2021 11:22:27 -0800 Subject: [PATCH] merge to master. --- .gitignore | 1 + 0-builder | 42 +++++++++++++++++++++ aliases.sh | 3 ++ 0-loader => archive/0-loader | 0 hostname/kusanagi.sh | 4 ++ misc.sh | 5 ++- path_enviornment.sh | 73 +++++++++++++----------------------- 7 files changed, 79 insertions(+), 49 deletions(-) create mode 100644 0-builder rename 0-loader => archive/0-loader (100%) create mode 100644 hostname/kusanagi.sh diff --git a/.gitignore b/.gitignore index 727bc05..9f15caa 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,2 @@ .directory +1-compiled diff --git a/0-builder b/0-builder new file mode 100644 index 0000000..d8e34e8 --- /dev/null +++ b/0-builder @@ -0,0 +1,42 @@ +#!/bin/bash +export IFS=$'\n' + +BASHRC_D="$HOME/.bashrc.d" +COMPILED_SRC="$BASHRC_D/1-compiled" +echo "Rebuilding $COMPILED_SRC" + +echo """#!/bin/bash +# COMPILED AUTOMAGICALLY AT """$(date -I)""" + +""" > $COMPILED_SRC + +SELF_SRC=$(readlink -f $0) +for F in $(find $BASHRC_D -maxdepth 1 -iname "*.sh"); do + echo " Building in $F" + echo "##################" >> $COMPILED_SRC + echo "# $(basename $F)" >> $COMPILED_SRC + echo "##################" >> $COMPILED_SRC + cat $F >> $COMPILED_SRC + echo "" >> $COMPILED_SRC +done + +HOST_SPECIFIC_SRC="$BASHRC_D/hostname/$(hostname).sh" +if [[ -e $HOST_SPECIFIC_SRC ]]; then + echo "Adding host specific file $HOST_SPECIFIC_SRC" + echo "##################" >> $COMPILED_SRC + echo "# $(basename $HOST_SPECIFIC_SRC)" >> $COMPILED_SRC + echo "##################" >> $COMPILED_SRC + cat $HOST_SPECIFIC_SRC >> $COMPILED_SRC + echo "" >> $COMPILED_SRC +else + echo "No host specific file found at $HOST_SPECIFIC_SRC" +fi + +echo "##################" >> $COMPILED_SRC +echo "# Reloader Script" >> $COMPILED_SRC +echo """################## +function __rebuild_bashrcd() { + bash """$SELF_SRC""" +} +""" >> $COMPILED_SRC + diff --git a/aliases.sh b/aliases.sh index df2de79..42cbbbc 100644 --- a/aliases.sh +++ b/aliases.sh @@ -27,6 +27,9 @@ alias fdiff="sdiff -t --tabsize=4 -w \$(tput cols) -b" alias rsync-prog="rsync -Pav" alias parallel="parallel --no-notice" +export IDF_TOOLS_PATH=/opt/esp +alias get_idf=". ${IDF_TOOLS_PATH}/esp-idf/export.sh" + if [[ -e /opt/eagle/eagle/eagle ]]; then alias eagle=$(readlink -f /opt/eagle/eagle/eagle) fi diff --git a/0-loader b/archive/0-loader similarity index 100% rename from 0-loader rename to archive/0-loader diff --git a/hostname/kusanagi.sh b/hostname/kusanagi.sh new file mode 100644 index 0000000..237873a --- /dev/null +++ b/hostname/kusanagi.sh @@ -0,0 +1,4 @@ +#!/bin/bash +export GTK_IM_MODULE=ibus +export XMODIFIERS=@im=ibus +export QT_IM_MODULE=ibus diff --git a/misc.sh b/misc.sh index 5442198..a3a6552 100644 --- a/misc.sh +++ b/misc.sh @@ -9,6 +9,7 @@ if [[ -e /usr/share/autojump/autojump.sh ]]; then fi export LESS=R # colorize less output if we use a pipe -HISTSIZE=2000 -HISTFILESIZE=10000 +export HISTSIZE=10000 +export HISTFILESIZE=20000 +export HISTIGNORE='pwd:exit:fg:bg:top:clear:history:ls:uptime:df' \ No newline at end of file diff --git a/path_enviornment.sh b/path_enviornment.sh index 8b6811a..28cb61c 100644 --- a/path_enviornment.sh +++ b/path_enviornment.sh @@ -28,6 +28,13 @@ function pathStrip() { ##################################################################### # A function to load enviornment variables ##################################################################### +function loadBinDir() { + DIR_EXPAND=$(readlink -f "$1") + if [ -d "$DIR_EXPAND"]; then + pathSTripAdd "$DIR_EXPAND/bin" "$2" + fi +} + function loadDirectory() { DIR_EXPAND=$(readlink -f "$1") if [ -d "$DIR_EXPAND" ] ; then @@ -49,18 +56,30 @@ function loadDirectory() { export ACLOCAL_FLAGS="-I $DIR_EXPAND/share/aclocal $ACLOCAL_FLAGS" fi fi - } ########### +# Load information that is in any extra random installed directory. +__LOAD_DIRS=( + /opt/poke + /opt/fpga + /opt/makemkv + /opt/icestorm + /opt/gemini + $HOME/.gem/ruby/2.7.0 +) +for DIR_EXPAND in ${__LOAD_DIRS[@]}; do + loadDirectory $DIR_EXPAND +done +unset DIR_EXPAND __LOAD_DIRS + # set PATH so it includes user's private bin if it exists -if [ -d "$HOME/bin" ] ; then - pathStripAdd "$HOME/bin" front -fi -if [ -d "$HOME/.bin" ] ; then - pathStripAdd "$HOME/.bin" front -fi +__LOAD_PATHS=("$HOME/.cargo/bin" "$HOME/bin" "$HOME/.bin" ) +for DIR_EXPAND in ${__LOAD_PATHS[@]}; do + pathStripAdd "$DIR_EXPAND" front +done +unset DIR_EXPAND __LOAD_PATHS # And load the local directory if [ -d "$HOME/.local" ] ; then @@ -70,43 +89,3 @@ if [ -d "$HOME/.local" ] ; then export XDG_DATA_HOME="$HOME/.local/share" fi fi - -# Load information that is in any extra random installed directory. -__LOAD_DIRS=(/opt/fpga /opt/makemkv /opt/icestorm) -for DIR_EXPAND in ${__LOAD_DIRS[*]}; do - loadDirectory $DIR_EXPAND -done -unset DIR_EXPAND __LOAD_DIRS - -## This block was a legacy bit from when I spent so much time screwing around -# with Macports and had really janky enviornment varables. I don't need this -# anymore because the loader is now mature enough to not randomly throw garbage -# into the enviornment variables. This code is left simply for legacy purposes -# as an example of what you end up writing if you really have no idea what your -# doing (also known as learning!). -## CLEAN these variables -#__VAR_PTR_LST=(PKG_CONFIG_PATH LD_RUN_PATH LD_LIBRARY_PATH) -#for __VAR_PTR in ${__VAR_PTR_LST[*]} -#do -# # get the value in the pointer -# eval __VAR_VAL=\$$__VAR_PTR -# if [ ${#__VAR_VAL} -gt 0 ]; then -# # Strip ending : or leading : if exists. -# if [ ${__VAR_VAL: -1} == ":" ]; then -# __VAR_VAL=${__VAR_VAL:0:-1} -# fi -# if [ ${__VAR_VAL:0:1} == ":" ]; then -# __VAR_VAL=${__VAR_VAL:1} -# fi -# while [[ $__VAR_VAL == *"::"* ]]; do -# __VAR_VAL=${__VAR_VAL/::/:} -# done -# while [[ $__VAR_VAL == *"/:"* ]]; do -# __VAR_VAL=${__VAR_VAL/\/:/:} -# done -# # save the cleaned result -# eval $__VAR_PTR=$__VAR_VAL -# #echo $__VAR_PTR "=" $__VAR_VAL -# fi -#done -#unset __VAR_PTR_LST __VAR_PTR __VAR_VAL