spk diff spk-add @ rev 32

A bunch of fix to add an lib
author Christophe Lincoln <pankso@slitaz.org>
date Tue May 15 20:32:41 2012 +0200 (2012-05-15)
parents ea3c01346d05
children fca271e55b69
line diff
     1.1 --- a/spk-add	Tue May 15 19:40:29 2012 +0200
     1.2 +++ b/spk-add	Tue May 15 20:32:41 2012 +0200
     1.3 @@ -6,7 +6,8 @@
     1.4  # Copyright (C) SliTaz GNU/Linux - BSD License
     1.5  # Author: See AUTHORS files
     1.6  #
     1.7 -. /usr/lib/slitaz/libspk.sh
     1.8 +#. /usr/lib/slitaz/libspk.sh
     1.9 +. lib/libspk.sh
    1.10  
    1.11  # Set to / for now until we add installing to chroot support
    1.12  # Could we update tools so they do not need this?
    1.13 @@ -89,10 +90,9 @@
    1.14  
    1.15  	# Add package checksum to pkgsmd5
    1.16  	sed -i "/ $(basename $package_dir)$/d" $pkgsmd5 2> /dev/null
    1.17 -	oldpwd=$(pwd)
    1.18  	cd $(dirname $package_file) || exit 1
    1.19  	$CHECKSUM $(basename $package_file) >> $pkgsmd5
    1.20 -	cd $oldpwd
    1.21 +	cd - >/dev/null
    1.22  
    1.23  	# Resolve package deps.
    1.24  	if missing_deps $package_name $DEPENDS; then
    1.25 @@ -115,9 +115,10 @@
    1.26  	# Get files to remove if upgrading
    1.27  	local files_to_remove
    1.28  	if [ -f $package_dir/files.list ]; then
    1.29 -		for file in $($package_dir/files.list); do
    1.30 +		for file in $(cat $package_dir/files.list)
    1.31 +		do
    1.32  			grep -q "^$(echo $file | grepesc)$" $TMP_DIR/files.list && continue
    1.33 -			local modifiers=$(cat $package_dir/modifiers 2> /dev/null;\
    1.34 +			local modifiers=$(cat $package_dir/modifiers 2> /dev/null; \
    1.35  							  fgrep -sl $package_dir */modifiers | cut -d/ -f1)
    1.36  			for i in modifiers; do
    1.37  				grep -qs "^$(echo $file | grepesc)$" $i/files.list && continue 2
    1.38 @@ -138,13 +139,13 @@
    1.39  
    1.40  	# Check possibly modified files against other packages file.list
    1.41  	if $check; then
    1.42 -		for pkg in $INSTALLED/*; do
    1.43 +		for pkg in $installed/*; do
    1.44  		  	[ "$pkg" == "$package_name" ] && continue
    1.45  		  	[ -s $pkg/files.list ] || continue
    1.46  
    1.47  		  	for file in $file_list; do
    1.48  		  		# $package_name wants to install $file which is already
    1.49 -		  		# Installed from $pkg
    1.50 +		  		# installed from $pkg
    1.51  				if grep -q ^$file$ $pkg/files.list; then
    1.52  					# Tell $pkg that $package_name is going to overwrite some of its files
    1.53  					if [ -s "$pkg/volatile.cpio.gz" ]; then
    1.54 @@ -191,15 +192,18 @@
    1.55  	fi
    1.56  
    1.57  	# Merge ROOT_FS with Package FS
    1.58 -	eval_gettext "Installing \$package_name... "
    1.59 +	gettext "Installing"; echo -n " $package_name..."
    1.60  	cp -a fs/* $ROOT/
    1.61  	status
    1.62  
    1.63  	# Remove old config files
    1.64 -	if [ -n $files_to_remove ]; then
    1.65 -		eval_gettext "Removing old \$package_name... "
    1.66 +	if [ "$files_to_remove" ]; then
    1.67 +		gettext "Removing old"; echo -n " $package_name..."
    1.68  		for file in $files_to_remove; do
    1.69 -			remove_with_path $ROOT$file
    1.70 +			if [ "$verbose" ]; then
    1.71 +				gettext "Removing:"; echo " ${root}${file}"
    1.72 +			fi
    1.73 +			remove_with_path ${root}${file}
    1.74  		done
    1.75  		status
    1.76  	fi
    1.77 @@ -245,12 +249,6 @@
    1.78  install_local() {
    1.79  	package_file="$1"
    1.80  	check_valid_tazpkg $package_file
    1.81 -
    1.82 -	# Check if forced install.
    1.83 -	if ! [ "$forced" ]; then
    1.84 -		check_installed $(package_name $package_file)
    1.85 -	fi
    1.86 -
    1.87  	install_package $package_file
    1.88  	update_databases
    1.89  }
    1.90 @@ -275,11 +273,6 @@
    1.91  	# package_full=Package-Version
    1.92  	local package_full=$(full_package $package_name)
    1.93  
    1.94 -	# Check if forced install.
    1.95 -	if ! [ "$forced" ]; then
    1.96 -		check_installed $package_name
    1.97 -	fi
    1.98 -
    1.99  	cd $CACHE_DIR > /dev/null
   1.100  	if [ -f "$package_full.tazpkg" ]; then
   1.101  		echo -n "$(colorize "$package_full" 34)"; echo ": $CACHE_DIR)"