mirror of
https://github.com/ohmyzsh/ohmyzsh.git
synced 2026-05-08 04:34:00 +02:00
Merge ff66bbd570 into 291e96dcd0
This commit is contained in:
commit
201734c8a6
2 changed files with 75 additions and 0 deletions
53
plugins/ssh-copy-id/ssh-copy-id.plugin.zsh
Normal file
53
plugins/ssh-copy-id/ssh-copy-id.plugin.zsh
Normal file
|
|
@ -0,0 +1,53 @@
|
||||||
|
# There's probably a better way to define this if
|
||||||
|
ssh-upload-id () {
|
||||||
|
RSAKEY="${HOME}/.ssh/id_rsa.pub"
|
||||||
|
DSAKEY="${HOME}/.ssh/id_dsa.pub"
|
||||||
|
|
||||||
|
if [ $# -eq 2 ]; then
|
||||||
|
KEY=$1
|
||||||
|
if [ ! -r $KEY ]
|
||||||
|
then
|
||||||
|
echo "'$KEY' does not exist or is not readable"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
SERVER=$2
|
||||||
|
else
|
||||||
|
if [ -r ${RSAKEY} ]; then
|
||||||
|
KEY=$RSAKEY
|
||||||
|
elif [ -r ${DSAKEY} ]; then
|
||||||
|
KEY=$RSAKEY
|
||||||
|
else
|
||||||
|
echo "No RSA or DSA key found"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
SERVER=$1
|
||||||
|
fi
|
||||||
|
|
||||||
|
if [ $# -lt 1 -o "$1" = "-h" ]; then
|
||||||
|
echo "Usage: $0 [publickey_file] [user@]machine"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
# testing above
|
||||||
|
|
||||||
|
echo "Copying $KEY to $SERVER"
|
||||||
|
|
||||||
|
cat $KEY | \
|
||||||
|
ssh $SERVER 'mkdir -p -m 0700 ${HOME}/.ssh && \
|
||||||
|
cat >> $HOME/.ssh/authorized_keys && \
|
||||||
|
chmod 0600 $HOME/.ssh/authorized_keys'
|
||||||
|
|
||||||
|
if [ $? -eq 0 ]; then
|
||||||
|
echo "Public key installed on $SERVER"
|
||||||
|
return 0
|
||||||
|
else
|
||||||
|
echo "Sorry, an error occurred!"
|
||||||
|
return 1
|
||||||
|
fi
|
||||||
|
}
|
||||||
|
|
||||||
|
# alias it to ssh-copy-id if it doesn't exist, like on OS X
|
||||||
|
EXISTING_CHECK=`which ssh-copy-id`
|
||||||
|
if [ $? -ne 0 ]; then
|
||||||
|
alias ssh-copy-id=ssh-upload-id
|
||||||
|
fi
|
||||||
22
themes/jfro.zsh-theme
Normal file
22
themes/jfro.zsh-theme
Normal file
|
|
@ -0,0 +1,22 @@
|
||||||
|
# ZSH Theme - Preview: http://dl.dropbox.com/u/1552408/Screenshots/2010-04-08-oh-my-zsh.png
|
||||||
|
|
||||||
|
if [ $UID -eq 0 ]; then NCOLOR="red"; else NCOLOR="green"; fi
|
||||||
|
local return_code="%(?..%{$fg[red]%}%? ↵%{$reset_color%})"
|
||||||
|
|
||||||
|
crop_pwd() {
|
||||||
|
((MAXMID=$COLUMNS / 2)) # truncate to this value
|
||||||
|
mypath="%~"
|
||||||
|
echo -n "%$MAXMID<...<$mypath"
|
||||||
|
}
|
||||||
|
|
||||||
|
PROMPT='%{$fg[$NCOLOR]%}%n%{$fg[green]%}@%m%{$reset_color%} $(crop_pwd) \
|
||||||
|
$(git_prompt_info)\
|
||||||
|
%{$fg[red]%}%(!.#.»)%{$reset_color%} '
|
||||||
|
PROMPT2='%{$fg[red]%}\ %{$reset_color%}'
|
||||||
|
RPS1='${return_code}'
|
||||||
|
|
||||||
|
ZSH_THEME_GIT_PROMPT_PREFIX="%{$fg[green]%}±%{$fg[yellow]%}"
|
||||||
|
ZSH_THEME_GIT_PROMPT_SUFFIX="%{$reset_color%} "
|
||||||
|
ZSH_THEME_GIT_PROMPT_CLEAN=""
|
||||||
|
ZSH_THEME_GIT_PROMPT_DIRTY="⚡"
|
||||||
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue