summaryrefslogtreecommitdiff
path: root/release/install-stripped
diff options
context:
space:
mode:
authorMiles Bader <miles@gnu.org>1996-07-31 19:23:59 +0000
committerMiles Bader <miles@gnu.org>1996-07-31 19:23:59 +0000
commitb245bd1420e8f75dfa3e89c566c7f36023730b62 (patch)
treedbf4929353d729e89d81b88404ff93bbeb6c8633 /release/install-stripped
parentf28788d1d61c2757724f744b1dec8f64c7268fc2 (diff)
(copy/copyattrs): New function.
(copy/plaincopy, copy/objcopy, copy): Use copyattrs.
Diffstat (limited to 'release/install-stripped')
-rwxr-xr-xrelease/install-stripped16
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