wok-next view zsh/receipt @ rev 11667

zsh: pre_remove restore sh link
author Richard Dunbar <mojo@slitaz.org>
date Thu Feb 16 16:33:16 2012 +0000 (2012-02-16)
parents 93efe993d312
children 605079172258
line source
1 # SliTaz package receipt.
3 PACKAGE="zsh"
4 VERSION="4.3.12"
5 CATEGORY="system-tools"
6 SHORT_DESC="Zsh shell incorporates many features of bash, ksh, and tcsh"
7 MAINTAINER="sandys@gmail.com"
8 TARBALL="$PACKAGE-$VERSION.tar.bz2"
9 WEB_SITE="http://zsh.sourceforge.net/"
10 WGET_URL="$SF_MIRROR/$PACKAGE/$TARBALL"
11 TAGS="shell"
13 DEPENDS="ncurses zlib ncursesw"
14 BUILD_DEPENDS="ncurses-dev zlib-dev"
16 # Rules to configure and make the package.
17 compile_rules()
18 {
19 cd $src
20 ./configure --bindir=/bin \
21 --disable-dynamic --enable-multibyte \
22 --enable-fndir=/usr/share/zsh/functions \
23 --enable-scriptdir=/usr/share/zsh/scripts \
24 $CONFIGURE_ARGS &&
25 make &&
26 make install
27 }
29 # Rules to gen a SliTaz package suitable for Tazpkg.
30 genpkg_rules()
31 {
32 cp -a $_pkg/bin $fs
34 # Config files.
35 #
36 mkdir $fs/etc
37 cp $stuff/example.zshrc $fs/etc/zshrc
39 #no way around this... gen_package will not automatically copy these
40 mkdir -p $fs/usr/share/zsh
41 cp -r $_pkg/usr/share/zsh/functions $fs/usr/share/zsh
43 mkdir -p $fs/usr/share/zsh/scripts
45 }
47 # Post install commands for Tazpkg.
48 # Check /bin/sh stat.
49 #
50 post_install()
51 {
52 local root
53 root=$1
54 echo "Processing post-install commands..."
55 sh=`readlink $root/bin/sh`
56 if [ ! "$sh" = "/bin/zsh" ]; then
57 echo ""
58 echo "**** Actual SH link : $sh"
59 echo ""
60 echo -n "Do you want Zsh for /bin/sh (y/N) ? : "
61 read -t 30 answer < /dev/tty
62 if [ "$answer" == "y" ]; then
63 echo ""
64 echo -n "Removin sh link to make a new one pointing on /bin/zsh..."
65 rm $root/bin/sh && ln -s /bin/zsh $root/bin/sh
66 status
67 else
68 echo ""
69 echo "Leaving /bin/sh to : $sh"
70 fi
71 fi
72 }
74 # Restore a valid sh link if needed.
75 pre_remove()
76 {
77 local root
78 root=$1
79 sh=`readlink $root/bin/sh`
80 if [ ! "$sh" = "busybox" ]; then
81 rm $root/bin/sh &&
82 ln -s /bin/busybox $root/bin/sh
83 fi
84 }