mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-03-27 03:14:56 +01:00
merge from upstream
This commit is contained in:
commit
f904b33dd8
234 changed files with 4935 additions and 2648 deletions
|
|
@ -1,12 +1,12 @@
|
|||
#!/bin/sh
|
||||
#
|
||||
# This script should be run via curl:
|
||||
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
# sh -c "$(curl -fsSL https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||
# or wget:
|
||||
# sh -c "$(wget -qO- https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh)"
|
||||
# sh -c "$(wget -qO- https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh)"
|
||||
#
|
||||
# As an alternative, you can first download the install script and run it afterwards:
|
||||
# wget https://raw.githubusercontent.com/robbyrussell/oh-my-zsh/master/tools/install.sh
|
||||
# wget https://raw.githubusercontent.com/ohmyzsh/ohmyzsh/master/tools/install.sh
|
||||
# sh install.sh
|
||||
#
|
||||
# You can tweak the install behavior by setting variables when running the script. For
|
||||
|
|
@ -15,7 +15,7 @@
|
|||
#
|
||||
# Respects the following environment variables:
|
||||
# ZSH - path to the Oh My Zsh repository folder (default: $HOME/.oh-my-zsh)
|
||||
# REPO - name of the GitHub repo to install from (default: robbyrussell/oh-my-zsh)
|
||||
# REPO - name of the GitHub repo to install from (default: ohmyzsh/ohmyzsh)
|
||||
# REMOTE - full remote URL of the git repo to install (default: GitHub via HTTPS)
|
||||
# BRANCH - branch to check out immediately after install (default: master)
|
||||
#
|
||||
|
|
@ -90,7 +90,11 @@ setup_ohmyzsh() {
|
|||
exit 1
|
||||
fi
|
||||
|
||||
git clone --depth=1 --branch "$BRANCH" "$REMOTE" "$ZSH" || {
|
||||
git clone -c core.eol=lf -c core.autocrlf=false \
|
||||
-c fsck.zeroPaddedFilemode=ignore \
|
||||
-c fetch.fsck.zeroPaddedFilemode=ignore \
|
||||
-c receive.fsck.zeroPaddedFilemode=ignore \
|
||||
--depth=1 --branch "$BRANCH" "$REMOTE" "$ZSH" || {
|
||||
error "git clone of oh-my-zsh repo failed"
|
||||
exit 1
|
||||
}
|
||||
|
|
@ -168,29 +172,37 @@ setup_shell() {
|
|||
#*) echo "Invalid choice. Shell change skipped."; return ;;
|
||||
#esac
|
||||
|
||||
# Test for the right location of the "shells" file
|
||||
if [ -f /etc/shells ]; then
|
||||
shells_file=/etc/shells
|
||||
elif [ -f /usr/share/defaults/etc/shells ]; then # Solus OS
|
||||
shells_file=/usr/share/defaults/etc/shells
|
||||
else
|
||||
error "could not find /etc/shells file. Change your default shell manually."
|
||||
return
|
||||
fi
|
||||
# Check if we're running on Termux
|
||||
case "$PREFIX" in
|
||||
*com.termux*) termux=true; zsh=zsh ;;
|
||||
*) termux=false ;;
|
||||
esac
|
||||
|
||||
# Get the path to the right zsh binary
|
||||
# 1. Use the most preceding one based on $PATH, then check that it's in the shells file
|
||||
# 2. If that fails, get a zsh path from the shells file, then check it actually exists
|
||||
if ! zsh=$(which zsh) || ! grep -qx "$zsh" "$shells_file"; then
|
||||
if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -1) || [ ! -f "$zsh" ]; then
|
||||
error "no zsh binary found or not present in '$shells_file'"
|
||||
error "change your default shell manually."
|
||||
if [ "$termux" != true ]; then
|
||||
# Test for the right location of the "shells" file
|
||||
if [ -f /etc/shells ]; then
|
||||
shells_file=/etc/shells
|
||||
elif [ -f /usr/share/defaults/etc/shells ]; then # Solus OS
|
||||
shells_file=/usr/share/defaults/etc/shells
|
||||
else
|
||||
error "could not find /etc/shells file. Change your default shell manually."
|
||||
return
|
||||
fi
|
||||
|
||||
# Get the path to the right zsh binary
|
||||
# 1. Use the most preceding one based on $PATH, then check that it's in the shells file
|
||||
# 2. If that fails, get a zsh path from the shells file, then check it actually exists
|
||||
if ! zsh=$(which zsh) || ! grep -qx "$zsh" "$shells_file"; then
|
||||
if ! zsh=$(grep '^/.*/zsh$' "$shells_file" | tail -1) || [ ! -f "$zsh" ]; then
|
||||
error "no zsh binary found or not present in '$shells_file'"
|
||||
error "change your default shell manually."
|
||||
return
|
||||
fi
|
||||
fi
|
||||
fi
|
||||
|
||||
# We're going to change the default shell, so back up the current one
|
||||
if [ -n $SHELL ]; then
|
||||
if [ -n "$SHELL" ]; then
|
||||
echo $SHELL > ~/.shell.pre-oh-my-zsh
|
||||
else
|
||||
grep "^$USER:" /etc/passwd | awk -F: '{print $7}' > ~/.shell.pre-oh-my-zsh
|
||||
|
|
|
|||
|
|
@ -25,18 +25,14 @@ if [ -e "$ZSHRC_ORIG" ]; then
|
|||
echo "Your original zsh config was restored."
|
||||
fi
|
||||
|
||||
if hash chsh >/dev/null 2>&1; then
|
||||
if [ -f ~/.shell.pre-oh-my-zsh ]; then
|
||||
old_shell=$(cat ~/.shell.pre-oh-my-zsh)
|
||||
else
|
||||
old_shell=/bin/bash
|
||||
fi
|
||||
if hash chsh >/dev/null 2>&1 && [ -f ~/.shell.pre-oh-my-zsh ]; then
|
||||
old_shell=$(cat ~/.shell.pre-oh-my-zsh)
|
||||
echo "Switching your shell back to '$old_shell':"
|
||||
if chsh -s "$old_shell"; then
|
||||
rm -f ~/.shell.pre-oh-my-zsh
|
||||
else
|
||||
echo "Could not change default shell. Change it manually by running chsh"
|
||||
echo "or editing the /etc/passwd file."
|
||||
echo "or editing the /etc/passwd file."
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -20,8 +20,24 @@ else
|
|||
NORMAL=""
|
||||
fi
|
||||
|
||||
printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh"
|
||||
cd "$ZSH"
|
||||
|
||||
# Set git-config values known to fix git errors
|
||||
# Line endings (#4069)
|
||||
git config core.eol lf
|
||||
git config core.autocrlf false
|
||||
# zeroPaddedFilemode fsck errors (#4963)
|
||||
git config fsck.zeroPaddedFilemode ignore
|
||||
git config fetch.fsck.zeroPaddedFilemode ignore
|
||||
git config receive.fsck.zeroPaddedFilemode ignore
|
||||
|
||||
# Update upstream remote to ohmyzsh org
|
||||
remote=$(git remote -v | awk '/https:\/\/github\.com\/robbyrussell\/oh-my-zsh\.git/{ print $1; exit }')
|
||||
if [ -n "$remote" ]; then
|
||||
git remote set-url "$remote" "https://github.com/ohmyzsh/ohmyzsh.git"
|
||||
fi
|
||||
|
||||
printf "${BLUE}%s${NORMAL}\n" "Updating Oh My Zsh"
|
||||
if git pull --rebase --stat origin master
|
||||
then
|
||||
#printf "\n${BLUE}%s\n" "update .zshrc"
|
||||
|
|
@ -43,7 +59,7 @@ then
|
|||
printf '%s\n' ' /____/ '
|
||||
printf "${BLUE}%s\n" "Hooray! Oh My Zsh has been updated and/or is at the current version."
|
||||
printf "${BLUE}${BOLD}%s${NORMAL}\n" "To keep up on the latest news and updates, follow us on twitter: https://twitter.com/ohmyzsh"
|
||||
printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh"
|
||||
printf "${BLUE}${BOLD}%s${NORMAL}\n" "Get your Oh My Zsh swag at: https://shop.planetargon.com/collections/oh-my-zsh"
|
||||
else
|
||||
printf "${RED}%s${NORMAL}\n" 'There was an error updating. Try again later?'
|
||||
fi
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue