Enable tracing of the initialization
[zsh.git] / .zsh / install.zsh
index e7c2b33..2d3d7dd 100644 (file)
@@ -12,27 +12,24 @@ install-zsh() {
     work=$(mktemp -d)
     start=$(pwd)
     {
-           local OK="$fg_bold[green]OK.${reset_color}"
-           print -n "$fg[green]Building archive...${reset_color} "
-           #cd $ZSH 
-        vcsh run zsh git archive HEAD | tar -C $work -xf -
-        mkdir -p $work/zsh-syntax-highlighting
-        cd $ZSH/zsh-syntax-highlighting 
-        git archive HEAD | tar -C $work/zsh-syntax-highlighting -xf -
-           cp $HOME/.zshenv $work/zshenv.home
+        local OK="$fg_bold[green]OK.${reset_color}"
+        print -n "$fg[green]Building archive...${reset_color} "
+        cd $ZSH 
+        git archive HEAD | tar -C $work -xf -
+        cp $HOME/.zshenv $work/zshenv.home
         print $OK
-           print -n "$fg[green]Building installer...${reset_color} "
-           makeself --gzip $work $ZSH/zsh-install.sh \
-               "$USER ZSH config files" zsh ./install.zsh MAGIC
-           print $OK
-           [[ -z $1 ]] || {
-               print "$fg[green]Remote install...${reset_color} "
-               scp $ZSH/zsh-install.sh ${remote}:
-               ssh $remote sh ./zsh-install.sh
-               print $OK
-           }
+        print -n "$fg[green]Building installer...${reset_color} "
+        makeself --gzip $work $ZSH/zsh-install.sh \
+            "$USER ZSH config files" zsh ./install.zsh MAGIC
+        print $OK
+        [[ -z $1 ]] || {
+            print "$fg[green]Remote install...${reset_color} "
+            scp $ZSH/zsh-install.sh ${remote}:
+            ssh $remote sh ./zsh-install.sh
+            print $OK
+        }
     } always {
-           rm -rf $work
+        rm -rf $work
         cd $start
     }
 }
@@ -40,16 +37,25 @@ install-zsh() {
 # We can be executed to install ourself to the final destination
 if [[ $1 == "MAGIC" ]]; then
     (( $+commands[rsync] )) || {
-           print "$fg_bold[red]rsync not found, install it${reset_color}"
-           exit 2
+        print "$fg_bold[red]rsync not found, install it${reset_color}"
+        exit 2
     }
     local OK="$fg[green]OK.${reset_color}"
 
     # Migrate history
     print -n "$fg[green]History migration...${reset_color} "
     mkdir -p ~/.zsh/var/dirhist
+    if [[ -f ~/.zsh_history ]] && [[ ! -f ~/.zsh/var/history.$USER.$HOST ]]; then
+        { mv ~/.zsh_history ~/.zsh/var/history.$USER.$HOST }
+    fi
+    print $OK
+    print -n "$fg[green]HMoving completion dump...${reset_color} "
     mkdir -p ~/.zsh/.zcompcache
-    { mv ~/.zsh_history ~/.zsh/var/history.$USER.$HOST } 2> /dev/null
+    for file in ~/.zcompdump ~/.zsh/.zcompdump; do
+        if [[ -f $file ]]; then
+            mv $file ~/.zsh/var/.zcompdump
+        fi
+    done
     print $OK
     print "$fg[green]Installation of zsh files...${reset_color} "
     rsync -rlp --exclude=var/ --exclude=.zcompcache/ --delete . ~/.zsh/.
@@ -58,6 +64,10 @@ if [[ $1 == "MAGIC" ]]; then
     rm -f ~/.zshrc
     rm -f ~/.zshenv
     ln -s .zsh/zshenv.home ~/.zshenv
+    if [[ ! -f ${ZDOTDIR}/zshenv.local ]] || [[ ! -L ${ZDOTDIR}/zshenv.local ]]; then
+        cd ${ZDOTDIR}
+        ln -s zshenv.local.sample zshenv.local
+    fi
     print $OK
     print "$fg[green]Disabling old udh cronjob...${reset_color} "
     crontab -l|sed -e 's_\(#\?[0-9][0-9] [/6*]* \* \* \* $HOME/bin/udh >/dev/null\)_#off#\1_'|crontab