wok-next view bash/receipt @ rev 21722

efivar: typo in post_install
author Pascal Bellard <pascal.bellard@slitaz.org>
date Tue Sep 01 10:31:46 2020 +0000 (2020-09-01)
parents e19ff076dc63
children
line source
1 # SliTaz package receipt v2.
3 PACKAGE="bash"
4 VERSION="4.4.p23" # update stuff/patches/series too
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"
15 TARBALL_SHA1="8de012df1e4f3e91f571c3eb8ec45b43d7c747eb"
17 BASHCHECKURL="https://raw.githubusercontent.com/hannob/bashcheck/master/bashcheck"
18 BASHCHECK="$(basename $BASHCHECKURL)"
19 BASHPATCHES="$(for i in $(seq 1 ${VERSION##*.p}); do printf "bash${BASEVERSION/./}-%03d " $i; done)"
20 EXTRA_SOURCE_FILES="$BASHCHECK $BASHPATCHES"
22 BUILD_DEPENDS="ncurses-dev readline-dev texinfo gettext-dev patch"
23 SPLIT="$PACKAGE-dev"
25 DEPENDS_std="ncurses readline"
26 TAGS_std="LFS shell"
28 COOKOPTS="force-arch" # different config.h, .inc, .pc
30 cook_tmp_toolchain() {
31 cd $src
32 patchit
33 ./configure --without-bash-malloc &&
34 make &&
35 make install
36 }
38 compile_rules() {
39 # Skip tests that can not run while cross-compiling.
40 cat > config.cache <<-EOF
41 ac_cv_func_mmap_fixed_mapped=yes
42 ac_cv_func_strcoll_works=yes
43 ac_cv_func_working_mktime=yes
44 bash_cv_func_sigsetjmp=present
45 bash_cv_getcwd_malloc=yes
46 bash_cv_job_control_missing=present
47 bash_cv_printf_a_format=yes
48 bash_cv_sys_named_pipes=present
49 bash_cv_ulimit_maxfds=yes
50 bash_cv_under_sys_siglist=yes
51 bash_cv_unusable_rtsigs=no
52 gt_cv_int_divbyzero_sigfpe=yes
53 EOF
55 ./configure \
56 --cache-file=config.cache \
57 --bindir=/bin \
58 --enable-history \
59 --enable-alias \
60 --disable-nls \
61 --without-bash-malloc \
62 --disable-help-builtin \
63 --with-installed-readline \
64 $CONFIGURE_ARGS &&
65 make &&
66 # Bash doesn't care about DESTDIR in environnment variable.
67 make DESTDIR=$install install || return 1
69 # Config files
70 cp -a $stuff/etc $install
71 chown -R root:root $install
72 chmod u+w $install/bin/bashbug # 555->755
74 # Check bash against vulnerabilities
75 [ -s "$SRC/$BASHCHECK" ] ||
76 wget -O "$SRC/$BASHCHECK" $BASHCHECKURL
77 echo
78 $install/bin/bash $SRC/$BASHCHECK $install/bin/bash | \
79 tee bashcheck.log
80 echo
81 grep Vulnerable bashcheck.log && echo "ERROR: Vulnerable"
82 :
83 }
85 post_install_bash() {
86 mkdir -p "$1/etc/skel"; cp -a "$1/etc/bashrc" "$1/etc/skel/.bashrc"
88 # Exit function in non-interactive mode (when user can't answer question)
89 ! tty -s && return
91 echo -n 'Do you want to set /bin/bash to default (y/N) ? : '
92 read -t 30 answer
93 [ "$answer" != 'y' ] && return
95 echo
96 echo 'Setting /bin/bash as default shell for all users'
97 sed -i 's|:/bin/[ckz]*sh$|:/bin/bash|' "$1/etc/passwd"
99 echo 'Creating ~/.bashrc file for all users'
100 for i in $(awk -F: '$7=="/bin/bash"{print $6}' "$1/etc/passwd"); do
101 [ -e "$1$i/.bashrc" ] && continue
102 cp "$1/etc/bashrc" "$1$i/.bashrc"
103 chown $(stat -c%U:%G "$1$i") "$1$i/.bashrc"
104 done
105 }
108 pre_remove_bash() {
109 echo
110 echo 'Setting /bin/sh as default shell for all users'
111 sed -i 's|:/bin/bash$|:/bin/sh|' "$1/etc/passwd"
112 [ -f "$1/etc/skel/.bashrc" ] && rm "$1/etc/skel/.bashrc"
113 }