wok-6.x view bash/receipt @ rev 19622
Up busybox (1.26.2)
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Wed Jan 11 10:36:15 2017 +0100 (2017-01-11) |
parents | 5d404602443f |
children | 0f34c2adc9a7 |
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 [ -s "$SOURCES_REPOSITORY/$i" ] ||
28 echo "Downloading $i"
29 busybox wget -O "$SOURCES_REPOSITORY/$i" \
30 http://ftp.gnu.org/gnu/bash/bash-$BASEVERSION-patches/$i
31 echo "Apply $i ..."
32 patch -p0 < $SOURCES_REPOSITORY/$i
33 done
34 }
36 # Rules to compile & install the temporary toolchain.
37 cook_tmp_toolchain()
38 {
39 cd $src
40 patch_bash
41 ./configure --without-bash-malloc &&
42 make && make install
43 }
45 # Rules to configure and make the package.
46 compile_rules()
47 {
48 # Patch and then build.
49 cd $src
50 patch_bash
51 # Skip tests that can not run while cross-compiling.
52 cat > config.cache << "EOF"
53 ac_cv_func_mmap_fixed_mapped=yes
54 ac_cv_func_strcoll_works=yes
55 ac_cv_func_working_mktime=yes
56 bash_cv_func_sigsetjmp=present
57 bash_cv_getcwd_malloc=yes
58 bash_cv_job_control_missing=present
59 bash_cv_printf_a_format=yes
60 bash_cv_sys_named_pipes=present
61 bash_cv_ulimit_maxfds=yes
62 bash_cv_under_sys_siglist=yes
63 bash_cv_unusable_rtsigs=no
64 gt_cv_int_divbyzero_sigfpe=yes
65 EOF
66 ./configure \
67 $CONFIGURE_ARGS \
68 --cache-file=config.cache \
69 --bindir=/bin \
70 --enable-history --enable-alias \
71 --disable-nls --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
77 [ -s "$SOURCES_REPOSITORY/$BASHCHECK" ] ||
78 busybox wget --no-check-certificate -O "$SOURCES_REPOSITORY/$BASHCHECK" $BASHCHECKURL
79 $DESTDIR/bin/bash $SOURCES_REPOSITORY/$BASHCHECK $DESTDIR/bin/bash | tee bashcheck.log
80 grep Vulnerable bashcheck.log && echo "ERROR: Vulnerable"
81 }
83 # Rules to gen a SliTaz package suitable for Tazpkg.
84 genpkg_rules()
85 {
86 cp -a $install/bin $fs
87 # Config files.
88 #
89 mkdir $fs/etc
90 cp $stuff/example.bashrc $fs/etc/bashrc
91 }
94 post_install()
95 {
96 mkdir -p "$1/etc/skel"; cp -a "$1/etc/bashrc" "$1/etc/skel/.bashrc"
98 # Exit function in non-interactive mode (when user can't answer question)
99 ! tty -s && return
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 }