wok view bash/receipt @ rev 24228

syslinux: add apple partitions (again)
author Pascal Bellard <pascal.bellard@slitaz.org>
date Sat Jan 01 11:57:50 2022 +0000 (2022-01-01)
parents 970c5ec9a60a
children 71360a13cd94
line source
1 # SliTaz package receipt.
3 PACKAGE="bash"
4 VERSION="5.0.11"
5 BASEVERSION="${VERSION%.*}"
6 CATEGORY="system-tools"
7 TAGS="shell"
8 SHORT_DESC="The GNU bourne SHell."
9 MAINTAINER="pankso@slitaz.org"
10 LICENSE="GPL3"
11 WEB_SITE="https://www.gnu.org/software/bash/"
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)"
19 BASHPATCHES="$(for i in $(seq 1 ${VERSION##*.}); do printf "bash${BASEVERSION/./}-%03d " $i; done)"
20 EXTRA_SOURCE_FILES="$BASHCHECK $BASHPATCHES"
22 DEPENDS="libtinfo"
23 BUILD_DEPENDS="bison texinfo"
25 patch_bash()
26 {
27 for i in $BASHPATCHES
28 do
29 if [ ! -s "$SOURCES_REPOSITORY/$i" ]
30 then
31 echo "Downloading $i"
32 busybox wget -O "$SOURCES_REPOSITORY/$i" \
33 http://ftp.gnu.org/gnu/bash/bash-$BASEVERSION-patches/$i
34 fi
35 echo "Apply $i ..."
36 patch -p0 < $SOURCES_REPOSITORY/$i
37 done
38 }
40 # Rules to compile & install the temporary toolchain.
41 cook_tmp_toolchain()
42 {
43 patch_bash
44 ./configure --without-bash-malloc &&
45 make &&
46 make install
47 }
49 # Rules to configure and make the package.
50 compile_rules()
51 {
52 # Patch and then build.
53 patch_bash
55 # Skip tests that can not run while cross-compiling.
56 cat > config.cache << "EOF"
57 ac_cv_func_mmap_fixed_mapped=yes
58 ac_cv_func_strcoll_works=yes
59 ac_cv_func_working_mktime=yes
60 bash_cv_func_sigsetjmp=present
61 bash_cv_getcwd_malloc=yes
62 bash_cv_job_control_missing=present
63 bash_cv_printf_a_format=yes
64 bash_cv_sys_named_pipes=present
65 bash_cv_ulimit_maxfds=yes
66 bash_cv_under_sys_siglist=yes
67 bash_cv_unusable_rtsigs=no
68 gt_cv_int_divbyzero_sigfpe=yes
69 EOF
71 ./configure \
72 --cache-file=config.cache \
73 --bindir=/bin \
74 --enable-history \
75 --enable-alias \
76 --disable-nls \
77 --without-bash-malloc \
78 --disable-help-builtin \
79 --with-installed-readline=no \
80 $CONFIGURE_ARGS &&
81 make &&
82 # Bash doesn't care about DESTDIR in environnment variable.
83 make DESTDIR=$DESTDIR install
85 [ -s "$SOURCES_REPOSITORY/$BASHCHECK" ] ||
86 busybox wget --no-check-certificate -O "$SOURCES_REPOSITORY/$BASHCHECK" $BASHCHECKURL
87 $DESTDIR/bin/bash $SOURCES_REPOSITORY/$BASHCHECK $DESTDIR/bin/bash | tee bashcheck.log
88 grep Vulnerable bashcheck.log && echo "ERROR: Vulnerable"
89 }
91 # Rules to gen a SliTaz package suitable for Tazpkg.
92 genpkg_rules()
93 {
94 cp -a $install/bin $fs
96 # Configuration files.
97 mkdir $fs/etc
98 cp $stuff/example.bashrc $fs/etc/bashrc
99 }
102 post_install()
103 {
104 mkdir -p "$1/etc/skel"
105 cp -a "$1/etc/bashrc" "$1/etc/skel/.bashrc"
107 # Exit function in non-interactive mode (when user can't answer question)
108 ! tty -s && return
110 echo
111 echo -n 'Do you want to set Bash to default (y/N) ? : '
112 read -t 30 answer
113 [ "$answer" != 'y' ] && return
115 echo
116 echo 'Setting bash as default shell for all users'
117 sed -i 's|:/bin/[ckz]*sh$|:/bin/bash|' "$1/etc/passwd"
119 echo 'Creating ~/.bashrc file for all users'
120 for i in $(awk -F: '$7=="/bin/bash"{print $6}' "$1/etc/passwd")
121 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()
130 {
131 echo
132 echo 'Setting sh as default shell for all users'
133 sed -i 's|:/bin/bash$|:/bin/sh|' "$1/etc/passwd"
134 [ -f "$1/etc/skel/.bashrc" ] && rm "$1/etc/skel/.bashrc"
135 }