Skip to content

Commit

Permalink
add custom paths for config
Browse files Browse the repository at this point in the history
  • Loading branch information
ogabriel committed Jul 2, 2024
1 parent 71fe1ef commit 9a03d6b
Showing 1 changed file with 19 additions and 14 deletions.
33 changes: 19 additions & 14 deletions lib/config_functions.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,22 @@
#!/bin/bash
function LoadConfig() {
if [[ -f $config_dir/config.sh ]]; then
Info "Loading config"
source $config_dir/config.sh
fi

: ${system_files_dir:=$config_dir/system/}
: ${user_files_dir:=$config_dir/user/}
: ${sourced_package_dir:=$config_dir/packages/}

for file in $config_dir/*.sh; do
if [[ $file == $config_dir/config.sh ]]; then
continue
else
Info "Loading $file"
source $file
fi
done
}

function User() {
ValidateFunctionParams 1 $# $FUNCNAME
Expand Down Expand Up @@ -49,8 +67,6 @@ function RemovePkg() {
RemovePackage $@
}

sourced_packages_dir=$config_dir/packages/

function Package() {
if [[ $# -eq 1 ]]; then
case $distro in
Expand Down Expand Up @@ -149,8 +165,6 @@ function SystemdUnitSystemMask() {
systemd_unit_system_mask+=($1)
}

system_files_dir=$config_dir/system/

function SystemFile() {
ValidateFunctionParams 1 $# $FUNCNAME

Expand Down Expand Up @@ -241,8 +255,6 @@ function SystemDirectoryFromTo() {
fi
}

user_files_dir=$config_dir/user/

function UserFile() {
ValidateFunctionParams 1 $# $FUNCNAME
ValidateFileName $1
Expand Down Expand Up @@ -321,10 +333,3 @@ function SSHAddKey() {

ssh_add_keys+=($1)
}

function LoadConfig() {
for file in $config_dir/*.sh; do
Info "Loading $file"
source $file
done
}

0 comments on commit 9a03d6b

Please sign in to comment.