spk rev 153 1.4.1

Fix and and simpify CONFIG_FILES management
author Christophe Lincoln <pankso@slitaz.org>
date Fri Apr 25 03:48:55 2014 +0200 (2014-04-25)
parents fd2034f96fe0
children c7ff3415e01c
files spk-add
line diff
     1.1 --- a/spk-add	Fri Apr 25 03:48:03 2014 +0200
     1.2 +++ b/spk-add	Fri Apr 25 03:48:55 2014 +0200
     1.3 @@ -25,6 +25,7 @@
     1.4    --forced    $(gettext "Force package reinstallation")
     1.5    --root=     $(gettext "Set the root file system path")
     1.6    --nodeps    $(gettext "Don't resolve packages dependencies")
     1.7 +  --newconf   $(gettext "Don't keep installed configs files")
     1.8    --debug     $(gettext "Display some useful debug information")
     1.9  
    1.10  $(boldify $(gettext "Examples:"))
    1.11 @@ -122,7 +123,7 @@
    1.12  
    1.13  	# Handle cross compiled packages
    1.14  	case "$SLITAZ_ARCH" in
    1.15 -		arm|x86_64) arch="-${SLITAZ_ARCH}" ;;
    1.16 +		arm*|x86_64) arch="-${SLITAZ_ARCH}" ;;
    1.17  	esac
    1.18  	tmpdir="$tmpdir/$PACKAGE-${VERSION}${arch}"
    1.19  
    1.20 @@ -191,28 +192,15 @@
    1.21  		pre_install $root
    1.22  	fi
    1.23  
    1.24 -	# Handle Config Files from receipt
    1.25 -	if [ -n "$CONFIG_FILES" ]; then
    1.26 -		cd $fs || exit 1
    1.27 -		# save 'official' configuration files
    1.28 -		eval_gettext "Saving configuration files for \$package_name... "
    1.29 -
    1.30 -		local confs
    1.31 -		for i in $CONFIG_FILES; do
    1.32 -			confs="$confs $(find ${i#/} -type f 2> /dev/null)"
    1.33 -		done
    1.34 -
    1.35 -		echo $confs | cpio -o -H newc --quiet | gzip -9 > \
    1.36 -			$package_dir/volatile.cpio.gz
    1.37 -
    1.38 -		# keep user configuration files
    1.39 -		for configfile in $confs; do
    1.40 -			[ -e $configfile ] || continue
    1.41 -			cp -a $configfile fs/$configfile
    1.42 -		done
    1.43 -		status
    1.44 -		cd - >/dev/null
    1.45 +	# Handle Config Files set in receipt. Keep system confgs: they can
    1.46 +	# be mofified/customized by users, slitaz-config, etc.
    1.47 +	if [ "$CONFIG_FILES" ] && [ ! "$newconf" ]; then
    1.48 +		gettext "Keeping configuration files..."
    1.49 +		for file in ${CONFIG_FILES}; do
    1.50 +			cp -f ${file} fs/ 2>/dev/null
    1.51 +		done; status
    1.52  	fi
    1.53 +	
    1.54  	# Merge package FS with $root
    1.55  	nb=$(cat files.list | wc -l)
    1.56  	gettext "Installing files:"; echo -n " $nb"