wok view bash/receipt @ rev 19701

Up: slitaz-tools and slitaz-configs
author Christophe Lincoln <pankso@slitaz.org>
date Tue Feb 14 12:11:41 2017 +0100 (2017-02-14)
parents db28d30f3f7e
children 45195b132e80
line source
1 # SliTaz package receipt.
3 PACKAGE="bash"
4 VERSION="4.4.5"
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"
17 TAGS="shell"
19 DEPENDS="libtinfo" # readline
20 BUILD_DEPENDS="readline bison wget texinfo"
21 #configure: WARNING: installed readline library is too old to be linked with bash
22 #configure: WARNING: using private bash version
24 patch_bash()
25 {
26 for i in $BASHPATCHES ; do
27 if [ ! -s "$SOURCES_REPOSITORY/$i" ]; then
28 echo "Downloading $i"
29 busybox wget -O "$SOURCES_REPOSITORY/$i" \
30 http://ftp.gnu.org/gnu/bash/bash-$BASEVERSION-patches/$i
31 fi
32 echo "Apply $i ..."
33 patch -p0 < $SOURCES_REPOSITORY/$i
34 done
35 }
37 # Rules to compile & install the temporary toolchain.
38 cook_tmp_toolchain()
39 {
40 cd $src
41 patch_bash
42 ./configure --without-bash-malloc &&
43 make && make install
44 }
46 # Rules to configure and make the package.
47 compile_rules()
48 {
49 # Patch and then build.
50 cd $src
51 patch_bash
52 # Skip tests that can not run while cross-compiling.
53 cat > config.cache << "EOF"
54 ac_cv_func_mmap_fixed_mapped=yes
55 ac_cv_func_strcoll_works=yes
56 ac_cv_func_working_mktime=yes
57 bash_cv_func_sigsetjmp=present
58 bash_cv_getcwd_malloc=yes
59 bash_cv_job_control_missing=present
60 bash_cv_printf_a_format=yes
61 bash_cv_sys_named_pipes=present
62 bash_cv_ulimit_maxfds=yes
63 bash_cv_under_sys_siglist=yes
64 bash_cv_unusable_rtsigs=no
65 gt_cv_int_divbyzero_sigfpe=yes
66 EOF
67 ./configure \
68 $CONFIGURE_ARGS \
69 --cache-file=config.cache \
70 --bindir=/bin \
71 --enable-history --enable-alias \
72 --disable-nls --without-bash-malloc \
73 --disable-help-builtin \
74 --with-installed-readline &&
75 make &&
76 # Bash doesn't care about DESTDIR in environnment variable.
77 make DESTDIR=$DESTDIR install
78 [ -s "$SOURCES_REPOSITORY/$BASHCHECK" ] ||
79 busybox wget --no-check-certificate -O "$SOURCES_REPOSITORY/$BASHCHECK" $BASHCHECKURL
80 $DESTDIR/bin/bash $SOURCES_REPOSITORY/$BASHCHECK $DESTDIR/bin/bash | tee bashcheck.log
81 grep Vulnerable bashcheck.log && echo "ERROR: Vulnerable"
82 }
84 # Rules to gen a SliTaz package suitable for Tazpkg.
85 genpkg_rules()
86 {
87 cp -a $install/bin $fs
88 # Config files.
89 #
90 mkdir $fs/etc
91 cp $stuff/example.bashrc $fs/etc/bashrc
92 }
95 post_install()
96 {
97 mkdir -p "$1/etc/skel"; cp -a "$1/etc/bashrc" "$1/etc/skel/.bashrc"
99 # Exit function in non-interactive mode (when user can't answer question)
100 ! tty -s && return
102 echo -n 'Do you want to set Bash to default (y/N) ? : '
103 read -t 30 answer
104 [ "$answer" != 'y' ] && return
106 echo
107 echo 'Setting bash as default shell for all users'
108 sed -i 's|:/bin/[ckz]*sh$|:/bin/bash|' "$1/etc/passwd"
110 echo 'Creating ~/.bashrc file for all users'
111 for i in $(awk -F: '$7=="/bin/bash"{print $6}' "$1/etc/passwd"); do
112 [ -e "$1$i/.bashrc" ] && continue
113 cp "$1/etc/bashrc" "$1$i/.bashrc"
114 chown $(stat -c%U:%G "$1$i") "$1$i/.bashrc"
115 done
116 }
119 pre_remove()
120 {
121 echo
122 echo 'Setting sh as default shell for all users'
123 sed -i 's|:/bin/bash$|:/bin/sh|' "$1/etc/passwd"
124 [ -f "$1/etc/skel/.bashrc" ] && rm "$1/etc/skel/.bashrc"
125 }