spk rev 27

spk-add: some minor change and improvments
author Christophe Lincoln <pankso@slitaz.org>
date Tue May 15 18:33:55 2012 +0200 (2012-05-15)
parents b341e8872256
children 19f1b93fd7d8
files lib/libspk.sh spk-add
line diff
     1.1 --- a/lib/libspk.sh	Tue May 15 18:17:27 2012 +0200
     1.2 +++ b/lib/libspk.sh	Tue May 15 18:33:55 2012 +0200
     1.3 @@ -96,8 +96,8 @@
     1.4  }
     1.5  
     1.6  # Check if a package is already installed.
     1.7 -# Parameters: package
     1.8 -check_for_installed_package() {
     1.9 +# Usage: check_installed package
    1.10 +check_installed() {
    1.11  	local name="$1"
    1.12  	if [ -d "$installed/$name" ]; then
    1.13  		echo $(boldify "$name") $(gettext "package is already installed.")
    1.14 @@ -165,3 +165,7 @@
    1.15  	sed 's/\[/\\[/g'
    1.16  }
    1.17  
    1.18 +# Check for ELF file
    1.19 +is_elf() {
    1.20 +	[ "$(dd if=$1 bs=1 skip=1 count=3 2> /dev/null)" = "ELF" ]
    1.21 +}
     2.1 --- a/spk-add	Tue May 15 18:17:27 2012 +0200
     2.2 +++ b/spk-add	Tue May 15 18:33:55 2012 +0200
     2.3 @@ -1,4 +1,4 @@
     2.4 -#!/bin/busybox sh
     2.5 +#!/bin/sh
     2.6  #
     2.7  # Spk-add - Install SliTaz packages. Read the README before adding or
     2.8  # modifing any code in spk!
     2.9 @@ -40,6 +40,7 @@
    2.10  install_package() {
    2.11  	local package_file=$1
    2.12  
    2.13 +	# Never used I think!!!
    2.14  	# Set by receipt: pre_depends() DEPENDS SELF_INSTALL CONFIG_FILES post_install()
    2.15  
    2.16  	# Create package path early to avoid dependencies loop
    2.17 @@ -57,8 +58,9 @@
    2.18  	fi
    2.19  
    2.20  	# Create modifiers and files.list if they do not exist
    2.21 -#	touch $package_dir/modifiers
    2.22 -#	touch $package_dir/files.list
    2.23 +	# Why ? If missing files.list it's meta packages.
    2.24 +	#touch $package_dir/modifiers
    2.25 +	#touch $package_dir/files.list
    2.26  
    2.27  	# Add package checksum to pkgsmd5
    2.28  	sed -i "/ $(basename $package_dir)$/d" $pkgsmd5 2> /dev/null
    2.29 @@ -214,22 +216,19 @@
    2.30  	newline
    2.31  }
    2.32  
    2.33 -
    2.34  # Install .tazpkg packages.
    2.35  # Parameters: package_file
    2.36  install_pkg() {
    2.37  	package_file="$1"
    2.38 -
    2.39  	check_root
    2.40  	check_valid_tazpkg $package_file
    2.41  
    2.42  	# Check if forced install.
    2.43  	if ! [ "$forced" ]; then
    2.44 -		check_for_installed_package $(package_name $package_file)
    2.45 +		check_installed $(package_name $package_file)
    2.46  	fi
    2.47  
    2.48  	install_package $package_file
    2.49 -
    2.50  	update_desktop_database
    2.51  	update_mime_database
    2.52  	update_icon_database
    2.53 @@ -260,7 +259,7 @@
    2.54  
    2.55  	# Check if forced install.
    2.56  	if ! [ "$forced" ]; then
    2.57 -		check_for_installed_package $package_name
    2.58 +		check_installed $package_name
    2.59  	fi
    2.60  
    2.61  	cd $CACHE_DIR > /dev/null
    2.62 @@ -273,10 +272,10 @@
    2.63  		fi
    2.64  
    2.65  		# Check that the package has the correct checksum
    2.66 -#			if [ "$($CHECKSUM $package_full.tazpkg)" != "$(fgrep \"  $package_full.tazpkg\" $pkgsmd5)" ]; then
    2.67 -#				rm -f $package.tazpkg
    2.68 -#				download "$package_full.tazpkg"
    2.69 -#			fi
    2.70 +#		if [ "$($CHECKSUM $package_full.tazpkg)" != "$(fgrep \"  $package_full.tazpkg\" $pkgsmd5)" ]; then
    2.71 +#			rm -f $package.tazpkg
    2.72 +#			download "$package_full.tazpkg"
    2.73 +#		fi
    2.74  	else
    2.75  		newline
    2.76  		download "$package_full.tazpkg"
    2.77 @@ -314,24 +313,14 @@
    2.78  		done
    2.79  	else
    2.80  		newline
    2.81 -		eval_gettext \
    2.82 -"Leaving dependencies for \$package unresolved. The package is installed but
    2.83 -will probably not work."; newline
    2.84 -		newline
    2.85 +		boldify $(gettext "Package:") $package
    2.86 +		gettext \
    2.87 +			"Dependencies unresolved. Installed but will probably not work."
    2.88 +		newline && newline
    2.89  	fi
    2.90  }
    2.91  
    2.92 -# Check for ELF file
    2.93 -is_elf() {
    2.94 -	[ "$(dd if=$1 bs=1 skip=1 count=3 2> /dev/null)" = "ELF" ]
    2.95 -}
    2.96 -
    2.97 -# Print shared library dependencies: we have /usr/bin/ldd
    2.98 -ldd() {
    2.99 -	LD_TRACE_LOADED_OBJECTS=1 /lib/ld*.so $1 2> /dev/null
   2.100 -}
   2.101 -
   2.102 -
   2.103 +# Update system databases
   2.104  update_desktop_database() {
   2.105  	if [ -f $ROOT/usr/bin/update-desktop-database ] && [ -n "$updatedesktopdb" ]; then
   2.106  		chroot "$ROOT/" /usr/bin/update-desktop-database /usr/share/applications 2>/dev/null