wok view bash/receipt @ rev 24336
Add some current_version
author | Pascal Bellard <pascal.bellard@slitaz.org> |
---|---|
date | Fri Jan 28 18:19:21 2022 +0000 (2022-01-28) |
parents | 1d5e590f745a |
children | e4da0cc6f17b |
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 # What is the latest version available today?
26 current_version()
27 {
28 wget -O - ${WGET_URL%/*} 2>/dev/null | \
29 sed "/alpha/d;/doc/d;/$PACKAGE-/!d;/tar/!d;s|.*$PACKAGE-\\(.*\\).tar.*\".*|\\1|" | sort -Vr | sed q
30 }
32 patch_bash()
33 {
34 for i in $BASHPATCHES
35 do
36 if [ ! -s "$SOURCES_REPOSITORY/$i" ]
37 then
38 echo "Downloading $i"
39 busybox wget -O "$SOURCES_REPOSITORY/$i" \
40 http://ftp.gnu.org/gnu/bash/bash-$BASEVERSION-patches/$i
41 fi
42 echo "Apply $i ..."
43 patch -p0 < $SOURCES_REPOSITORY/$i
44 done
45 }
47 # Rules to compile & install the temporary toolchain.
48 cook_tmp_toolchain()
49 {
50 patch_bash
51 ./configure --without-bash-malloc &&
52 make &&
53 make install
54 }
56 # Rules to configure and make the package.
57 compile_rules()
58 {
59 # Patch and then build.
60 patch_bash
62 # Skip tests that can not run while cross-compiling.
63 cat > config.cache << "EOF"
64 ac_cv_func_mmap_fixed_mapped=yes
65 ac_cv_func_strcoll_works=yes
66 ac_cv_func_working_mktime=yes
67 bash_cv_func_sigsetjmp=present
68 bash_cv_getcwd_malloc=yes
69 bash_cv_job_control_missing=present
70 bash_cv_printf_a_format=yes
71 bash_cv_sys_named_pipes=present
72 bash_cv_ulimit_maxfds=yes
73 bash_cv_under_sys_siglist=yes
74 bash_cv_unusable_rtsigs=no
75 gt_cv_int_divbyzero_sigfpe=yes
76 EOF
78 ./configure \
79 --cache-file=config.cache \
80 --bindir=/bin \
81 --enable-history \
82 --enable-alias \
83 --disable-nls \
84 --without-bash-malloc \
85 --disable-help-builtin \
86 --with-installed-readline=no \
87 $CONFIGURE_ARGS &&
88 make &&
89 # Bash doesn't care about DESTDIR in environnment variable.
90 make DESTDIR=$DESTDIR install
92 [ -s "$SOURCES_REPOSITORY/$BASHCHECK" ] ||
93 busybox wget --no-check-certificate -O "$SOURCES_REPOSITORY/$BASHCHECK" $BASHCHECKURL
94 $DESTDIR/bin/bash $SOURCES_REPOSITORY/$BASHCHECK $DESTDIR/bin/bash | tee bashcheck.log
95 grep Vulnerable bashcheck.log && echo "ERROR: Vulnerable"
96 }
98 # Rules to gen a SliTaz package suitable for Tazpkg.
99 genpkg_rules()
100 {
101 cp -a $install/bin $fs
103 # Configuration files.
104 mkdir $fs/etc
105 cp $stuff/example.bashrc $fs/etc/bashrc
106 }
109 post_install()
110 {
111 mkdir -p "$1/etc/skel"
112 cp -a "$1/etc/bashrc" "$1/etc/skel/.bashrc"
114 # Exit function in non-interactive mode (when user can't answer question)
115 ! tty -s && return
117 echo
118 echo -n 'Do you want to set Bash to default (y/N) ? : '
119 read -t 30 answer
120 [ "$answer" != 'y' ] && return
122 echo
123 echo 'Setting bash as default shell for all users'
124 sed -i 's|:/bin/[ckz]*sh$|:/bin/bash|' "$1/etc/passwd"
126 echo 'Creating ~/.bashrc file for all users'
127 for i in $(awk -F: '$7=="/bin/bash"{print $6}' "$1/etc/passwd")
128 do
129 [ -e "$1$i/.bashrc" ] && continue
130 cp "$1/etc/bashrc" "$1$i/.bashrc"
131 chown $(stat -c%U:%G "$1$i") "$1$i/.bashrc"
132 done
133 }
136 pre_remove()
137 {
138 echo
139 echo 'Setting sh as default shell for all users'
140 sed -i 's|:/bin/bash$|:/bin/sh|' "$1/etc/passwd"
141 [ -f "$1/etc/skel/.bashrc" ] && rm "$1/etc/skel/.bashrc"
142 }