wok view bash/receipt @ rev 17377

Up task (2.3.0)
author Paul Issott <paul@slitaz.org>
date Sun Nov 23 18:11:31 2014 +0000 (2014-11-23)
parents e76deed8769f
children dfef8de3d270
line source
1 # SliTaz package receipt.
3 PACKAGE="bash"
4 VERSION="4.2.53"
5 BASEVERSION="${VERSION%.*}"
6 CATEGORY="system-tools"
7 SHORT_DESC="The GNU bourne SHell."
8 MAINTAINER="pankso@slitaz.org"
9 LICENSE="GPL3"
10 TARBALL="$PACKAGE-$BASEVERSION.tar.gz"
11 WEB_SITE="http://www.gnu.org/software/bash/"
12 WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL"
13 BASHCHECKURL="https://raw.githubusercontent.com/hannob/bashcheck/master/bashcheck"
14 BASHCHECK="$(basename $BASHCHECKURL)"
15 BASHPATCHES="$(for i in $(seq 1 ${VERSION##*.}); do printf "bash${BASEVERSION/./}-%03d " $i; done)"
16 EXTRA_SOURCE_FILES="$BASHCHECK $BASHPATCHES"
18 DEPENDS="readline"
19 BUILD_DEPENDS="readline bison wget texinfo"
21 patch_bash()
22 {
23 for i in $BASHPATCHES ; do
24 [ -s "$SOURCES_REPOSITORY/$i" ] ||
25 wget -O "$SOURCES_REPOSITORY/$i" \
26 http://ftp.gnu.org/gnu/bash/bash-$BASEVERSION-patches/$i
27 echo "Apply $i ..."
28 patch -p0 < $SOURCES_REPOSITORY/$i
29 done
30 }
32 # Rules to compile & install the temporary toolchain.
33 cook_tmp_toolchain()
34 {
35 cd $src
36 patch_bash
37 ./configure --without-bash-malloc &&
38 make && make install
39 }
41 # Rules to configure and make the package.
42 compile_rules()
43 {
44 # Patch and then build.
45 cd $src
46 patch_bash
47 # Skip tests that can not run while cross-compiling.
48 cat > config.cache << "EOF"
49 ac_cv_func_mmap_fixed_mapped=yes
50 ac_cv_func_strcoll_works=yes
51 ac_cv_func_working_mktime=yes
52 bash_cv_func_sigsetjmp=present
53 bash_cv_getcwd_malloc=yes
54 bash_cv_job_control_missing=present
55 bash_cv_printf_a_format=yes
56 bash_cv_sys_named_pipes=present
57 bash_cv_ulimit_maxfds=yes
58 bash_cv_under_sys_siglist=yes
59 bash_cv_unusable_rtsigs=no
60 gt_cv_int_divbyzero_sigfpe=yes
61 EOF
62 ./configure \
63 $CONFIGURE_ARGS \
64 --cache-file=config.cache \
65 --bindir=/bin \
66 --enable-history --enable-alias \
67 --disable-nls --without-bash-malloc \
68 --disable-help-builtin \
69 --with-installed-readline &&
70 make &&
71 # Bash doesn't care about DESTDIR in environnment variable.
72 make DESTDIR=$DESTDIR install
73 [ -s "$SOURCES_REPOSITORY/$BASHCHECK" ] ||
74 wget --no-check-certificate -O "$SOURCES_REPOSITORY/$BASHCHECK" $BASHCHECKURL
75 $DESTDIR/bin/bash $SOURCES_REPOSITORY/$BASHCHECK $DESTDIR/bin/bash | tee bashcheck.log
76 grep Vulnerable bashcheck.log && echo "ERROR: Vulnerable"
77 }
79 # Rules to gen a SliTaz package suitable for Tazpkg.
80 genpkg_rules()
81 {
82 cp -a $install/bin $fs
83 # Config files.
84 #
85 mkdir $fs/etc
86 cp $stuff/example.bashrc $fs/etc/bashrc
87 }
90 post_install()
91 {
92 local root
93 root=$1
94 echo "Processing post-install commands..."
95 echo -n "Do you want to set Bash to default (y/N) ? : "
96 read -t 30 anser
97 if [ "$anser" == "y" ]; then
98 echo ""
99 echo "Setting bash as default for all users"
100 sed -i "s/:\/bin\/sh$/:\/bin\/bash/g" /etc/passwd
101 sed -i "s/:\/bin\/ksh$/:\/bin\/bash/g" /etc/passwd
102 sed -i "s/:\/bin\/zsh$/:\/bin\/bash/g" /etc/passwd
103 sed -i "s/:\/bin\/csh$/:\/bin\/bash/g" /etc/passwd
104 echo "Creating .bashrc file for all users"
105 for i in `ls -d /home/*`
106 do
107 cp /etc/bashrc $i/.bashrc
108 done
109 cp /etc/bashrc /root/.bashrc
110 cp /etc/bashrc /etc/skel/.bashrc
111 fi
112 }
115 pre_remove()
116 {
117 local root
118 root=$1
119 echo "Setting back sh as default for all users"
120 sed -i "s/:\/bin\/bash$/:\/bin\/sh/g" /etc/passwd
121 if [ -f /etc/skel/.bashrc ]; then
122 rm /etc/skel/.bashrc
123 fi
124 }