aboutsummaryrefslogtreecommitdiffstats
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/usr/lib/sh/loading.sh23
1 files changed, 23 insertions, 0 deletions
diff --git a/lib/usr/lib/sh/loading.sh b/lib/usr/lib/sh/loading.sh
new file mode 100644
index 0000000..47c396a
--- /dev/null
+++ b/lib/usr/lib/sh/loading.sh
@@ -0,0 +1,23 @@
+load_machine_config() {
+ directory="$1"
+ path="${HOME}/${directory}/$(hostname).sh"
+
+ # shellcheck source=/dev/null
+ [ -x "$path" ] && . "$path"
+
+ unset directory
+ unset path
+}
+
+load_config_directory() {
+ directory="$1"
+ path="${HOME}/${directory}"
+
+ if [ -d "${path}" ]; then
+ for f in "${path}/"?*.sh; do
+ # shellcheck source=/dev/null
+ [ -x "$f" ] && . "$f"
+ done
+ unset f
+ fi
+}