Logger: defaulting debug level to zero.
While loading configuration it will check for new config files and copy them to user's home directory.
This commit is contained in:
parent
158a492a8e
commit
e284e32b74
@ -1,9 +1,20 @@
|
|||||||
# Configuration file loader.
|
# Configuration file loader.
|
||||||
if [ ! -d ${HOME}/.zsh-config.d/ ]; then
|
if [ ! -d ${HOME}/.zsh-config.d/ ]; then
|
||||||
|
log 1 "Copying configuration to user's home directory..."
|
||||||
cp -R "${CONFIG_PATH}/zsh/defaults/" ${HOME}/.zsh-config.d
|
cp -R "${CONFIG_PATH}/zsh/defaults/" ${HOME}/.zsh-config.d
|
||||||
echo "Looks like it's a very first launch. So I've copied default config to '${HOME}/.zsh-config.d/'"
|
echo "Looks like it's a very first launch. So I've copied default config to '${HOME}/.zsh-config.d/'"
|
||||||
fi
|
fi
|
||||||
|
|
||||||
for file in `find ${HOME}/.zsh-config.d/ -maxdepth 1 -type f -exec basename {} \; | sort`; do
|
for file in `find ${HOME}/.zsh-config.d/ -maxdepth 1 -type f -exec basename {} \; | sort`; do
|
||||||
|
log 1 "Loading configuration file: ${file}"
|
||||||
source "${HOME}/.zsh-config.d/${file}"
|
source "${HOME}/.zsh-config.d/${file}"
|
||||||
done
|
done
|
||||||
|
|
||||||
|
log 1 "Checking for configuration consistency..."
|
||||||
|
for file in `find ${CONFIG_PATH}/zsh/defaults/ -maxdepth 1 -type f -exec basename {} \; | sort`; do
|
||||||
|
if [ ! -f "${HOME}/.zsh-config.d/${file}" ]; then
|
||||||
|
cp "${CONFIG_PATH}/zsh/defaults/${file}" "${HOME}/.zsh-config.d/${file}"
|
||||||
|
log 0 "New configuration file '${file}' copied to your home directory (${HOME}/.zsh-config.d/)."
|
||||||
|
log 0 "Don't forget to take a look and configure, if neccessary!"
|
||||||
|
fi
|
||||||
|
done
|
||||||
|
@ -17,6 +17,18 @@ function log() {
|
|||||||
fi
|
fi
|
||||||
}
|
}
|
||||||
|
|
||||||
|
# We are defaulting our DEBUG level to 0.
|
||||||
|
# This value can be overriden with prepending "DEBUG=1" while launching
|
||||||
|
# this script.
|
||||||
|
# DEBUG_LEVEL will be taken from configuration.
|
||||||
|
if [ -z ${DEBUG_LEVEL} ]; then
|
||||||
|
DEBUG_LEVEL=0
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ -z ${DEBUG} ]; then
|
||||||
|
DEBUG=0
|
||||||
|
fi
|
||||||
|
|
||||||
function log_common() {
|
function log_common() {
|
||||||
# Executes some common things for logs.
|
# Executes some common things for logs.
|
||||||
local DEBUG_LVL=$1
|
local DEBUG_LVL=$1
|
||||||
|
Loading…
Reference in New Issue
Block a user