2016-02-27 21:40:47 +08:00
|
|
|
# Copy this file to your non integrated *nix-like environment,
|
|
|
|
# Cygwin/MinGW/MSys2/Git for Windows SDK, installs '/etc/profile.d/'
|
|
|
|
# folder to integrate the externally installed Unix like environment
|
|
|
|
# into Cmder so it has access to settings stored in Cmder/config
|
|
|
|
# folder when launched.
|
2015-11-26 23:32:10 +08:00
|
|
|
#
|
|
|
|
# The destination file extension depends on the shell you use. For example:
|
|
|
|
#
|
|
|
|
# bash - Copy to /etc/profile.d/cmder_exinit.sh
|
|
|
|
# zsh - Copy to /etc/profile.d/cmder_exinit.zsh
|
|
|
|
#
|
|
|
|
# # Uncomment and edit the CMDER_ROOT line to use Cmder/config even when launched
|
|
|
|
# # from outside Cmder.
|
|
|
|
# CMDER_ROOT=${USERPROFILE}/cmder # This is not required if launched from Cmder.
|
|
|
|
|
2016-02-27 21:40:47 +08:00
|
|
|
# Add portable user customizations ${CMDER_ROOT}/config/user-profile.sh or
|
|
|
|
# add whole config scripts to ${CMDER_ROOT}/config/profile.d both will be sourced
|
|
|
|
# from mthis file and be appied to the environment at startup.
|
|
|
|
#
|
|
|
|
# These customizations will follow Cmder if $CMDER_ROOT is copied
|
2015-11-26 23:32:10 +08:00
|
|
|
# to another machine.
|
|
|
|
#
|
|
|
|
# Add system specific users customizations to $HOME/.bashrc, these
|
|
|
|
# customizations will not follow Cmder to another machine.
|
|
|
|
|
2015-12-17 01:37:40 +08:00
|
|
|
# Check that we haven't already been sourced.
|
|
|
|
[[ -z ${CMDER_EXINIT} ]] && CMDER_EXINIT="1" || return
|
|
|
|
|
2015-11-26 23:32:10 +08:00
|
|
|
# We do this for bash as admin sessions since $CMDER_ROOT is not being set
|
|
|
|
if [ "$CMDER_ROOT" = "" -a "$ConEmuDir" != "" ] ; then
|
|
|
|
case "$ConEmuDir" in *\\*) CMDER_ROOT=$( cd "$(cygpath -u "$ConEmuDir")/../.." ; pwd );; esac
|
2015-12-17 01:37:40 +08:00
|
|
|
if [ !-d $CMDER_ROOT/vendor ] ; then
|
|
|
|
echo "Running in ConEmu without Cmder, skipping Cmder integration."
|
|
|
|
return
|
|
|
|
fi
|
2015-11-26 23:32:10 +08:00
|
|
|
elif [ "$CMDER_ROOT" != "" ] ; then
|
|
|
|
case "$CMDER_ROOT" in *\\*) CMDER_ROOT="$(cygpath -u "$CMDER_ROOT")";; esac
|
|
|
|
else
|
2015-12-17 01:37:40 +08:00
|
|
|
return
|
|
|
|
fi
|
|
|
|
|
|
|
|
echo "Using \"CMDER_ROOT\" at \"${CMDER_ROOT}\"...\n"
|
2015-11-26 23:32:10 +08:00
|
|
|
|
|
|
|
# Remove any trailing '/'
|
|
|
|
CMDER_ROOT=$(echo $CMDER_ROOT | sed 's:/*$::')
|
|
|
|
|
|
|
|
export CMDER_ROOT
|
|
|
|
|
|
|
|
PATH=${CMDER_ROOT}/bin:$PATH:${CMDER_ROOT}
|
2015-12-17 01:37:40 +08:00
|
|
|
|
2015-11-26 23:32:10 +08:00
|
|
|
export PATH
|
|
|
|
|
2016-02-27 21:40:47 +08:00
|
|
|
if [ ! -d ${CMDER_ROOT}/config/profile.d ; then
|
|
|
|
mkdir -p ${CMDER_ROOT}/config/profile.d
|
|
|
|
fi
|
|
|
|
|
|
|
|
# Drop *.sh files into "${CMDER_ROOT}\config\profile.d"
|
|
|
|
# to source them at startup.
|
|
|
|
if [ -d ${CMDER_ROOT}/config/profile.d ] ; then
|
|
|
|
pushd ${CMDER_ROOT}/config/profile.d >/dev/null
|
|
|
|
for x in $(ls ${CMDER_ROOT}/config/profile.d/*.sh) ; do
|
|
|
|
# echo ${x}
|
|
|
|
. $x
|
|
|
|
done
|
|
|
|
popd >/dev/null
|
|
|
|
fi
|
|
|
|
|
2015-11-26 23:32:10 +08:00
|
|
|
if [ -f ${CMDER_ROOT}/config/user-profile.sh ] ; then
|
2015-12-17 01:37:40 +08:00
|
|
|
. ${CMDER_ROOT}/config/user-profile.sh
|
2015-11-26 23:32:10 +08:00
|
|
|
else
|
2015-12-17 01:37:40 +08:00
|
|
|
echo Creating user startup file: "${CMDER_ROOT}/config/user-profile.sh"
|
|
|
|
cat <<-eof >"${CMDER_ROOT}/config/user-profile.sh"
|
2015-11-26 23:32:10 +08:00
|
|
|
# use this file to run your own startup commands for msys2 bash'
|
|
|
|
|
|
|
|
# To add a new vendor to the path, do something like:
|
|
|
|
# export PATH=\${CMDER_ROOT}/vendor/whatever:\${PATH}
|
|
|
|
eof
|
|
|
|
fi
|