From de43f28f78d1a728be4aa73960a4e234a167e250 Mon Sep 17 00:00:00 2001 From: "kebler.net" Date: Sat, 30 Jan 2021 11:58:19 -0800 Subject: [PATCH] refactored startup script, removed as function so it can be sourced immediately, needed this so that startup scripts sourced can export to main login environment. changed startup in setup in /etc/profile.d accordingly so it sources intead of calls async for the same reason add notify module with login_notify to delay notification until user is logged in added lag to alias, and made load debug module is load in file module. --- alias/00-basic | 1 + modules/utility/file.lib | 1 + modules/utility/notify.sh | 8 ++++++++ setup/etc/profile | 2 +- setup/etc/profile.d/03-startup.sh | 5 +++-- startup.sh | 14 +------------- 6 files changed, 15 insertions(+), 16 deletions(-) create mode 100644 modules/utility/notify.sh diff --git a/alias/00-basic b/alias/00-basic index 7f6edc9..407a12f 100644 --- a/alias/00-basic +++ b/alias/00-basic @@ -37,6 +37,7 @@ alias grep='grep --color' alias ls='ls -F --color=auto' alias l='ls' alias la='ls -a' +alias lag='ls -a | grep' alias ll='ls -l' alias lla='ls -l -a' alias llag='ls -l -a | grep' diff --git a/modules/utility/file.lib b/modules/utility/file.lib index be7c0f0..817f95b 100644 --- a/modules/utility/file.lib +++ b/modules/utility/file.lib @@ -1,6 +1,7 @@ #!/bin/bash # export BASH_DEBUG=true +module_load debug build_file () { [[ -f "$2" ]] || (echo "output file $2 does not exist";return 1) diff --git a/modules/utility/notify.sh b/modules/utility/notify.sh new file mode 100644 index 0000000..b8ee688 --- /dev/null +++ b/modules/utility/notify.sh @@ -0,0 +1,8 @@ +function dtnotify () { + (notify-send "$1") & +} + +function login_notify () { + (sleep 10;notify-send "$1") & +} + diff --git a/setup/etc/profile b/setup/etc/profile index b202743..682e317 100644 --- a/setup/etc/profile +++ b/setup/etc/profile @@ -18,7 +18,7 @@ export PATH=/bin:/usr/bin:/usr/local/bin # set directory for base shell repo export BASH_SHELL_BASE=THISWILLCHANGEDBYDEPLOYSCRIPT # now bootstrap by souring the shell repo envinroment -. $BASH_SHELL_BASE/shell.env +source $BASH_SHELL_BASE/shell.env # uncomment to NOT load the BASH SHELL Repos for interactive login shell # NO_LOGIN_BASHRC=true if [[ $- == *i* ]]; then # interactive? diff --git a/setup/etc/profile.d/03-startup.sh b/setup/etc/profile.d/03-startup.sh index 29ac0b9..42bd158 100755 --- a/setup/etc/profile.d/03-startup.sh +++ b/setup/etc/profile.d/03-startup.sh @@ -3,7 +3,8 @@ if [ "$SHELL" = "/bin/bash" ] && [ "${BASH_SHELL_STARTUP}" ] && [ "$(ps -o comm= $PPID)" != "su" ]; then # uncomment for debugging if [[ -f $BASH_SHELL_STARTUP ]] && [[ $EUID -ne 0 ]]; then - llog "running startup script $BASH_SHELL_STARTUP async" - (${BASH_SHELL_STARTUP}) & + llog "sourcing startup script $BASH_SHELL_STARTUP" + # (${BASH_SHELL_STARTUP}) & + source ${BASH_SHELL_STARTUP} fi fi diff --git a/startup.sh b/startup.sh index 003b431..f73728d 100755 --- a/startup.sh +++ b/startup.sh @@ -1,18 +1,10 @@ #!/bin/bash -function startup_load () { -local SDIRS -local SDIR -local DIRS -local DIR -local excludes - [[ $(declare -F | grep module_load) ]] && echo module lib already loaded || source "$BASH_SHELL_BASE/module.lib" module_load file [[ $? -ne 0 ]] && echo unable to access the file module, aboarting load && return 1 - -[[ $1 ]] && DIRS=($1) || DIRS=(${BASH_SHELL_DIRS}) +DIRS=(${BASH_SHELL_DIRS}) # llog "startup directories to try ${DIRS[*]}" SDIRS=() j=0 @@ -34,7 +26,3 @@ IGNORE_FILE="$([[ -f "$DIR/.bash-shell-ignore" ]] && echo "$DIR" || echo "$BASH_ llog "startup dir to source $SDIR" source_dir -f "$IGNORE_FILE" -d 0 $SDIR done -} - -# if script was executed then call the function -(return 0 2>/dev/null) || startup_load