-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathsource.sh
More file actions
105 lines (86 loc) · 2.67 KB
/
Copy pathsource.sh
File metadata and controls
105 lines (86 loc) · 2.67 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
. "${HOLY_PREP}"
holy-time start "holy-time start"
#
export THIS_HOME="$HOLY_HOME"
# see it unset at the end of this source.sh
# exists for more concise calls of holy-dot
# thus this-that needs no path arg, for the time being...
# only ever an issue when sourcing from the outside, e.g. ~/.bashrc, etc.
# essential for code portability between blesstheos and dots or its forks -
# it is an indicator of bootstrapping in progress...
# OS has holy and wide variety of holy-one-on ways to check that it's all good
holy-one() {
# $1 option:
# level 0 is silent (the default)
# level 1 is verbose about not finding a $HOLY_HOME
# level 2 or whatever else will delegate to holy on
local level="${1-0}"
local holy="$HOLY_HOME"/holy
local wtf="Very odd that \$HOLY_HOME has no holy in it!"
command -v $holy > /dev/null
local status=$?
if [[ $level == "0" || $level == "1" ]]; then
if [ -z "$HOLY_HOME" ]; then
[ $level == "1" ] && echo "\$HOLY_HOME not set!"
return 1
elif ! [ -d "$HOLY_HOME" ]; then
[ $level == "1" ] && echo "\$HOLY_HOME dir of $HOLY_HOME is Not Found!"
return 1
else
[[ $level == "1" && $status -ne 0 ]] && \
echo $wtf
return $status
fi
elif [ $status -eq 0 ]; then
# any other / unknown level delegates to $holy
$holy one on
else
# holy is not known
echo $wtf
false; return
fi
}
export -f holy-one
# holy-one and core.sh functions to bootstrap with
if holy-one 1; then
. "${HOLY_HOME}/core.sh"
holy-time --run holy-export -f "${HOLY_HOME}/core.sh"
else
# holy-one somehow isn't on, unexpected but possible
# clean-up here
unset THIS_HOME
holy-time -l "#bail ${HOLY_HOME}/source.sh" done
return 1
fi
# exports $LEAD_HOME
holy-sort
if tis-true $HOLY_SOURCE; then
holy-dot -x src/
# or get more fancy, such as:
# holy-dot -x $(find "${HOLY_HOME}/src" -type f | grep '.sh$')
else
# must be sourced, maybe exported:
holy-dot -x src/os.sh
fi
holy-time --marker --label "sourced core functions" tell
PATH-add \
${HOLY_HOME}/cmd \
${HOLY_HOME}/bin-fn
holy-dot --time use/ colors term aliases git jump rundev
# bash-only stuff
[ -n "$BASH" ] && holy-dot use/bash
umask 022
export HISTSIZE=10000 # much?
export HISTCONTROL=ignoredups
shopt -s checkwinsize # After each command, checks the windows size and changes lines and columns
#shopt -s globstar # research...
holy-time --marker tell
# platforms for programming / runtime
for src in $(ls "${HOLY_HOME}/use/platform"/* | grep -v .skip); do
holy-dot --time "$src"
done
# so far the PATH pas been added to from many places
holy-dot use/path
unset THIS_HOME
holy-time -l "ALL" -m tell
holy-time -l "${HOLY_HOME}/source.sh" done