3 autoload colors
; colors
5 # Install or update my ZSH config on a remote host.
6 # Needs Git and makeself locally
15 local OK
="$fg_bold[green]OK.${reset_color}"
16 print
-n "$fg[green]Building archive...${reset_color} "
18 git archive HEAD |
tar -C $work -xf -
19 cp $HOME/.zshenv
$work/zshenv.home
21 print
-n "$fg[green]Building installer...${reset_color} "
22 makeself
--gzip $work $ZSH/zsh-install.sh \
23 "$USER ZSH config files" zsh .
/install.zsh MAGIC
26 print
"$fg[green]Remote install...${reset_color} "
27 scp
$ZSH/zsh-install.sh
${remote}:
28 ssh $remote sh .
/zsh-install.sh
37 # We can be executed to install ourself to the final destination
38 if [[ $1 == "MAGIC" ]]; then
39 (( $
+commands
[rsync
] )) ||
{
40 print
"$fg_bold[red]rsync not found, install it${reset_color}"
43 local OK
="$fg[green]OK.${reset_color}"
46 print
-n "$fg[green]History migration...${reset_color} "
47 mkdir
-p ~
/.zsh
/var
/dirhist
48 if [[ -f ~
/.zsh_history
]] && [[ ! -f ~
/.zsh
/var
/history.
$USER.
$HOST ]]; then
49 { mv ~
/.zsh_history ~
/.zsh
/var
/history.
$USER.
$HOST }
52 print
-n "$fg[green]HMoving completion dump...${reset_color} "
53 mkdir
-p ~
/.zsh
/.zcompcache
54 for file in ~
/.zcompdump ~
/.zsh
/.zcompdump
; do
55 if [[ -f $file ]]; then
56 mv $file ~
/.zsh
/var
/.zcompdump
60 print
"$fg[green]Installation of zsh files...${reset_color} "
61 rsync
-rlp --exclude=var
/ --exclude=.zcompcache
/ --delete . ~
/.zsh
/.
66 ln -s .zsh
/zshenv.home ~
/.zshenv
67 linktarget
=$
(relative
"${HOME}/zshenv.local" "${HOME}/zshenv.local.sample")
68 /bin
/ln -s "${linktarget}" "${HOME}/zshenv.local.sample"
70 print
"$fg[green]Disabling old udh cronjob...${reset_color} "
71 crontab
-l|
sed -e 's_\(#\?[0-9][0-9] [/6*]* \* \* \* $HOME/bin/udh >/dev/null\)_#off#\1_'|crontab