tazpkg diff modules/install @ rev 845

install: rebuild fs/ tree respecting destination symlinks before installing files and folders to filesystem
author Aleksej Bobylev <al.bobylev@gmail.com>
date Tue Oct 06 15:46:41 2015 +0300 (2015-10-06)
parents d6cbd0c5f273
children 8a73a58ed3cb
line diff
     1.1 --- a/modules/install	Mon Oct 05 03:53:47 2015 +0300
     1.2 +++ b/modules/install	Tue Oct 06 15:46:41 2015 +0300
     1.3 @@ -177,7 +177,7 @@
     1.4  		# Answered 'No' to install dependencies, or '--nodeps' option given
     1.5  		newline
     1.6  		_ 'Leaving dependencies for package "%s" unresolved.' "$PACKAGE"
     1.7 -		_ 'The package is installed but will probably not work.'
     1.8 +		_ 'The package will be installed but will probably not work.'
     1.9  		newline
    1.10  	fi
    1.11  }
    1.12 @@ -457,9 +457,24 @@
    1.13  	fi
    1.14  
    1.15  
    1.16 -	action 'Installing package...'
    1.17 -	[ -n "$(busybox ls fs/* 2>/dev/null)" ] && cp -aLf fs/* "$root/"
    1.18 -	status
    1.19 +	if [ -n "$(busybox ls fs/* 2>/dev/null)" ]; then
    1.20 +		action 'Installing package...'
    1.21 +
    1.22 +		debug '\n  resolving destination links in source'
    1.23 +		IFS=$'\n'
    1.24 +		for dir in $(find fs -type d | sed 's|^fs||;/^$/d'); do
    1.25 +			if ldir=$(busybox readlink -n $root$dir); then
    1.26 +				debug "  * mv 'fs$dir'\n    -> 'fs${dir%/*}/$ldir'"
    1.27 +				mkdir -p "fs${dir%/*}/${ldir%/*}"
    1.28 +				mv "fs$dir" "fs${dir%/*}/$ldir"
    1.29 +			fi
    1.30 +		done
    1.31 +		unset IFS
    1.32 +
    1.33 +		debug '  copying folders and files to destination'
    1.34 +		cp -af fs/* "$root/"
    1.35 +		status
    1.36 +	fi
    1.37  
    1.38  
    1.39  	if [ -s files2remove.list ]; then