wok-next view bash/receipt @ rev 20976
Follow recent changes in the Python renames
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Tue Sep 25 17:35:51 2018 +0300 (2018-09-25) |
parents | d43bf7aae921 |
children | d5aab818505e |
line source
1 # SliTaz package receipt v2.
3 PACKAGE="bash"
4 VERSION="4.4.p23"
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 LFS="http://www.linuxfromscratch.org/lfs/view/stable/chapter06/bash.html"
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##*.p}); do printf "bash${BASEVERSION/./}-%03d " $i; done)"
19 EXTRA_SOURCE_FILES="$BASHCHECK $BASHPATCHES"
21 BUILD_DEPENDS="ncurses-dev readline-dev texinfo gettext patch"
22 SPLIT="bash-dev"
24 patch_bash() {
25 for i in $BASHPATCHES; do
26 [ -s "$SRC/$i" ] ||
27 wget -O "$SRC/$i" \
28 http://ftp.gnu.org/gnu/bash/bash-$BASEVERSION-patches/$i
29 echo "Apply $i patch..."
30 patch -p0 -i $SRC/$i | awk '{print " * " $0;}'
31 done
32 }
34 # Rules to compile & install the temporary toolchain.
35 cook_tmp_toolchain() {
36 cd $src
37 patch_bash
38 ./configure --without-bash-malloc &&
39 make && make install
40 }
42 compile_rules() {
43 # Patch and then build.
44 patch_bash
46 # Skip tests that can not run while cross-compiling.
47 cat > config.cache <<EOF
48 ac_cv_func_mmap_fixed_mapped=yes
49 ac_cv_func_strcoll_works=yes
50 ac_cv_func_working_mktime=yes
51 bash_cv_func_sigsetjmp=present
52 bash_cv_getcwd_malloc=yes
53 bash_cv_job_control_missing=present
54 bash_cv_printf_a_format=yes
55 bash_cv_sys_named_pipes=present
56 bash_cv_ulimit_maxfds=yes
57 bash_cv_under_sys_siglist=yes
58 bash_cv_unusable_rtsigs=no
59 gt_cv_int_divbyzero_sigfpe=yes
60 EOF
62 ./configure \
63 --cache-file=config.cache \
64 --bindir=/bin \
65 --enable-history \
66 --enable-alias \
67 --disable-nls \
68 --without-bash-malloc \
69 --disable-help-builtin \
70 --with-installed-readline \
71 $CONFIGURE_ARGS &&
72 make &&
73 # Bash doesn't care about DESTDIR in environnment variable.
74 make DESTDIR=$DESTDIR install || return 1
76 # Config files
77 cp -a $stuff/etc $install
78 chown -R root:root $install
80 # Check bash against vulnerabilities
81 [ -s "$SRC/$BASHCHECK" ] ||
82 wget -O "$SRC/$BASHCHECK" $BASHCHECKURL
83 echo
84 $DESTDIR/bin/bash $SRC/$BASHCHECK $DESTDIR/bin/bash | \
85 tee bashcheck.log
86 echo
87 grep Vulnerable bashcheck.log && echo "ERROR: Vulnerable"
88 :
89 }
91 genpkg_rules() {
92 case $PACKAGE in
93 bash)
94 copy @std
95 DEPENDS="ncurses readline"
96 TAGS="LFS shell"
97 ;;
98 *-dev) copy @dev;;
99 esac
100 }
103 post_install_bash() {
104 mkdir -p "$1/etc/skel"; cp -a "$1/etc/bashrc" "$1/etc/skel/.bashrc"
106 # Exit function in non-interactive mode (when user can't answer question)
107 ! tty -s && return
109 echo -n 'Do you want to set /bin/bash to default (y/N) ? : '
110 read -t 30 answer
111 [ "$answer" != 'y' ] && return
113 echo
114 echo 'Setting /bin/bash as default shell for all users'
115 sed -i 's|:/bin/[ckz]*sh$|:/bin/bash|' "$1/etc/passwd"
117 echo 'Creating ~/.bashrc file for all users'
118 for i in $(awk -F: '$7=="/bin/bash"{print $6}' "$1/etc/passwd"); do
119 [ -e "$1$i/.bashrc" ] && continue
120 cp "$1/etc/bashrc" "$1$i/.bashrc"
121 chown $(stat -c%U:%G "$1$i") "$1$i/.bashrc"
122 done
123 }
126 pre_remove_bash() {
127 echo
128 echo 'Setting /bin/sh as default shell for all users'
129 sed -i 's|:/bin/bash$|:/bin/sh|' "$1/etc/passwd"
130 [ -f "$1/etc/skel/.bashrc" ] && rm "$1/etc/skel/.bashrc"
131 }