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