wok view bash/receipt @ rev 19073

Fix: (Picozu the HTML5 online image editor.)
author Leonardo Laporte <hackdorte@sapo.pt>
date Sat Apr 23 01:13:53 2016 -0300 (2016-04-23)
parents 6492649051cf
children 5d404602443f
line source
1 # SliTaz package receipt.
3 PACKAGE="bash"
4 VERSION="4.3.42"
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="readline"
20 BUILD_DEPENDS="readline bison wget texinfo"
22 patch_bash()
23 {
24 for i in $BASHPATCHES ; do
25 [ -s "$SOURCES_REPOSITORY/$i" ] ||
26 wget -O "$SOURCES_REPOSITORY/$i" \
27 http://ftp.gnu.org/gnu/bash/bash-$BASEVERSION-patches/$i
28 echo "Apply $i ..."
29 patch -p0 < $SOURCES_REPOSITORY/$i
30 done
31 }
33 # Rules to compile & install the temporary toolchain.
34 cook_tmp_toolchain()
35 {
36 cd $src
37 patch_bash
38 ./configure --without-bash-malloc &&
39 make && make install
40 }
42 # Rules to configure and make the package.
43 compile_rules()
44 {
45 # Patch and then build.
46 cd $src
47 patch_bash
48 # Skip tests that can not run while cross-compiling.
49 cat > config.cache << "EOF"
50 ac_cv_func_mmap_fixed_mapped=yes
51 ac_cv_func_strcoll_works=yes
52 ac_cv_func_working_mktime=yes
53 bash_cv_func_sigsetjmp=present
54 bash_cv_getcwd_malloc=yes
55 bash_cv_job_control_missing=present
56 bash_cv_printf_a_format=yes
57 bash_cv_sys_named_pipes=present
58 bash_cv_ulimit_maxfds=yes
59 bash_cv_under_sys_siglist=yes
60 bash_cv_unusable_rtsigs=no
61 gt_cv_int_divbyzero_sigfpe=yes
62 EOF
63 ./configure \
64 $CONFIGURE_ARGS \
65 --cache-file=config.cache \
66 --bindir=/bin \
67 --enable-history --enable-alias \
68 --disable-nls --without-bash-malloc \
69 --disable-help-builtin \
70 --with-installed-readline &&
71 make &&
72 # Bash doesn't care about DESTDIR in environnment variable.
73 make DESTDIR=$DESTDIR install
74 [ -s "$SOURCES_REPOSITORY/$BASHCHECK" ] ||
75 wget --no-check-certificate -O "$SOURCES_REPOSITORY/$BASHCHECK" $BASHCHECKURL
76 $DESTDIR/bin/bash $SOURCES_REPOSITORY/$BASHCHECK $DESTDIR/bin/bash | tee bashcheck.log
77 grep Vulnerable bashcheck.log && echo "ERROR: Vulnerable"
78 }
80 # Rules to gen a SliTaz package suitable for Tazpkg.
81 genpkg_rules()
82 {
83 cp -a $install/bin $fs
84 # Config files.
85 #
86 mkdir $fs/etc
87 cp $stuff/example.bashrc $fs/etc/bashrc
88 }
91 post_install()
92 {
93 mkdir -p "$1/etc/skel"; cp -a "$1/etc/bashrc" "$1/etc/skel/.bashrc"
95 # Exit function in non-interactive mode (when user can't answer question)
96 ! tty -s && return
98 echo -n 'Do you want to set Bash to default (y/N) ? : '
99 read -t 30 answer
100 [ "$answer" != 'y' ] && return
102 echo
103 echo 'Setting bash as default shell for all users'
104 sed -i 's|:/bin/[ckz]*sh$|:/bin/bash|' "$1/etc/passwd"
106 echo 'Creating ~/.bashrc file for all users'
107 for i in $(awk -F: '$7=="/bin/bash"{print $6}' "$1/etc/passwd"); do
108 [ -e "$1$i/.bashrc" ] && continue
109 cp "$1/etc/bashrc" "$1$i/.bashrc"
110 chown $(stat -c%U:%G "$1$i") "$1$i/.bashrc"
111 done
112 }
115 pre_remove()
116 {
117 echo
118 echo 'Setting sh as default shell for all users'
119 sed -i 's|:/bin/bash$|:/bin/sh|' "$1/etc/passwd"
120 [ -f "$1/etc/skel/.bashrc" ] && rm "$1/etc/skel/.bashrc"
121 }