summaryrefslogtreecommitdiffstats
path: root/packaging/macos/jhb/etc/jhb.conf.sh
blob: 398e9d32cf71afbc49c6ab0b43b096ac4029e99d (plain)
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
# SPDX-FileCopyrightText: 2022 René de Hesselle <dehesselle@web.de>
#
# SPDX-License-Identifier: GPL-2.0-or-later

### description ################################################################

# This is a convenience wrapper to source all individual configuration files.
# It also takes care of placing a custom configuration file in the appropriate
# location.

### shellcheck #################################################################

# shellcheck shell=bash # no shebang as this file is intended to be sourced

### dependencies ###############################################################

SELF_DIR=$(cd "$(dirname "${BASH_SOURCE[0]}")" || exit 1; pwd)

CUSTOM_CONFIG=$SELF_DIR/jhb-custom.conf.sh
# copy a custom configuration file to the appropriate place
if [[ $1 == *.conf.sh ]] && [ -f "$1" ]; then
  cp "$1" "$CUSTOM_CONFIG"
fi

# source a custom configuration file if present
if [ -f "$CUSTOM_CONFIG" ]; then
  # shellcheck disable=SC1090 # file is optional
  source "$CUSTOM_CONFIG"
fi
unset CUSTOM_CONFIG

# source items from jhb.conf directory
for CONFIG_ITEM in $(\
      "$SELF_DIR"/../usr/bin/run-parts list "$SELF_DIR"/jhb.conf/'*.sh' \
    ); do
  # shellcheck disable=SC1090 # can't point to a single source here
  source "$CONFIG_ITEM"
done
unset CONFIG_ITEM

unset SELF_DIR

### variables ##################################################################

# Nothing here.

### functions ##################################################################

# Nothing here.

### main #######################################################################

# Nothing here.