mirror of
https://github.com/opensiriusfox/bashrc.d.git
synced 2025-06-17 04:40:32 -07:00
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.
This commit is contained in:
parent
4a75f67b98
commit
148ef9e7ba
6 changed files with 60 additions and 5 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1 +1,2 @@
|
||||||
.directory
|
.directory
|
||||||
|
1-compiled
|
||||||
|
|
42
0-builder
Normal file
42
0-builder
Normal file
|
@ -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
|
||||||
|
|
4
hostname/kusanagi.sh
Normal file
4
hostname/kusanagi.sh
Normal file
|
@ -0,0 +1,4 @@
|
||||||
|
#!/bin/bash
|
||||||
|
export GTK_IM_MODULE=ibus
|
||||||
|
export XMODIFIERS=@im=ibus
|
||||||
|
export QT_IM_MODULE=ibus
|
5
misc.sh
5
misc.sh
|
@ -9,6 +9,7 @@ if [[ -e /usr/share/autojump/autojump.sh ]]; then
|
||||||
fi
|
fi
|
||||||
|
|
||||||
export LESS=R # colorize less output if we use a pipe
|
export LESS=R # colorize less output if we use a pipe
|
||||||
HISTSIZE=2000
|
export HISTSIZE=10000
|
||||||
HISTFILESIZE=10000
|
export HISTFILESIZE=20000
|
||||||
|
|
||||||
|
export HISTIGNORE='pwd:exit:fg:bg:top:clear:history:ls:uptime:df'
|
|
@ -61,15 +61,22 @@ function loadDirectory() {
|
||||||
|
|
||||||
###########
|
###########
|
||||||
# Load information that is in any extra random installed directory.
|
# 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)
|
__LOAD_DIRS=(
|
||||||
for DIR_EXPAND in ${__LOAD_DIRS[*]}; do
|
/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
|
loadDirectory $DIR_EXPAND
|
||||||
done
|
done
|
||||||
unset DIR_EXPAND __LOAD_DIRS
|
unset DIR_EXPAND __LOAD_DIRS
|
||||||
|
|
||||||
# set PATH so it includes user's private bin if it exists
|
# set PATH so it includes user's private bin if it exists
|
||||||
__LOAD_PATHS=("$HOME/.cargo/bin" "$HOME/bin" "$HOME/.bin" )
|
__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
|
pathStripAdd "$DIR_EXPAND" front
|
||||||
done
|
done
|
||||||
unset DIR_EXPAND __LOAD_PATHS
|
unset DIR_EXPAND __LOAD_PATHS
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue