wok-6.x diff bash/receipt @ rev 18466
bash: fix ~/.bashrc creation, etc.; dia: fix icons packaging (thanks llev for reports)
author | Aleksej Bobylev <al.bobylev@gmail.com> |
---|---|
date | Sat Oct 03 06:11:22 2015 +0300 (2015-10-03) |
parents | 9563a6ca43e4 |
children | 303e73fdfb01 |
line diff
1.1 --- a/bash/receipt Fri Sep 11 11:59:50 2015 +0000 1.2 +++ b/bash/receipt Sat Oct 03 06:11:22 2015 +0300 1.3 @@ -14,6 +14,7 @@ 1.4 BASHCHECK="$(basename $BASHCHECKURL)" 1.5 BASHPATCHES="$(for i in $(seq 1 ${VERSION##*.}); do printf "bash${BASEVERSION/./}-%03d " $i; done)" 1.6 EXTRA_SOURCE_FILES="$BASHCHECK $BASHPATCHES" 1.7 +TAGS="shell" 1.8 1.9 DEPENDS="readline" 1.10 BUILD_DEPENDS="readline bison wget texinfo" 1.11 @@ -89,32 +90,32 @@ 1.12 1.13 post_install() 1.14 { 1.15 - echo "Processing post-install commands..." 1.16 - echo -n "Do you want to set Bash to default (y/N) ? : " 1.17 - read -t 30 anser 1.18 - if [ "$anser" == "y" ]; then 1.19 - echo "" 1.20 - echo "Setting bash as default for all users" 1.21 - sed -i "s/:\/bin\/sh$/:\/bin\/bash/g" $1/etc/passwd 1.22 - sed -i "s/:\/bin\/ksh$/:\/bin\/bash/g" $1/etc/passwd 1.23 - sed -i "s/:\/bin\/zsh$/:\/bin\/bash/g" $1/etc/passwd 1.24 - sed -i "s/:\/bin\/csh$/:\/bin\/bash/g" $1/etc/passwd 1.25 - echo "Creating .bashrc file for all users" 1.26 - for i in `ls -d $1/home/*` 1.27 - do 1.28 - cp $1/etc/bashrc $1$i/.bashrc 1.29 - done 1.30 - cp $1/etc/bashrc $1/root/.bashrc 1.31 - cp $1/etc/bashrc $1/etc/skel/.bashrc 1.32 - fi 1.33 + cp -a "$1/etc/bashrc" "$1/etc/skel/.bashrc" 1.34 + 1.35 + # Exit function in non-interactive mode (when user can't answer question) 1.36 + tty -s || return 1.37 + 1.38 + echo -n 'Do you want to set Bash to default (y/N) ? : ' 1.39 + read -t 30 answer 1.40 + [ "$answer" == 'y' ] || return 1.41 + 1.42 + echo 1.43 + echo 'Setting bash as default shell for all users' 1.44 + sed -i 's|:/bin/[ckz]*sh$|:/bin/bash|' "$1/etc/passwd" 1.45 + 1.46 + echo 'Creating ~/.bashrc file for all users' 1.47 + for i in $(awk -F: '$7=="/bin/bash"{print $6}' "$1/etc/passwd"); do 1.48 + [ -e "$1$i/.bashrc" ] && continue 1.49 + cp "$1/etc/bashrc" "$1$i/.bashrc" 1.50 + chown $(stat -c%U:%G "$1$i") "$1$i/.bashrc" 1.51 + done 1.52 } 1.53 1.54 1.55 pre_remove() 1.56 { 1.57 - echo "Setting back sh as default for all users" 1.58 - sed -i "s/:\/bin\/bash$/:\/bin\/sh/g" $1/etc/passwd 1.59 - if [ -f $1/etc/skel/.bashrc ]; then 1.60 - rm $1/etc/skel/.bashrc 1.61 - fi 1.62 + echo 1.63 + echo 'Setting sh as default shell for all users' 1.64 + sed -i 's|:/bin/bash$|:/bin/sh|' "$1/etc/passwd" 1.65 + [ -f "$1/etc/skel/.bashrc" ] && rm "$1/etc/skel/.bashrc" 1.66 }