From 148ef9e7bac9345706af2705c1db5c91631a1914 Mon Sep 17 00:00:00 2001 From: Luke Date: Tue, 28 Dec 2021 11:32:30 -0800 Subject: [PATCH] Added a builder script The build script reduces the amount of IO on the disk when starting a new bash session. This should speed up the startup time of the shell when under heavy IO load. There is also a short reloader command that calls the builder script when things are modified to avoid hot reloading of the scripts in the directory. --- .gitignore | 1 + 0-builder | 42 ++++++++++++++++++++++++++++++++++++ 0-loader => archive/0-loader | 0 hostname/kusanagi.sh | 4 ++++ misc.sh | 5 +++-- path_enviornment.sh | 13 ++++++++--- 6 files changed, 60 insertions(+), 5 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..972515f --- /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 $F)" >> $COMPILED_SRC + echo "##################" >> $COMPILED_SRC + cat $F >> $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/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 b246ae0..28cb61c 100644 --- a/path_enviornment.sh +++ b/path_enviornment.sh @@ -61,15 +61,22 @@ function loadDirectory() { ########### # Load information that is in any extra random installed directory. -__LOAD_DIRS=(/opt/fpga-opentoolforge/current /opt/fpga /opt/makemkv /opt/icestorm /opt/gemini $HOME/.gem/ruby/2.7.0) -for DIR_EXPAND in ${__LOAD_DIRS[*]}; do +__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 __LOAD_PATHS=("$HOME/.cargo/bin" "$HOME/bin" "$HOME/.bin" ) -for DIR_EXPAND in ${__LOAD_PATHS[*]}; do +for DIR_EXPAND in ${__LOAD_PATHS[@]}; do pathStripAdd "$DIR_EXPAND" front done unset DIR_EXPAND __LOAD_PATHS