wok view bash/receipt @ rev 20351

pinentry: I get warning, thus use same HOST_ARCH as in libgpg-error/receipt
author Erkan Yilmaz <erkan@slitaz.org>
date Sat Jun 09 11:50:47 2018 +0000 (2018-06-09)
parents 45195b132e80
children 1d5e590f745a
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"
20 BUILD_DEPENDS="bison wget texinfo"
22 patch_bash()
23 {
24 for i in $BASHPATCHES ; do
25 if [ ! -s "$SOURCES_REPOSITORY/$i" ]; then
26 echo "Downloading $i"
27 busybox wget -O "$SOURCES_REPOSITORY/$i" \
28 http://ftp.gnu.org/gnu/bash/bash-$BASEVERSION-patches/$i
29 fi
30 echo "Apply $i ..."
31 patch -p0 < $SOURCES_REPOSITORY/$i
32 done
33 }
35 # Rules to compile & install the temporary toolchain.
36 cook_tmp_toolchain()
37 {
38 cd $src
39 patch_bash
40 ./configure --without-bash-malloc &&
41 make && make install
42 }
44 # Rules to configure and make the package.
45 compile_rules()
46 {
47 # Patch and then build.
48 cd $src
49 patch_bash
50 # Skip tests that can not run while cross-compiling.
51 cat > config.cache << "EOF"
52 ac_cv_func_mmap_fixed_mapped=yes
53 ac_cv_func_strcoll_works=yes
54 ac_cv_func_working_mktime=yes
55 bash_cv_func_sigsetjmp=present
56 bash_cv_getcwd_malloc=yes
57 bash_cv_job_control_missing=present
58 bash_cv_printf_a_format=yes
59 bash_cv_sys_named_pipes=present
60 bash_cv_ulimit_maxfds=yes
61 bash_cv_under_sys_siglist=yes
62 bash_cv_unusable_rtsigs=no
63 gt_cv_int_divbyzero_sigfpe=yes
64 EOF
65 ./configure \
66 $CONFIGURE_ARGS \
67 --cache-file=config.cache \
68 --bindir=/bin \
69 --enable-history --enable-alias \
70 --disable-nls --without-bash-malloc \
71 --disable-help-builtin \
72 --with-installed-readline=no &&
73 make &&
74 # Bash doesn't care about DESTDIR in environnment variable.
75 make DESTDIR=$DESTDIR install
76 [ -s "$SOURCES_REPOSITORY/$BASHCHECK" ] ||
77 busybox wget --no-check-certificate -O "$SOURCES_REPOSITORY/$BASHCHECK" $BASHCHECKURL
78 $DESTDIR/bin/bash $SOURCES_REPOSITORY/$BASHCHECK $DESTDIR/bin/bash | tee bashcheck.log
79 grep Vulnerable bashcheck.log && echo "ERROR: Vulnerable"
80 }
82 # Rules to gen a SliTaz package suitable for Tazpkg.
83 genpkg_rules()
84 {
85 cp -a $install/bin $fs
86 # Config files.
87 #
88 mkdir $fs/etc
89 cp $stuff/example.bashrc $fs/etc/bashrc
90 }
93 post_install()
94 {
95 mkdir -p "$1/etc/skel"; cp -a "$1/etc/bashrc" "$1/etc/skel/.bashrc"
97 # Exit function in non-interactive mode (when user can't answer question)
98 ! tty -s && return
100 echo
101 echo -n 'Do you want to set Bash to default (y/N) ? : '
102 read -t 30 answer
103 [ "$answer" != 'y' ] && return
105 echo
106 echo 'Setting bash as default shell for all users'
107 sed -i 's|:/bin/[ckz]*sh$|:/bin/bash|' "$1/etc/passwd"
109 echo 'Creating ~/.bashrc file for all users'
110 for i in $(awk -F: '$7=="/bin/bash"{print $6}' "$1/etc/passwd"); do
111 [ -e "$1$i/.bashrc" ] && continue
112 cp "$1/etc/bashrc" "$1$i/.bashrc"
113 chown $(stat -c%U:%G "$1$i") "$1$i/.bashrc"
114 done
115 }
118 pre_remove()
119 {
120 echo
121 echo 'Setting sh as default shell for all users'
122 sed -i 's|:/bin/bash$|:/bin/sh|' "$1/etc/passwd"
123 [ -f "$1/etc/skel/.bashrc" ] && rm "$1/etc/skel/.bashrc"
124 }