-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Move certain shell functions to library.
These functions are either used by several scripts or will be in the future. Move them to library to uphold DRY principle.
- Loading branch information
Showing
5 changed files
with
40 additions
and
40 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
#!/usr/bin/env bash | ||
|
||
# EOP filter (required due to the unconfigurable EOP marker in pyDKB) | ||
eop_filter() { | ||
sed -e"s/\\x00//g" | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env bash | ||
|
||
get_config_lib=$(cd "$(dirname "$BASH_SOURCE")"; pwd) | ||
source $get_config_lib/log | ||
|
||
# Find configuration file in $CONFIG_PATH | ||
get_config() { | ||
[ -z "$1" ] && log ERROR "get_config(): no arguments passed." && return 1 | ||
[ -z "$CONFIG_PATH" ] && CONFIG_PATH=`pwd` | ||
dirs=$CONFIG_PATH | ||
while [ -n "$dirs" ]; do | ||
dir=${dirs%%:*} | ||
[ "$dirs" = "$dir" ] && \ | ||
dirs='' || \ | ||
dirs="${dirs#*:}" | ||
[ -f "${dir}/${1}" ] && readlink -f "${dir}/${1}" && return 0 | ||
done | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
#!/usr/bin/env bash | ||
|
||
log() { | ||
level=INFO | ||
[ $# -eq 2 ] && level="$1" && shift | ||
[ -z "$SCRIPT_NAME" ] && SCRIPT_NAME="$(basename "$0")" | ||
msg="$1" | ||
echo "($level) `date +'%d-%m-%Y %T'` ($SCRIPT_NAME) $msg" >&2 | ||
} |