summaryrefslogtreecommitdiff
path: root/bin/cpa
diff options
context:
space:
mode:
authorLaurent Bercot <ska-skaware@skarnet.org>2017-05-22 21:56:04 +0000
committerLaurent Bercot <ska-skaware@skarnet.org>2017-05-22 21:56:04 +0000
commit82d0f92ab8b84466ae20ab919c1f9c3577b5cecb (patch)
tree776015ae6c6a386125b2d39e13b62f91b99548f8 /bin/cpa
downloadlh-bootstrap-82d0f92ab8b84466ae20ab919c1f9c3577b5cecb.tar.xz
Initial commit
Diffstat (limited to 'bin/cpa')
-rwxr-xr-xbin/cpa17
1 files changed, 17 insertions, 0 deletions
diff --git a/bin/cpa b/bin/cpa
new file mode 100755
index 0000000..2100191
--- /dev/null
+++ b/bin/cpa
@@ -0,0 +1,17 @@
+#!/bin/sh -e
+
+test "$#" -ge 3 || { echo "cpa: fatal: too few arguments" 1>&2 ; exit 100 ; }
+
+output="$1"
+source=$($output/build-build/command/s6-linkname -f -- $2)
+dest="$3"
+
+
+srcname=$(basename "$source")
+destdir="$output"/$(dirname "$dest")
+destname=$(basename "$dest")
+
+{ cd $(dirname "$source") && tar c "$srcname" ; } | { cd "$destdir" && tar x ; }
+if test "$srcname" != "$destname" ; then
+ mv -f "$destdir/$srcname" "$destdir/$destname"
+fi