wok-next view bash/receipt @ rev 19783
Up receipts to v2 syntax: cook_copy_files & cook_copy_folders -> copy
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Sun Jun 18 04:38:10 2017 +0300 (2017-06-18) |
parents | e9bd4eca24b2 |
children | 90a5eb560fd6 |
line source
1 # SliTaz package receipt v2.
3 PACKAGE="bash"
4 VERSION="4.4.12"
5 BASEVERSION="${VERSION%.*}"
6 CATEGORY="shells"
7 SHORT_DESC="The GNU bourne shell"
8 MAINTAINER="pankso@slitaz.org"
9 LICENSE="GPL3"
10 WEB_SITE="https://www.gnu.org/software/bash/"
11 TAGS="shell"
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##*.}); do printf "bash${BASEVERSION/./}-%03d " $i; done)"
19 EXTRA_SOURCE_FILES="$BASHCHECK $BASHPATCHES"
21 BUILD_DEPENDS="ncurses-dev readline-dev texinfo gettext patch"
22 SPLIT="bash-dev"
24 patch_bash()
25 {
26 for i in $BASHPATCHES; do
27 [ -s "$SOURCES_REPOSITORY/$i" ] ||
28 wget -O "$SOURCES_REPOSITORY/$i" \
29 http://ftp.gnu.org/gnu/bash/bash-$BASEVERSION-patches/$i
30 echo "Apply $i patch..."
31 patch -p0 -i $SOURCES_REPOSITORY/$i | awk '{print " * " $0;}'
32 done
33 }
35 # Rules to compile & install the temporary toolchain.
36 cook_tmp_toolchain()
37 {
38 cd $src
39 patch_bash
40 ./configure --without-bash-malloc &&
41 make && make install
42 }
44 # Rules to configure and make the package.
45 compile_rules()
46 {
47 # Patch and then build.
48 patch_bash
49 # Skip tests that can not run while cross-compiling.
50 cat > config.cache <<EOF
51 ac_cv_func_mmap_fixed_mapped=yes
52 ac_cv_func_strcoll_works=yes
53 ac_cv_func_working_mktime=yes
54 bash_cv_func_sigsetjmp=present
55 bash_cv_getcwd_malloc=yes
56 bash_cv_job_control_missing=present
57 bash_cv_printf_a_format=yes
58 bash_cv_sys_named_pipes=present
59 bash_cv_ulimit_maxfds=yes
60 bash_cv_under_sys_siglist=yes
61 bash_cv_unusable_rtsigs=no
62 gt_cv_int_divbyzero_sigfpe=yes
63 EOF
64 ./configure \
65 $CONFIGURE_ARGS \
66 --cache-file=config.cache \
67 --bindir=/bin \
68 --enable-history \
69 --enable-alias \
70 --disable-nls \
71 --without-bash-malloc \
72 --disable-help-builtin \
73 --with-installed-readline &&
74 make &&
75 # Bash doesn't care about DESTDIR in environnment variable.
76 make DESTDIR=$DESTDIR install
78 # Config files
79 cp -a $stuff/etc $install
80 chown -R root:root $install
82 # Check bash against vulnerabilities
83 [ -s "$SOURCES_REPOSITORY/$BASHCHECK" ] ||
84 wget -O "$SOURCES_REPOSITORY/$BASHCHECK" $BASHCHECKURL
85 echo
86 $DESTDIR/bin/bash $SOURCES_REPOSITORY/$BASHCHECK $DESTDIR/bin/bash | \
87 tee bashcheck.log
88 echo
89 grep Vulnerable bashcheck.log && echo "ERROR: Vulnerable"
90 }
92 # Rules to gen a SliTaz package suitable for Tazpkg.
93 genpkg_rules()
94 {
95 case $PACKAGE in
96 bash)
97 copy @std
98 DEPENDS="ncurses readline"
99 ;;
100 *-dev) copy @dev;;
101 esac
102 }
105 post_install_bash()
106 {
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 {
131 echo
132 echo 'Setting /bin/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 }