wok rev 1531

Add zsh (from Sandeep Srinivasa)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Thu Oct 09 15:00:42 2008 +0000 (2008-10-09)
parents 7a43790dff5f
children e89ce4b14066
files zsh/receipt zsh/stuff/example.zshrc
line diff
     1.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     1.2 +++ b/zsh/receipt	Thu Oct 09 15:00:42 2008 +0000
     1.3 @@ -0,0 +1,71 @@
     1.4 +# SliTaz package receipt.
     1.5 +
     1.6 +PACKAGE="zsh"
     1.7 +VERSION="4.3.6"
     1.8 +CATEGORY="system-tools"
     1.9 +DEPENDS="ncurses zlib"
    1.10 +BUILD_DEPENDS="ncurses-dev zlib-dev"
    1.11 +SHORT_DESC="Zsh shell incorporates many features of bash, ksh, and tcsh"
    1.12 +MAINTAINER="sandys@gmail.com"
    1.13 +TARBALL="$PACKAGE-$VERSION.tar.bz2"
    1.14 +WEB_SITE="http://zsh.sourceforge.net/"
    1.15 +WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
    1.16 +
    1.17 +# Rules to configure and make the package.
    1.18 +compile_rules()
    1.19 +{
    1.20 +	cd $src
    1.21 +	./configure --prefix=/usr --bindir=/bin \
    1.22 +	--disable-dynamic --enable-multibyte  \
    1.23 +	--infodir=/usr/share/info --mandir=/usr/share/man \
    1.24 +	--enable-fndir=/usr/share/zsh/functions \
    1.25 +	--enable-scriptdir=/usr/share/zsh/scripts \
    1.26 +	$CONFIGURE_ARGS &&
    1.27 +	make &&
    1.28 +	make DESTDIR=$PWD/_pkg install
    1.29 +}
    1.30 +
    1.31 +# Rules to gen a SliTaz package suitable for Tazpkg.
    1.32 +genpkg_rules()
    1.33 +{	
    1.34 +	cp -a $_pkg/bin $fs
    1.35 +	strip -s $fs/bin/zsh
    1.36 +
    1.37 +	# Config files.
    1.38 +	#
    1.39 +	mkdir $fs/etc
    1.40 +	cp stuff/example.zshrc $fs/etc/zshrc
    1.41 +	
    1.42 +	#no way around this... gen_package will not automatically copy these
    1.43 +	mkdir -p $fs/usr/share/zsh
    1.44 +	cp -r $_pkg/usr/share/zsh/functions $fs/usr/share/zsh
    1.45 +
    1.46 +	mkdir -p $fs/usr/share/zsh/scripts
    1.47 +
    1.48 +}
    1.49 +
    1.50 +# Post install commands for Tazpkg.
    1.51 +# Check /bin/sh stat.
    1.52 +#
    1.53 +post_install()
    1.54 +{
    1.55 +	local root
    1.56 +	root=$1
    1.57 +	echo "Processing post-install commands..."
    1.58 +	sh=`readlink $root/bin/sh`
    1.59 +	if [ ! "$sh" = "/bin/zsh" ]; then
    1.60 +		echo ""
    1.61 +		echo "**** Actual SH link : $sh"
    1.62 +		echo ""
    1.63 +		echo -n "Do you want Zsh for /bin/sh (y/N) ? : "; read anser
    1.64 +		if [ "$anser" == "y" ]; then
    1.65 +			echo ""
    1.66 +			echo -n "Removin sh link to make a new one pointing on /bin/zsh..."
    1.67 +			rm $root/bin/sh && ln -s /bin/zsh $root/bin/sh
    1.68 +			status
    1.69 +		else
    1.70 +			echo ""
    1.71 +			echo "Leaving /bin/sh to : $sh"
    1.72 +		fi
    1.73 +	fi
    1.74 +}
     2.1 --- /dev/null	Thu Jan 01 00:00:00 1970 +0000
     2.2 +++ b/zsh/stuff/example.zshrc	Thu Oct 09 15:00:42 2008 +0000
     2.3 @@ -0,0 +1,113 @@
     2.4 +# history
     2.5 +HISTFILE=~/.zsh_history
     2.6 +HISTSIZE=5000
     2.7 +SAVEHIST=1000
     2.8 +setopt appendhistory autocd extendedglob
     2.9 +setopt EXTENDED_HISTORY		# puts timestamps in the history
    2.10 +
    2.11 +# default apps
    2.12 +  (( ${+BROWSER} )) || export BROWSER="w3m"
    2.13 +  (( ${+PAGER} ))   || export PAGER="less"
    2.14 +
    2.15 +BLACK="%{"$'\033[01;30m'"%}"
    2.16 +GREEN="%{"$'\033[01;32m'"%}"
    2.17 +RED="%{"$'\033[01;31m'"%}"
    2.18 +YELLOW="%{"$'\033[01;33m'"%}"
    2.19 +BLUE="%{"$'\033[01;34m'"%}"
    2.20 +BOLD="%{"$'\033[01;39m'"%}"
    2.21 +NORM="%{"$'\033[00m'"%}"
    2.22 +
    2.23 +
    2.24 +# prompt (if running screen, show window #)
    2.25 +if [ x$WINDOW != x ]; then
    2.26 +    export PS1="$WINDOW:%~%# "
    2.27 +else
    2.28 +    export PS1="[${RED}%n${YELLOW}@${BLUE}%U%m%u$:${GREEN}%2c${NORM}]%(!.#.$) "
    2.29 +    #right prompt - time/date stamp
    2.30 +    export RPS1="${GREEN}(%D{%m-%d %H:%M})${NORM}"
    2.31 +fi
    2.32 +
    2.33 +# format titles for screen and rxvt
    2.34 +function title() {
    2.35 +  # escape '%' chars in $1, make nonprintables visible
    2.36 +  a=${(V)1//\%/\%\%}
    2.37 +
    2.38 +  # Truncate command, and join lines.
    2.39 +  a=$(print -Pn "%40>...>$a" | tr -d "\n")
    2.40 +
    2.41 +  case $TERM in
    2.42 +  screen)
    2.43 +    print -Pn "\ek$a:$3\e\\"      # screen title (in ^A")
    2.44 +    ;;
    2.45 +  xterm*|rxvt)
    2.46 +    print -Pn "\e]2;$2 | $a:$3\a" # plain xterm title
    2.47 +    ;;
    2.48 +  esac
    2.49 +}
    2.50 +
    2.51 +# precmd is called just before the prompt is printed
    2.52 +function precmd() {
    2.53 +  title "zsh" "$USER@%m" "%55<...<%~"
    2.54 +}
    2.55 +
    2.56 +# preexec is called just before any command line is executed
    2.57 +function preexec() {
    2.58 +  title "$1" "$USER@%m" "%35<...<%~"
    2.59 +}
    2.60 +
    2.61 +# vi editing
    2.62 +bindkey -v
    2.63 +
    2.64 +# colorful listings
    2.65 +zmodload -i zsh/complist
    2.66 +zstyle ':completion:*' list-colors ${(s.:.)LS_COLORS}
    2.67 +
    2.68 +autoload -U compinit
    2.69 +compinit
    2.70 +
    2.71 +# aliases
    2.72 +alias mv='nocorrect mv'       # no spelling correction on mv
    2.73 +alias cp='nocorrect cp'
    2.74 +alias mkdir='nocorrect mkdir'
    2.75 +alias j=jobs
    2.76 +if ls -F --color=auto >&/dev/null; then
    2.77 +  alias ls="ls --color=auto -F"
    2.78 +else
    2.79 +  alias ls="ls -F"
    2.80 +fi
    2.81 +alias ll="ls -l"
    2.82 +alias ..='cd ..'
    2.83 +alias .='pwd'
    2.84 +
    2.85 +# functions
    2.86 +setenv() { export $1=$2 }  # csh compatibility
    2.87 +
    2.88 +#bash style ctrl-a (beginning of line) and ctrl-e (end of line)
    2.89 +bindkey '^a' beginning-of-line
    2.90 +bindkey '^e' end-of-line
    2.91 +
    2.92 +# Emulate tcsh's backward-delete-word
    2.93 +tcsh-backward-delete-word () {
    2.94 +    #local WORDCHARS="${WORDCHARS:s#/#}"
    2.95 +    local WORDCHARS='*?_[]~\!#$%^<>|`@#$%^*()+?'
    2.96 +    zle backward-delete-word
    2.97 +}
    2.98 +
    2.99 +zle -N tcsh-backward-delete-word
   2.100 +
   2.101 +bindkey '\e^H' tcsh-backward-delete-word
   2.102 +
   2.103 +#if this is uncommented, it will ignore the stop-at-special-chars
   2.104 +#bindkey '\e^H' backward-delete-word
   2.105 +
   2.106 +#uncomment this to have a nice update script that will cause ur zshrc to update from a central location
   2.107 +
   2.108 +#selfupdate(){
   2.109 +#        URL="http://stuff.mit.edu/~jdong/misc/zshrc"
   2.110 +#        echo "Updating zshrc from $URL..."
   2.111 +#        echo "Press Ctrl+C within 5 seconds to abort..."
   2.112 +#        sleep 5
   2.113 +#        cp ~/.zshrc ~/.zshrc.old
   2.114 +#        wget $URL -O ~/.zshrc
   2.115 +#        echo "Done; existing .zshrc saved as .zshrc.old"
   2.116 +#}