Moar fixes to sourcerers.

DEBUG variable force in config loader. If variable isn't defined - force it to be 0.
This commit is contained in:
Stanislav Nikitin 2015-03-21 20:30:55 +05:00
parent 1babd0fb06
commit 9eb7e2a012
5 changed files with 21 additions and 15 deletions

View File

@ -1,10 +1,9 @@
# Configuration file loader.
if [ ! -d ${HOME}/.zsh-config.d/ ]; then
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/'"
fi
for file in `find ${HOME}/.zsh-config.d/ -type f -depth 1 | sort`; do
source ${file}
for file in `find ${HOME}/.zsh-config.d/ -maxdepth 1 -type f -exec basename {} \; | sort`; do
source "${HOME}/.zsh-config.d/${file}"
done

View File

@ -2,4 +2,12 @@
# this configuration.
OS=`uname`
OS_RELEASE=`uname -r`
OS_RELEASE=`uname -r`
# Variable forcers.
# If DEBUG isn't defined - force it to be 0.
if [ -z ${DEBUG} ]; then
DEBUG=0
return 1
fi

View File

@ -1,13 +1,13 @@
# Some default exports. They could be based on configuration variables.
for config_file in `find ${CONFIG_PATH}/zsh/exports -type f | sort`; do
source ${config_file}
for config_file in `find ${CONFIG_PATH}/zsh/exports -type f -exec basename {} \; | sort`; do
source "${CONFIG_PATH}/zsh/exports/${config_file}"
done
# We should import user-specific exports and use them.
if [ -d ${HOME}/.zsh-config.d/exports ]; then
for config_file in `find ${HOME}/.zsh-config.d/exports -type f | sort`; do
for config_file in `find ${HOME}/.zsh-config.d/exports -type f -exec basename {} \; | sort`; do
if [ -f ${config_file} ]; then
source ${config_file}
source "${HOME}/.zsh-config.d/exports/${config_file}"
fi
done
fi

View File

@ -7,14 +7,14 @@ alias screen="TERM=xterm screen"
alias clocksync="sudo ntpdate 0.pool.ntp.org"
alias got="git"
for item in `find ${CONFIG_PATH}/zsh/aliases -type f | sort`; do
source ${item}
for item in `find "${CONFIG_PATH}/zsh/aliases" -type f -exec basename {} \; | sort`; do
source "${CONFIG_PATH}/zsh/aliases/${item}"
done
if [ -d "${HOME}/.zsh-config.d/aliases" ]; then
for item in `find ${HOME}/.zsh-config.d/aliases -type f | sort`; do
if [ -f ${item} ]; then
source ${item}
for item in `find "${HOME}/.zsh-config.d/aliases" -type f -exec basename {} \; | sort`; do
if [ -f "${HOME}/.zsh-config.d/aliases/${item}" ]; then
source "${HOME}/.zsh-config.d/aliases/${item}"
fi
done
fi

View File

@ -63,7 +63,6 @@ function check_debug() {
# - 1: this debug level should not be printed.
local DEBUG_LVL=$1
if [ ${DEBUG_LVL} -le ${DEBUG} ]; then
return 0
else