On Fri, Mar 11, 2011 at 4:05 PM, Patrik Ryd <
patrik.ryd@linaro.org> wrote:
> Fix for LP #731780.
> ---
> tasks/mktarball.sh | 60 ++++++++++++++++++++++++++++++++++++++++++++++++++++
> tasks/
tarballs.mk | 4 ++-
> 2 files changed, 63 insertions(+), 1 deletions(-)
> create mode 100755 tasks/mktarball.sh
>
> diff --git a/tasks/mktarball.sh b/tasks/mktarball.sh
> new file mode 100755
> index 0000000..622ff47
> --- /dev/null
> +++ b/tasks/mktarball.sh
> @@ -0,0 +1,60 @@
> +#!/bin/bash
> +
> +# This is a modified copy of build/tools/mktarball.sh
> +
> +# $1: path to fs_get_stats program
> +# $2: start dir
> +# $3: subdir to tar up (from $2)
> +# $4: target tar name
> +# $5: target tarball name (usually $(3).bz2)
> +
> +if [ $# -ne 5 ]; then
> + echo "Error: wrong number of arguments in cmd: $0 $* "
> + exit 1
> +fi
> +
> +fs_get_stats=`readlink -f $1`
> +start_dir=`readlink -f $2`
> +dir_to_tar=$3
> +target_tar=`readlink -f $4`
> +target_tarball=`readlink -f $5`
> +
> +cd $2
> +
> +#tar --no-recursion -cvf ${target_tar} ${dir_to_tar}
> +rm ${target_tar} > /dev/null 2>&1
> +
> +# do dirs first
> +subdirs=`find ${dir_to_tar} -type d -print`
> +files=`find ${dir_to_tar} \! -type d -print`
> +for f in ${subdirs} ${files} ; do
> + curr_perms=`stat -c 0%a $f`
> + [ -d "$f" ] && is_dir=1 || is_dir=0
> + f2=`echo ${f#*/}`
> + new_info=`${fs_get_stats} ${curr_perms} ${is_dir} ${f2}`
> + new_uid=`echo ${new_info} | awk '{print $1;}'`
> + new_gid=`echo ${new_info} | awk '{print $2;}'`
> + new_perms=`echo ${new_info} | awk '{print $3;}'`
> +# echo "$f: dir: $is_dir curr: $curr_perms uid: $new_uid gid: $new_gid "\
> +# "perms: $new_perms"
> + tar --no-recursion --numeric-owner --owner $new_uid \
> + --group $new_gid --mode $new_perms -p -rf ${target_tar} ${f}
> +done
> +
> +if [ $? -eq 0 ] ; then
> + case "${target_tarball}" in
> + *.bz2 )
> + bzip2 -c ${target_tar} > ${target_tarball}
> + ;;
> + *.gz )
> + gzip -c ${target_tar} > ${target_tarball}
> + ;;
> + esac
> + success=$?
> + [ $success -eq 0 ] || rm -f ${target_tarball}
> + rm -f ${target_tar}
> + exit $success
> +fi
> +
> +rm -f ${target_tar}
> +exit 1
> diff --git a/tasks/
tarballs.mk b/tasks/
tarballs.mk
> index e569e98..e6354fc 100644
> --- a/tasks/
tarballs.mk
> +++ b/tasks/
tarballs.mk
> @@ -2,11 +2,13 @@
> # Trigger build of tar balls for the linaro boards
> #
>
> +LINARO_MKTARBALL := device/linaro/common/tasks/mktarball.sh
> +
> #######
> ## root tarball
> define build-roottarball-target
> $(hide) echo "Target root fs tarball:" $(INSTALLED_ROOTTARBALL_TARGET)
> - $(hide) $(MKTARBALL) $(FS_GET_STATS) \
> + $(hide) $(LINARO_MKTARBALL) $(FS_GET_STATS) \
> $(PRODUCT_OUT)/root . $(PRIVATE_ROOT_TAR) \
> $(INSTALLED_ROOTTARBALL_TARGET)
> endef
> --
> 1.7.1
>
>