wok-next view bash/receipt @ rev 21103
emacs: depends on emacs-common
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Thu Jan 03 11:21:15 2019 +0200 (2019-01-03) |
parents | 2efce4147058 |
children | 82b613cfd1e0 |
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="devel@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-dev patch"
22 SPLIT="$PACKAGE-dev"
24 COOKOPTS="force-arch" # different config.h, .inc, .pc
26 patch_bash() {
27 for i in $BASHPATCHES; do
28 [ -s "$SRC/$i" ] ||
29 wget -O "$SRC/$i" \
30 http://ftp.gnu.org/gnu/bash/bash-$BASEVERSION-patches/$i
31 echo "Apply $i patch..."
32 patch -p0 -i $SRC/$i | awk '{print " * " $0;}'
33 done
34 }
36 cook_tmp_toolchain() {
37 cd $src
38 patch_bash
39 ./configure --without-bash-malloc &&
40 make &&
41 make install
42 }
44 compile_rules() {
45 # Patch and then build.
46 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
64 ./configure \
65 --cache-file=config.cache \
66 --bindir=/bin \
67 --enable-history \
68 --enable-alias \
69 --disable-nls \
70 --without-bash-malloc \
71 --disable-help-builtin \
72 --with-installed-readline \
73 $CONFIGURE_ARGS &&
74 make &&
75 # Bash doesn't care about DESTDIR in environnment variable.
76 make DESTDIR=$install install || return 1
78 # Config files
79 cp -a $stuff/etc $install
80 chown -R root:root $install
81 chmod u+w $install/bin/bashbug # 555->755
83 # Check bash against vulnerabilities
84 [ -s "$SRC/$BASHCHECK" ] ||
85 wget -O "$SRC/$BASHCHECK" $BASHCHECKURL
86 echo
87 $install/bin/bash $SRC/$BASHCHECK $install/bin/bash | \
88 tee bashcheck.log
89 echo
90 grep Vulnerable bashcheck.log && echo "ERROR: Vulnerable"
91 :
92 }
94 genpkg_rules() {
95 case $PACKAGE in
96 bash)
97 copy @std
98 DEPENDS="ncurses readline"
99 TAGS="LFS shell"
100 ;;
101 *-dev) copy @dev;;
102 esac
103 }
106 post_install_bash() {
107 mkdir -p "$1/etc/skel"; cp -a "$1/etc/bashrc" "$1/etc/skel/.bashrc"
109 # Exit function in non-interactive mode (when user can't answer question)
110 ! tty -s && return
112 echo -n 'Do you want to set /bin/bash to default (y/N) ? : '
113 read -t 30 answer
114 [ "$answer" != 'y' ] && return
116 echo
117 echo 'Setting /bin/bash as default shell for all users'
118 sed -i 's|:/bin/[ckz]*sh$|:/bin/bash|' "$1/etc/passwd"
120 echo 'Creating ~/.bashrc file for all users'
121 for i in $(awk -F: '$7=="/bin/bash"{print $6}' "$1/etc/passwd"); do
122 [ -e "$1$i/.bashrc" ] && continue
123 cp "$1/etc/bashrc" "$1$i/.bashrc"
124 chown $(stat -c%U:%G "$1$i") "$1$i/.bashrc"
125 done
126 }
129 pre_remove_bash() {
130 echo
131 echo 'Setting /bin/sh as default shell for all users'
132 sed -i 's|:/bin/bash$|:/bin/sh|' "$1/etc/passwd"
133 [ -f "$1/etc/skel/.bashrc" ] && rm "$1/etc/skel/.bashrc"
134 }