wok annotate bash/receipt @ rev 15805

bash: prevent rm .bashrc error when removing bash
author Richard Dunbar <mojo@slitaz.org>
date Thu Jan 23 13:38:58 2014 +0000 (2014-01-23)
parents f4c22f009037
children 63618ce04c4a
rev   line source
pankso@14 1 # SliTaz package receipt.
pankso@14 2
pankso@14 3 PACKAGE="bash"
slaxemulator@8720 4 VERSION="4.2"
pankso@202 5 CATEGORY="system-tools"
pankso@14 6 SHORT_DESC="The GNU bourne SHell."
pankso@14 7 MAINTAINER="pankso@slitaz.org"
pascal@15201 8 LICENSE="GPL3"
pankso@14 9 TARBALL="$PACKAGE-$VERSION.tar.gz"
pankso@14 10 WEB_SITE="http://www.gnu.org/software/bash/"
pankso@14 11 WGET_URL="$GNU_MIRROR/$PACKAGE/$TARBALL"
pankso@14 12
slaxemulator@10407 13 DEPENDS="readline"
slaxemulator@10407 14 BUILD_DEPENDS="readline bison"
slaxemulator@10407 15
gokhlayeh@8171 16 # Rules to compile & install the temporary toolchain.
gokhlayeh@8171 17 cook_tmp_toolchain()
gokhlayeh@8171 18 {
gokhlayeh@8171 19 cd $src
gokhlayeh@8171 20 ./configure --without-bash-malloc &&
gokhlayeh@8171 21 make && make install
gokhlayeh@8171 22 }
gokhlayeh@8171 23
pankso@14 24 # Rules to configure and make the package.
pankso@14 25 compile_rules()
pankso@14 26 {
pankso@14 27 # Patch and then build.
pankso@14 28 cd $src
pankso@10352 29 # Skip tests that can not run while cross-compiling.
pankso@10352 30 cat > config.cache << "EOF"
pankso@10352 31 ac_cv_func_mmap_fixed_mapped=yes
pankso@10352 32 ac_cv_func_strcoll_works=yes
pankso@10352 33 ac_cv_func_working_mktime=yes
pankso@10352 34 bash_cv_func_sigsetjmp=present
pankso@10352 35 bash_cv_getcwd_malloc=yes
pankso@10352 36 bash_cv_job_control_missing=present
pankso@10352 37 bash_cv_printf_a_format=yes
pankso@10352 38 bash_cv_sys_named_pipes=present
pankso@10352 39 bash_cv_ulimit_maxfds=yes
pankso@10352 40 bash_cv_under_sys_siglist=yes
pankso@10352 41 bash_cv_unusable_rtsigs=no
pankso@10352 42 gt_cv_int_divbyzero_sigfpe=yes
pankso@10352 43 EOF
pankso@10344 44 ./configure \
pankso@10352 45 $CONFIGURE_ARGS \
pankso@10352 46 --cache-file=config.cache \
pankso@10344 47 --bindir=/bin \
gokhlayeh@8171 48 --enable-history --enable-alias \
gokhlayeh@8171 49 --disable-nls --without-bash-malloc \
pankso@10344 50 --disable-help-builtin \
pankso@10344 51 --with-installed-readline &&
pascal@1553 52 make &&
gokhlayeh@8171 53 # Bash doesn't care about DESTDIR in environnment variable.
gokhlayeh@8171 54 make DESTDIR=$DESTDIR install
pankso@14 55 }
pankso@14 56
pankso@14 57 # Rules to gen a SliTaz package suitable for Tazpkg.
pankso@14 58 genpkg_rules()
pankso@14 59 {
pascal@14999 60 cp -a $install/bin $fs
pankso@14 61 # Config files.
pankso@14 62 #
pankso@14 63 mkdir $fs/etc
pankso@9697 64 cp $stuff/example.bashrc $fs/etc/bashrc
pankso@14 65 }
pankso@14 66
xfred222@13689 67
pankso@14 68 post_install()
pankso@14 69 {
pankso@14 70 local root
pankso@14 71 root=$1
pankso@14 72 echo "Processing post-install commands..."
xfred222@13689 73 echo -n "Do you want to set Bash to default (y/N) ? : "
gokhlayeh@7635 74 read -t 30 anser
xfred222@13689 75 if [ "$anser" == "y" ]; then
pankso@14 76 echo ""
xfred222@13689 77 echo "Setting bash as default for all users"
xfred222@13689 78 sed -i "s/:\/bin\/sh$/:\/bin\/bash/g" /etc/passwd
xfred222@13689 79 sed -i "s/:\/bin\/ksh$/:\/bin\/bash/g" /etc/passwd
xfred222@13689 80 sed -i "s/:\/bin\/zsh$/:\/bin\/bash/g" /etc/passwd
xfred222@13689 81 sed -i "s/:\/bin\/csh$/:\/bin\/bash/g" /etc/passwd
xfred222@13689 82 echo "Creating .bashrc file for all users"
xfred222@13689 83 for i in `ls -d /home/*`
xfred222@13689 84 do
xfred222@13689 85 cp /etc/bashrc $i/.bashrc
xfred222@13689 86 done
xfred222@13689 87 cp /etc/bashrc /root/.bashrc
xfred222@13689 88 cp /etc/bashrc /etc/skel/.bashrc
pankso@14 89 fi
pankso@14 90 }
pankso@2156 91
xfred222@13689 92
pankso@2156 93 pre_remove()
pankso@2156 94 {
slaxemulator@9610 95 local root
slaxemulator@9610 96 root=$1
xfred222@13689 97 echo "Setting back sh as default for all users"
xfred222@13689 98 sed -i "s/:\/bin\/bash$/:\/bin\/sh/g" /etc/passwd
mojo@15805 99 if [ -f /etc/skel/.bashrc ]; then
xfred222@13689 100 rm /etc/skel/.bashrc
mojo@15805 101 fi
pankso@2156 102 }