wok-next view bash/receipt @ rev 19715

Fix building: pciutils, pcmanfm-legacy, arj
author Aleksej Bobylev <al.bobylev@gmail.com>
date Sat May 13 17:25:31 2017 +0300 (2017-05-13)
parents 636856757b81
children 7387df590f12
line source
1 # SliTaz package receipt.
3 PACKAGE="bash"
4 VERSION="4.3.48"
5 BASEVERSION="${VERSION%.*}"
6 CATEGORY="shells"
7 SHORT_DESC="The GNU bourne shell"
8 MAINTAINER="pankso@slitaz.org"
9 LICENSE="GPL3"
10 WEB_SITE="https://www.gnu.org/software/bash/"
11 TAGS="shell"
13 TARBALL="$PACKAGE-$BASEVERSION.tar.gz"
14 WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL"
16 BASHCHECKURL="https://raw.githubusercontent.com/hannob/bashcheck/master/bashcheck"
17 BASHCHECK="$(basename $BASHCHECKURL)"
18 BASHPATCHES="$(for i in $(seq 1 ${VERSION##*.}); do printf "bash${BASEVERSION/./}-%03d " $i; done)"
19 EXTRA_SOURCE_FILES="$BASHCHECK $BASHPATCHES"
21 DEPENDS="ncurses readline"
22 BUILD_DEPENDS="ncurses-dev readline-dev texinfo gettext patch"
24 patch_bash()
25 {
26 for i in $BASHPATCHES; do
27 [ -s "$SOURCES_REPOSITORY/$i" ] ||
28 wget -O "$SOURCES_REPOSITORY/$i" \
29 http://ftp.gnu.org/gnu/bash/bash-$BASEVERSION-patches/$i
30 echo "Apply $i patch..."
31 patch -p0 -i $SOURCES_REPOSITORY/$i | awk '{print " * " $0;}'
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 patch_bash
49 # Skip tests that can not run while cross-compiling.
50 cat > config.cache <<EOF
51 ac_cv_func_mmap_fixed_mapped=yes
52 ac_cv_func_strcoll_works=yes
53 ac_cv_func_working_mktime=yes
54 bash_cv_func_sigsetjmp=present
55 bash_cv_getcwd_malloc=yes
56 bash_cv_job_control_missing=present
57 bash_cv_printf_a_format=yes
58 bash_cv_sys_named_pipes=present
59 bash_cv_ulimit_maxfds=yes
60 bash_cv_under_sys_siglist=yes
61 bash_cv_unusable_rtsigs=no
62 gt_cv_int_divbyzero_sigfpe=yes
63 EOF
64 ./configure \
65 $CONFIGURE_ARGS \
66 --cache-file=config.cache \
67 --bindir=/bin \
68 --enable-history \
69 --enable-alias \
70 --disable-nls \
71 --without-bash-malloc \
72 --disable-help-builtin \
73 --with-installed-readline &&
74 make &&
75 # Bash doesn't care about DESTDIR in environnment variable.
76 make DESTDIR=$DESTDIR install
78 # Check bash against vulnerabilities
79 [ -s "$SOURCES_REPOSITORY/$BASHCHECK" ] ||
80 wget -O "$SOURCES_REPOSITORY/$BASHCHECK" $BASHCHECKURL
81 echo
82 $DESTDIR/bin/bash $SOURCES_REPOSITORY/$BASHCHECK $DESTDIR/bin/bash | \
83 tee bashcheck.log
84 echo
85 grep Vulnerable bashcheck.log && echo "ERROR: Vulnerable"
86 }
88 # Rules to gen a SliTaz package suitable for Tazpkg.
89 genpkg_rules()
90 {
91 cook_copy_folders bin
92 # Config files
93 cp -a $stuff/etc $fs
94 }
97 post_install()
98 {
99 mkdir -p "$1/etc/skel"; cp -a "$1/etc/bashrc" "$1/etc/skel/.bashrc"
101 # Exit function in non-interactive mode (when user can't answer question)
102 ! tty -s && return
104 echo -n 'Do you want to set /bin/bash to default (y/N) ? : '
105 read -t 30 answer
106 [ "$answer" != 'y' ] && return
108 echo
109 echo 'Setting /bin/bash as default shell for all users'
110 sed -i 's|:/bin/[ckz]*sh$|:/bin/bash|' "$1/etc/passwd"
112 echo 'Creating ~/.bashrc file for all users'
113 for i in $(awk -F: '$7=="/bin/bash"{print $6}' "$1/etc/passwd"); do
114 [ -e "$1$i/.bashrc" ] && continue
115 cp "$1/etc/bashrc" "$1$i/.bashrc"
116 chown $(stat -c%U:%G "$1$i") "$1$i/.bashrc"
117 done
118 }
121 pre_remove()
122 {
123 echo
124 echo 'Setting /bin/sh as default shell for all users'
125 sed -i 's|:/bin/bash$|:/bin/sh|' "$1/etc/passwd"
126 [ -f "$1/etc/skel/.bashrc" ] && rm "$1/etc/skel/.bashrc"
127 }