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

View File

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

View File

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

View File

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