This commit is contained in:
Nabin Nepal 2018-06-24 05:09:26 +00:00 committed by GitHub
commit 0d2224cb7c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
2 changed files with 22 additions and 9 deletions

View file

@ -135,6 +135,15 @@ If you'd like to change the install directory with the `ZSH` environment variabl
```shell ```shell
export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)" export ZSH="$HOME/.dotfiles/oh-my-zsh"; sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
``` ```
#### Custom Configuration folder
The default folder is `~` (hidden in your home directory)
If you'd like to install for a different user in a custom home folder path, you can specify that with `ZSHRC_PATH` environment variable, either by running `export ZSHRC_PATH=/home/custom_user` before installing, or by setting it before the end of the install pipeline like this:
```shell
export ZSHRC_PATH="/home/custom_user"; sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
```
#### Manual Installation #### Manual Installation

View file

@ -29,8 +29,12 @@ main() {
exit exit
fi fi
if [ ! -n "$ZSHRC_PATH" ]; then
ZSHRC_PATH=~
fi
if [ ! -n "$ZSH" ]; then if [ ! -n "$ZSH" ]; then
ZSH=~/.oh-my-zsh ZSH=$ZSHRC_PATH/.oh-my-zsh
fi fi
if [ -d "$ZSH" ]; then if [ -d "$ZSH" ]; then
@ -66,17 +70,17 @@ main() {
printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n" printf "${BLUE}Looking for an existing zsh config...${NORMAL}\n"
if [ -f ~/.zshrc ] || [ -h ~/.zshrc ]; then if [ -f $ZSHRC_PATH/.zshrc ] || [ -h $ZSHRC_PATH/.zshrc ]; then
printf "${YELLOW}Found ~/.zshrc.${NORMAL} ${GREEN}Backing up to ~/.zshrc.pre-oh-my-zsh${NORMAL}\n"; printf "${YELLOW}Found $ZSHRC_PATH/.zshrc.${NORMAL} ${GREEN}Backing up to $ZSHRC_PATH/.zshrc.pre-oh-my-zsh${NORMAL}\n";
mv ~/.zshrc ~/.zshrc.pre-oh-my-zsh; mv $ZSHRC_PATH/.zshrc $ZSHRC_PATH/.zshrc.pre-oh-my-zsh;
fi fi
printf "${BLUE}Using the Oh My Zsh template file and adding it to ~/.zshrc${NORMAL}\n" printf "${BLUE}Using the Oh My Zsh template file and adding it to $ZSHRC_PATH/.zshrc${NORMAL}\n"
cp "$ZSH"/templates/zshrc.zsh-template ~/.zshrc cp "$ZSH"/templates/zshrc.zsh-template $ZSHRC_PATH/.zshrc
sed "/^export ZSH=/ c\\ sed "/^export ZSH=/ c\\
export ZSH=\"$ZSH\" export ZSH=\"$ZSH\"
" ~/.zshrc > ~/.zshrc-omztemp " $ZSHRC_PATH/.zshrc > $ZSHRC_PATH/.zshrc-omztemp
mv -f ~/.zshrc-omztemp ~/.zshrc mv -f $ZSHRC_PATH/.zshrc-omztemp $ZSHRC_PATH/.zshrc
# If this user's login shell is not already "zsh", attempt to switch. # If this user's login shell is not already "zsh", attempt to switch.
TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)') TEST_CURRENT_SHELL=$(expr "$SHELL" : '.*/\(.*\)')
@ -101,7 +105,7 @@ main() {
echo ' /____/ ....is now installed!' echo ' /____/ ....is now installed!'
echo '' echo ''
echo '' echo ''
echo 'Please look over the ~/.zshrc file to select plugins, themes, and options.' echo 'Please look over the $ZSHRC_PATH/.zshrc file to select plugins, themes, and options.'
echo '' echo ''
echo 'p.s. Follow us at https://twitter.com/ohmyzsh.' echo 'p.s. Follow us at https://twitter.com/ohmyzsh.'
echo '' echo ''