shell-base/function/startup
David Kebler e25e44a98d added setup directory with set of user and system source files that can be copied in new machine
changed setup.sh to load.sh
startup only loads system repos by default and allows passing directory argument
2020-11-10 14:09:08 -08:00

35 lines
748 B
Bash

#!/bin/bash
function startup_load () {
local SDIRS
local SDIR
local DIRS
DIRS=( \
$BASH_SHELL_HOST/$(hostname)
$BASH_SHELL_HOST/all \
$BASH_SHELL_NETWORK/$NETWORKNAME \
$BASH_SHELL_NETWORK/all \
$BASH_SHELL_BASE \
)
[[ $1 ]] && DIRS=("$1")
echo startup ${DIRS[@]}
SDIRS=()
j=0
cnt=${#DIRS[@]}
for ((i=0;i<cnt;i++)); do
DIR="${DIRS[i]}/startup"
[ -d $DIR ] && SDIRS[j]=$DIR && j+=1
done
# STARTUP_DIRS is array of any other startup directores where scripts may be loaded from
[ $STARTUP_DIRS ] && SDIRS=("$STARTUP_DIRS" "${SDIRS[@]}")
# echo -e "Statup Directories to source \n ${SDIRS[@]} \n"
for SDIR in "${SDIRS[@]}"
do
# echo startup dir to source $SDIR
source_dir -p "archive" -x '"*.off" "*.md"' -d 0 $SDIR
done
}