diff options
Diffstat (limited to 'release/install-stripped')
-rwxr-xr-x | release/install-stripped | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/release/install-stripped b/release/install-stripped index bd841b37..8237c7f4 100755 --- a/release/install-stripped +++ b/release/install-stripped @@ -60,17 +60,30 @@ copy() local from=$1 local to=$2 + copyattrs() + { + local ls="`ls -l $from`" + local owner="`echo "$ls" | awk '{print $3 "." $4}'`" + local mode="`echo "$ls" | sed -e 's/^.\(...\)\(...\)\(...\).*$/u=\1,g=\2,o=\3/' -e 's/-//g' -e 's/s/xs/g'`" + chown "$owner" $to + chmod "$mode" $to + } + plaincopy() { rm -f $to echo "$from -> $to" - ln -f $from $to 2>/dev/null || install -m 644 -c $from $to + if ! ln -f $from $to 2>/dev/null; then + install -m 644 -c $from $to + copyattrs + fi } objcopy() { if $OBJCOPY --strip-debug $from $to; then echo "strip-debug $from -> $to" + copyattrs else plaincopy fi @@ -146,6 +159,7 @@ foo if test -x $from; then if $OBJCOPY -S $from $to 2>/dev/null; then echo "strip $from -> $to" + copyattrs else plaincopy fi |