rev |
line source |
pankso@14
|
1 # SliTaz package receipt.
|
pankso@14
|
2
|
pankso@14
|
3 PACKAGE="bash"
|
Hans-G?nter@22531
|
4 VERSION="5.0.11"
|
pascal@17197
|
5 BASEVERSION="${VERSION%.*}"
|
pankso@202
|
6 CATEGORY="system-tools"
|
Hans-G?nter@22531
|
7 TAGS="shell"
|
pankso@14
|
8 SHORT_DESC="The GNU bourne SHell."
|
pankso@14
|
9 MAINTAINER="pankso@slitaz.org"
|
pascal@15201
|
10 LICENSE="GPL3"
|
Hans-G?nter@22531
|
11 WEB_SITE="https://www.gnu.org/software/bash/"
|
Hans-G?nter@22531
|
12
|
pascal@17197
|
13 TARBALL="$PACKAGE-$BASEVERSION.tar.gz"
|
pankso@14
|
14 WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL"
|
Hans-G?nter@22531
|
15
|
pascal@17195
|
16 BASHCHECKURL="https://raw.githubusercontent.com/hannob/bashcheck/master/bashcheck"
|
pascal@17195
|
17 BASHCHECK="$(basename $BASHCHECKURL)"
|
Hans-G?nter@22531
|
18
|
pascal@17197
|
19 BASHPATCHES="$(for i in $(seq 1 ${VERSION##*.}); do printf "bash${BASEVERSION/./}-%03d " $i; done)"
|
pascal@17195
|
20 EXTRA_SOURCE_FILES="$BASHCHECK $BASHPATCHES"
|
pankso@14
|
21
|
pascal@19754
|
22 DEPENDS="libtinfo"
|
Hans-G?nter@22531
|
23 BUILD_DEPENDS="bison texinfo"
|
pascal@17195
|
24
|
pascal@24336
|
25 # What is the latest version available today?
|
pascal@24336
|
26 current_version()
|
pascal@24336
|
27 {
|
pascal@24336
|
28 wget -O - ${WGET_URL%/*} 2>/dev/null | \
|
pascal@24336
|
29 sed "/alpha/d;/doc/d;/$PACKAGE-/!d;/tar/!d;s|.*$PACKAGE-\\(.*\\).tar.*\".*|\\1|" | sort -Vr | sed q
|
pascal@24336
|
30 }
|
pascal@24336
|
31
|
pascal@17195
|
32 patch_bash()
|
pascal@17195
|
33 {
|
Hans-G?nter@22531
|
34 for i in $BASHPATCHES
|
Hans-G?nter@22531
|
35 do
|
Hans-G?nter@22531
|
36 if [ ! -s "$SOURCES_REPOSITORY/$i" ]
|
Hans-G?nter@22531
|
37 then
|
devl547@19593
|
38 echo "Downloading $i"
|
devl547@19593
|
39 busybox wget -O "$SOURCES_REPOSITORY/$i" \
|
pascal@17197
|
40 http://ftp.gnu.org/gnu/bash/bash-$BASEVERSION-patches/$i
|
pascal@19699
|
41 fi
|
pascal@17195
|
42 echo "Apply $i ..."
|
pascal@17195
|
43 patch -p0 < $SOURCES_REPOSITORY/$i
|
Hans-G?nter@22531
|
44 done
|
pascal@17195
|
45 }
|
slaxemulator@10407
|
46
|
gokhlayeh@8171
|
47 # Rules to compile & install the temporary toolchain.
|
gokhlayeh@8171
|
48 cook_tmp_toolchain()
|
gokhlayeh@8171
|
49 {
|
pascal@17195
|
50 patch_bash
|
gokhlayeh@8171
|
51 ./configure --without-bash-malloc &&
|
Hans-G?nter@22531
|
52 make &&
|
Hans-G?nter@22531
|
53 make install
|
gokhlayeh@8171
|
54 }
|
gokhlayeh@8171
|
55
|
pankso@14
|
56 # Rules to configure and make the package.
|
pankso@14
|
57 compile_rules()
|
pankso@14
|
58 {
|
pankso@14
|
59 # Patch and then build.
|
pascal@17195
|
60 patch_bash
|
Hans-G?nter@22531
|
61
|
pankso@10352
|
62 # Skip tests that can not run while cross-compiling.
|
pankso@10352
|
63 cat > config.cache << "EOF"
|
pankso@10352
|
64 ac_cv_func_mmap_fixed_mapped=yes
|
pankso@10352
|
65 ac_cv_func_strcoll_works=yes
|
pankso@10352
|
66 ac_cv_func_working_mktime=yes
|
pankso@10352
|
67 bash_cv_func_sigsetjmp=present
|
pankso@10352
|
68 bash_cv_getcwd_malloc=yes
|
pankso@10352
|
69 bash_cv_job_control_missing=present
|
pankso@10352
|
70 bash_cv_printf_a_format=yes
|
pankso@10352
|
71 bash_cv_sys_named_pipes=present
|
pankso@10352
|
72 bash_cv_ulimit_maxfds=yes
|
pankso@10352
|
73 bash_cv_under_sys_siglist=yes
|
pankso@10352
|
74 bash_cv_unusable_rtsigs=no
|
pankso@10352
|
75 gt_cv_int_divbyzero_sigfpe=yes
|
pankso@10352
|
76 EOF
|
Hans-G?nter@22531
|
77
|
Hans-G?nter@22531
|
78 ./configure \
|
Hans-G?nter@22531
|
79 --cache-file=config.cache \
|
Hans-G?nter@22531
|
80 --bindir=/bin \
|
Hans-G?nter@22531
|
81 --enable-history \
|
Hans-G?nter@22531
|
82 --enable-alias \
|
Hans-G?nter@22531
|
83 --disable-nls \
|
Hans-G?nter@22531
|
84 --without-bash-malloc \
|
Hans-G?nter@22531
|
85 --disable-help-builtin \
|
Hans-G?nter@22531
|
86 --with-installed-readline=no \
|
Hans-G?nter@22531
|
87 $CONFIGURE_ARGS &&
|
pascal@1553
|
88 make &&
|
gokhlayeh@8171
|
89 # Bash doesn't care about DESTDIR in environnment variable.
|
gokhlayeh@8171
|
90 make DESTDIR=$DESTDIR install
|
Hans-G?nter@22531
|
91
|
pascal@17195
|
92 [ -s "$SOURCES_REPOSITORY/$BASHCHECK" ] ||
|
devl547@19593
|
93 busybox wget --no-check-certificate -O "$SOURCES_REPOSITORY/$BASHCHECK" $BASHCHECKURL
|
pascal@17196
|
94 $DESTDIR/bin/bash $SOURCES_REPOSITORY/$BASHCHECK $DESTDIR/bin/bash | tee bashcheck.log
|
pascal@17195
|
95 grep Vulnerable bashcheck.log && echo "ERROR: Vulnerable"
|
pankso@14
|
96 }
|
pankso@14
|
97
|
pankso@14
|
98 # Rules to gen a SliTaz package suitable for Tazpkg.
|
pankso@14
|
99 genpkg_rules()
|
pankso@14
|
100 {
|
Hans-G?nter@22531
|
101 cp -a $install/bin $fs
|
Hans-G?nter@22531
|
102
|
Hans-G?nter@22531
|
103 # Configuration files.
|
pankso@14
|
104 mkdir $fs/etc
|
Hans-G?nter@22531
|
105 cp $stuff/example.bashrc $fs/etc/bashrc
|
pankso@14
|
106 }
|
pankso@14
|
107
|
xfred222@13689
|
108
|
pankso@14
|
109 post_install()
|
pankso@14
|
110 {
|
Hans-G?nter@22531
|
111 mkdir -p "$1/etc/skel"
|
Hans-G?nter@22531
|
112 cp -a "$1/etc/bashrc" "$1/etc/skel/.bashrc"
|
al@18466
|
113
|
al@18466
|
114 # Exit function in non-interactive mode (when user can't answer question)
|
al@18968
|
115 ! tty -s && return
|
al@18466
|
116
|
pascal@20319
|
117 echo
|
al@18466
|
118 echo -n 'Do you want to set Bash to default (y/N) ? : '
|
al@18466
|
119 read -t 30 answer
|
al@18481
|
120 [ "$answer" != 'y' ] && return
|
al@18466
|
121
|
al@18466
|
122 echo
|
al@18466
|
123 echo 'Setting bash as default shell for all users'
|
al@18466
|
124 sed -i 's|:/bin/[ckz]*sh$|:/bin/bash|' "$1/etc/passwd"
|
al@18466
|
125
|
al@18466
|
126 echo 'Creating ~/.bashrc file for all users'
|
Hans-G?nter@22531
|
127 for i in $(awk -F: '$7=="/bin/bash"{print $6}' "$1/etc/passwd")
|
Hans-G?nter@22531
|
128 do
|
al@18466
|
129 [ -e "$1$i/.bashrc" ] && continue
|
Hans-G?nter@22531
|
130 cp "$1/etc/bashrc" "$1$i/.bashrc"
|
Hans-G?nter@22531
|
131 chown $(stat -c%U:%G "$1$i") "$1$i/.bashrc"
|
Hans-G?nter@22531
|
132 done
|
pankso@14
|
133 }
|
pankso@2156
|
134
|
xfred222@13689
|
135
|
pankso@2156
|
136 pre_remove()
|
pankso@2156
|
137 {
|
al@18466
|
138 echo
|
al@18466
|
139 echo 'Setting sh as default shell for all users'
|
al@18466
|
140 sed -i 's|:/bin/bash$|:/bin/sh|' "$1/etc/passwd"
|
al@18466
|
141 [ -f "$1/etc/skel/.bashrc" ] && rm "$1/etc/skel/.bashrc"
|
pankso@2156
|
142 }
|