wok-6.x rev 13689

bug 33 : Set bash as default in /etc/passwd & copy .bashrc to users
author xfred222
date Tue Dec 11 13:57:59 2012 -0500 (2012-12-11)
parents 2398a227be6e
children 351e5fac42ac
files bash/receipt
line diff
     1.1 --- a/bash/receipt	Sun Dec 09 17:07:54 2012 +0000
     1.2 +++ b/bash/receipt	Tue Dec 11 13:57:59 2012 -0500
     1.3 @@ -63,41 +63,37 @@
     1.4  	cp $stuff/example.bashrc $fs/etc/bashrc
     1.5  }
     1.6  
     1.7 -# Post install commands for Tazpkg.
     1.8 -# Check /bin/sh stat.
     1.9 -#
    1.10 +
    1.11  post_install()
    1.12  {
    1.13  	local root
    1.14  	root=$1
    1.15  	echo "Processing post-install commands..."
    1.16 -	sh=`readlink $root/bin/sh`
    1.17 -	if [ ! "$sh" = "/bin/bash" ]; then
    1.18 -		echo ""
    1.19 -		echo "**** Actual SH link : $sh"
    1.20 -		echo ""
    1.21 -		echo -n "Do you want Bash for /bin/sh (yes/No) ? : "
    1.22 +		echo -n "Do you want to set Bash to default (y/N) ? : "
    1.23  		read -t 30 anser
    1.24 -		if [ "$anser" == "yes" ]; then
    1.25 +		if [ "$anser" == "y" ]; then
    1.26  			echo ""
    1.27 -			echo -n "Removing sh link to make a new one pointing on /bin/bash..."
    1.28 -			rm $root/bin/sh && ln -s /bin/bash $root/bin/sh
    1.29 -			status
    1.30 -		else
    1.31 -			echo ""
    1.32 -			echo "Leaving /bin/sh to : $sh"
    1.33 +			echo "Setting bash as default for all users"
    1.34 +			sed -i "s/:\/bin\/sh$/:\/bin\/bash/g"  /etc/passwd
    1.35 +			sed -i "s/:\/bin\/ksh$/:\/bin\/bash/g" /etc/passwd
    1.36 +			sed -i "s/:\/bin\/zsh$/:\/bin\/bash/g" /etc/passwd
    1.37 +			sed -i "s/:\/bin\/csh$/:\/bin\/bash/g" /etc/passwd	
    1.38 +			echo "Creating .bashrc file for all users"
    1.39 +			for i in `ls -d /home/*`
    1.40 +			    do
    1.41 +			    cp /etc/bashrc $i/.bashrc
    1.42 +			    done
    1.43 +			cp /etc/bashrc /root/.bashrc
    1.44 +			cp /etc/bashrc /etc/skel/.bashrc
    1.45  		fi
    1.46 -	fi
    1.47  }
    1.48  
    1.49 -# Restore a valid sh link if needed.
    1.50 +
    1.51  pre_remove()
    1.52  {
    1.53  	local root
    1.54  	root=$1
    1.55 -	sh=`readlink $root/bin/sh`
    1.56 -	if [ ! "$sh" = "busybox" ]; then
    1.57 -		rm $root/bin/sh &&
    1.58 -		ln -s /bin/busybox $root/bin/sh
    1.59 -	fi
    1.60 +	echo "Setting back sh as default for all users"
    1.61 +	sed -i "s/:\/bin\/bash$/:\/bin\/sh/g"  /etc/passwd
    1.62 +	rm /etc/skel/.bashrc
    1.63  }