wok-next annotate bash/receipt @ rev 20645
Up libjpeg-turbo (1.5.3), libpng16 (1.6.34), libraw (0.18.7), shared-mime-info (1.9), tree (1.7.0), xapian (1.4.5); add time.
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Tue May 01 23:19:32 2018 +0300 (2018-05-01) |
parents | 90a5eb560fd6 |
children | 65f5c0b7dcd4 |
rev | line source |
---|---|
al@19743 | 1 # SliTaz package receipt v2. |
pankso@14 | 2 |
pankso@14 | 3 PACKAGE="bash" |
al@20436 | 4 VERSION="4.4.18" |
pascal@17197 | 5 BASEVERSION="${VERSION%.*}" |
al@19561 | 6 CATEGORY="shells" |
al@19561 | 7 SHORT_DESC="The GNU bourne shell" |
pankso@14 | 8 MAINTAINER="pankso@slitaz.org" |
pascal@15201 | 9 LICENSE="GPL3" |
al@19561 | 10 WEB_SITE="https://www.gnu.org/software/bash/" |
al@20436 | 11 LFS="http://www.linuxfromscratch.org/lfs/view/stable/chapter06/bash.html" |
al@19561 | 12 |
pascal@17197 | 13 TARBALL="$PACKAGE-$BASEVERSION.tar.gz" |
pankso@14 | 14 WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL" |
al@19561 | 15 |
pascal@17195 | 16 BASHCHECKURL="https://raw.githubusercontent.com/hannob/bashcheck/master/bashcheck" |
pascal@17195 | 17 BASHCHECK="$(basename $BASHCHECKURL)" |
pascal@17197 | 18 BASHPATCHES="$(for i in $(seq 1 ${VERSION##*.}); do printf "bash${BASEVERSION/./}-%03d " $i; done)" |
pascal@17195 | 19 EXTRA_SOURCE_FILES="$BASHCHECK $BASHPATCHES" |
pankso@14 | 20 |
al@19574 | 21 BUILD_DEPENDS="ncurses-dev readline-dev texinfo gettext patch" |
al@19743 | 22 SPLIT="bash-dev" |
pascal@17195 | 23 |
al@20436 | 24 patch_bash() { |
al@19561 | 25 for i in $BASHPATCHES; do |
al@20513 | 26 [ -s "$SRC/$i" ] || |
al@20513 | 27 wget -O "$SRC/$i" \ |
pascal@17197 | 28 http://ftp.gnu.org/gnu/bash/bash-$BASEVERSION-patches/$i |
al@19561 | 29 echo "Apply $i patch..." |
al@20513 | 30 patch -p0 -i $SRC/$i | awk '{print " * " $0;}' |
pascal@17195 | 31 done |
pascal@17195 | 32 } |
slaxemulator@10407 | 33 |
gokhlayeh@8171 | 34 # Rules to compile & install the temporary toolchain. |
al@20436 | 35 cook_tmp_toolchain() { |
gokhlayeh@8171 | 36 cd $src |
pascal@17195 | 37 patch_bash |
gokhlayeh@8171 | 38 ./configure --without-bash-malloc && |
gokhlayeh@8171 | 39 make && make install |
gokhlayeh@8171 | 40 } |
gokhlayeh@8171 | 41 |
al@20436 | 42 compile_rules() { |
pankso@14 | 43 # Patch and then build. |
pascal@17195 | 44 patch_bash |
al@20436 | 45 |
pankso@10352 | 46 # Skip tests that can not run while cross-compiling. |
al@19561 | 47 cat > config.cache <<EOF |
pankso@10352 | 48 ac_cv_func_mmap_fixed_mapped=yes |
pankso@10352 | 49 ac_cv_func_strcoll_works=yes |
pankso@10352 | 50 ac_cv_func_working_mktime=yes |
pankso@10352 | 51 bash_cv_func_sigsetjmp=present |
pankso@10352 | 52 bash_cv_getcwd_malloc=yes |
pankso@10352 | 53 bash_cv_job_control_missing=present |
pankso@10352 | 54 bash_cv_printf_a_format=yes |
pankso@10352 | 55 bash_cv_sys_named_pipes=present |
pankso@10352 | 56 bash_cv_ulimit_maxfds=yes |
pankso@10352 | 57 bash_cv_under_sys_siglist=yes |
pankso@10352 | 58 bash_cv_unusable_rtsigs=no |
pankso@10352 | 59 gt_cv_int_divbyzero_sigfpe=yes |
pankso@10352 | 60 EOF |
al@20436 | 61 |
pankso@10344 | 62 ./configure \ |
pankso@10352 | 63 --cache-file=config.cache \ |
pankso@10344 | 64 --bindir=/bin \ |
al@19561 | 65 --enable-history \ |
al@20436 | 66 --enable-alias \ |
al@19561 | 67 --disable-nls \ |
al@19561 | 68 --without-bash-malloc \ |
pankso@10344 | 69 --disable-help-builtin \ |
al@20436 | 70 --with-installed-readline \ |
al@20436 | 71 $CONFIGURE_ARGS && |
pascal@1553 | 72 make && |
gokhlayeh@8171 | 73 # Bash doesn't care about DESTDIR in environnment variable. |
al@20436 | 74 make DESTDIR=$DESTDIR install || return 1 |
al@19561 | 75 |
al@19743 | 76 # Config files |
al@19743 | 77 cp -a $stuff/etc $install |
al@19743 | 78 chown -R root:root $install |
al@19743 | 79 |
al@19561 | 80 # Check bash against vulnerabilities |
al@20513 | 81 [ -s "$SRC/$BASHCHECK" ] || |
al@20513 | 82 wget -O "$SRC/$BASHCHECK" $BASHCHECKURL |
al@19561 | 83 echo |
al@20513 | 84 $DESTDIR/bin/bash $SRC/$BASHCHECK $DESTDIR/bin/bash | \ |
al@19561 | 85 tee bashcheck.log |
al@19561 | 86 echo |
pascal@17195 | 87 grep Vulnerable bashcheck.log && echo "ERROR: Vulnerable" |
al@20436 | 88 : |
pankso@14 | 89 } |
pankso@14 | 90 |
al@20436 | 91 genpkg_rules() { |
al@19743 | 92 case $PACKAGE in |
al@19743 | 93 bash) |
al@19743 | 94 copy @std |
al@19743 | 95 DEPENDS="ncurses readline" |
al@20436 | 96 TAGS="LFS shell" |
al@19743 | 97 ;; |
al@19743 | 98 *-dev) copy @dev;; |
al@19743 | 99 esac |
pankso@14 | 100 } |
pankso@14 | 101 |
xfred222@13689 | 102 |
al@20436 | 103 post_install_bash() { |
al@18467 | 104 mkdir -p "$1/etc/skel"; cp -a "$1/etc/bashrc" "$1/etc/skel/.bashrc" |
al@18466 | 105 |
al@18466 | 106 # Exit function in non-interactive mode (when user can't answer question) |
al@18968 | 107 ! tty -s && return |
al@18466 | 108 |
al@19561 | 109 echo -n 'Do you want to set /bin/bash to default (y/N) ? : ' |
al@18466 | 110 read -t 30 answer |
al@18481 | 111 [ "$answer" != 'y' ] && return |
al@18466 | 112 |
al@18466 | 113 echo |
al@19561 | 114 echo 'Setting /bin/bash as default shell for all users' |
al@18466 | 115 sed -i 's|:/bin/[ckz]*sh$|:/bin/bash|' "$1/etc/passwd" |
al@18466 | 116 |
al@18466 | 117 echo 'Creating ~/.bashrc file for all users' |
al@18466 | 118 for i in $(awk -F: '$7=="/bin/bash"{print $6}' "$1/etc/passwd"); do |
al@18466 | 119 [ -e "$1$i/.bashrc" ] && continue |
al@18466 | 120 cp "$1/etc/bashrc" "$1$i/.bashrc" |
al@18466 | 121 chown $(stat -c%U:%G "$1$i") "$1$i/.bashrc" |
al@18466 | 122 done |
pankso@14 | 123 } |
pankso@2156 | 124 |
xfred222@13689 | 125 |
al@20436 | 126 pre_remove_bash() { |
al@18466 | 127 echo |
al@19561 | 128 echo 'Setting /bin/sh as default shell for all users' |
al@18466 | 129 sed -i 's|:/bin/bash$|:/bin/sh|' "$1/etc/passwd" |
al@18466 | 130 [ -f "$1/etc/skel/.bashrc" ] && rm "$1/etc/skel/.bashrc" |
pankso@2156 | 131 } |